From 2d5ae35a8517aa480049d37600a531d0eb6d85b8 Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Thu, 6 Nov 2025 12:38:47 -0800 Subject: [PATCH 001/178] Show all callbacks on UI --- litellm/proxy/proxy_server.py | 123 ++++--- tests/proxy_unit_tests/test_proxy_server.py | 163 ++++++++ .../src/components/settings.test.tsx | 136 +++++++ .../src/components/settings.tsx | 348 ++++++++++-------- 4 files changed, 548 insertions(+), 222 deletions(-) create mode 100644 ui/litellm-dashboard/src/components/settings.test.tsx diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index bed3d218df4..4a0d39f4518 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -9572,8 +9572,61 @@ async def get_config(): # noqa: PLR0915 _general_settings = config_data.get("general_settings", {}) environment_variables = config_data.get("environment_variables", {}) - # check if "langfuse" in litellm_settings + # Helper function to process callbacks and get environment variables + def process_callback(_callback: str, callback_type: str) -> dict: + """Process a single callback and return its data with environment variables""" + if _callback == "langfuse" or _callback == "langfuse_otel": + env_vars = [ + "LANGFUSE_PUBLIC_KEY", + "LANGFUSE_SECRET_KEY", + "LANGFUSE_HOST", + ] + elif _callback == "openmeter": + env_vars = [ + "OPENMETER_API_KEY", + ] + elif _callback == "braintrust": + env_vars = [ + "BRAINTRUST_API_KEY", + "BRAINTRUST_API_BASE", + ] + elif _callback == "traceloop": + env_vars = ["TRACELOOP_API_KEY"] + elif _callback == "custom_callback_api": + env_vars = ["GENERIC_LOGGER_ENDPOINT"] + elif _callback == "otel": + env_vars = ["OTEL_EXPORTER", "OTEL_ENDPOINT", "OTEL_HEADERS"] + elif _callback == "langsmith": + env_vars = [ + "LANGSMITH_API_KEY", + "LANGSMITH_PROJECT", + "LANGSMITH_DEFAULT_RUN_NAME", + ] + else: + env_vars = [] + + env_vars_dict = {} + for _var in env_vars: + env_variable = environment_variables.get(_var, None) + if env_variable is None: + env_vars_dict[_var] = None + else: + # decode + decrypt the value + decrypted_value = decrypt_value_helper( + value=env_variable, key=_var + ) + env_vars_dict[_var] = decrypted_value + + return { + "name": _callback, + "variables": env_vars_dict, + "type": callback_type + } + _success_callbacks = _litellm_settings.get("success_callback", []) + _failure_callbacks = _litellm_settings.get("failure_callback", []) + _generic_callbacks = _litellm_settings.get("callbacks", []) + _data_to_return = [] """ [ @@ -9584,70 +9637,20 @@ async def get_config(): # noqa: PLR0915 "LANGFUSE_SECRET_KEY": "value", "LANGFUSE_HOST": "value" }, + "type": "success" } ] """ + for _callback in _success_callbacks: - if _callback != "langfuse": - if _callback == "openmeter": - env_vars = [ - "OPENMETER_API_KEY", - ] - elif _callback == "braintrust": - env_vars = [ - "BRAINTRUST_API_KEY", - "BRAINTRUST_API_BASE", - ] - elif _callback == "traceloop": - env_vars = ["TRACELOOP_API_KEY"] - elif _callback == "custom_callback_api": - env_vars = ["GENERIC_LOGGER_ENDPOINT"] - elif _callback == "otel": - env_vars = ["OTEL_EXPORTER", "OTEL_ENDPOINT", "OTEL_HEADERS"] - elif _callback == "langsmith": - env_vars = [ - "LANGSMITH_API_KEY", - "LANGSMITH_PROJECT", - "LANGSMITH_DEFAULT_RUN_NAME", - ] - else: - env_vars = [] - - env_vars_dict = {} - for _var in env_vars: - env_variable = environment_variables.get(_var, None) - if env_variable is None: - env_vars_dict[_var] = None - else: - # decode + decrypt the value - decrypted_value = decrypt_value_helper( - value=env_variable, key=_var - ) - env_vars_dict[_var] = decrypted_value - - _data_to_return.append({"name": _callback, "variables": env_vars_dict}) - elif _callback == "langfuse": - _langfuse_vars = [ - "LANGFUSE_PUBLIC_KEY", - "LANGFUSE_SECRET_KEY", - "LANGFUSE_HOST", - ] - _langfuse_env_vars = {} - for _var in _langfuse_vars: - env_variable = environment_variables.get(_var, None) - if env_variable is None: - _langfuse_env_vars[_var] = None - else: - # decode + decrypt the value - decrypted_value = decrypt_value_helper( - value=env_variable, key=_var - ) - _langfuse_env_vars[_var] = decrypted_value - - _data_to_return.append( - {"name": _callback, "variables": _langfuse_env_vars} - ) + _data_to_return.append(process_callback(_callback, "success")) + + for _callback in _failure_callbacks: + _data_to_return.append(process_callback(_callback, "failure")) + + for _callback in _generic_callbacks: + _data_to_return.append(process_callback(_callback, "generic")) # Check if slack alerting is on _alerting = _general_settings.get("alerting", []) diff --git a/tests/proxy_unit_tests/test_proxy_server.py b/tests/proxy_unit_tests/test_proxy_server.py index 1f4bf806c16..3aeb8a840c9 100644 --- a/tests/proxy_unit_tests/test_proxy_server.py +++ b/tests/proxy_unit_tests/test_proxy_server.py @@ -2371,3 +2371,166 @@ def test_non_root_ui_path_logic(monkeypatch, tmp_path, ui_exists, ui_has_content error_calls = [call[0][0] for call in mock_logger.error.call_args_list] assert any("Path exists:" in call for call in error_calls) assert mock_logger.info.call_count == 0 + + +@pytest.mark.asyncio +async def test_get_config_callbacks_with_all_types(client_no_auth): + """ + Test that /get/config/callbacks returns all three callback types: + - success_callback with type="success" + - failure_callback with type="failure" + - callbacks (generic) with type="generic" + """ + from litellm.proxy.proxy_server import ProxyConfig + + # Create a mock config with all three callback types + mock_config_data = { + "litellm_settings": { + "success_callback": ["langfuse", "braintrust"], + "failure_callback": ["sentry"], + "callbacks": ["otel", "langsmith"] + }, + "environment_variables": { + "LANGFUSE_PUBLIC_KEY": "test-public-key", + "LANGFUSE_SECRET_KEY": "test-secret-key", + "LANGFUSE_HOST": "https://test.langfuse.com", + "BRAINTRUST_API_KEY": "test-braintrust-key", + "OTEL_EXPORTER": "otlp", + "OTEL_ENDPOINT": "http://localhost:4317", + "LANGSMITH_API_KEY": "test-langsmith-key", + }, + "general_settings": {} + } + + proxy_config = getattr(litellm.proxy.proxy_server, "proxy_config") + + with patch.object( + proxy_config, "get_config", new=AsyncMock(return_value=mock_config_data) + ), patch( + "litellm.proxy.proxy_server.decrypt_value_helper", + side_effect=lambda value, key=None: value + ): + response = client_no_auth.get("/get/config/callbacks") + + assert response.status_code == 200 + result = response.json() + + # Verify response structure + assert "status" in result + assert result["status"] == "success" + assert "callbacks" in result + + callbacks = result["callbacks"] + + # Verify we have all 5 callbacks (2 success + 1 failure + 2 generic) + assert len(callbacks) == 5 + + # Group callbacks by type + success_callbacks = [cb for cb in callbacks if cb.get("type") == "success"] + failure_callbacks = [cb for cb in callbacks if cb.get("type") == "failure"] + generic_callbacks = [cb for cb in callbacks if cb.get("type") == "generic"] + + # Verify all callbacks have required fields + for callback in callbacks: + assert "name" in callback + assert "variables" in callback + assert "type" in callback + assert callback["type"] in ["success", "failure", "generic"] + + # Verify success callbacks + assert len(success_callbacks) == 2 + success_names = [cb["name"] for cb in success_callbacks] + assert "langfuse" in success_names + assert "braintrust" in success_names + + # Verify failure callbacks + assert len(failure_callbacks) == 1 + assert failure_callbacks[0]["name"] == "sentry" + + # Verify generic callbacks + assert len(generic_callbacks) == 2 + generic_names = [cb["name"] for cb in generic_callbacks] + assert "otel" in generic_names + assert "langsmith" in generic_names + + +@pytest.mark.asyncio +async def test_get_config_callbacks_environment_variables(client_no_auth): + """ + Test that /get/config/callbacks correctly includes environment variables + for each callback type with proper decryption. + """ + from litellm.proxy.proxy_server import ProxyConfig + + # Create a mock config with callbacks and their env vars + mock_config_data = { + "litellm_settings": { + "success_callback": ["langfuse"], + "failure_callback": [], + "callbacks": ["otel"] + }, + "environment_variables": { + "LANGFUSE_PUBLIC_KEY": "encrypted-public-key", + "LANGFUSE_SECRET_KEY": "encrypted-secret-key", + "LANGFUSE_HOST": "https://cloud.langfuse.com", + "OTEL_EXPORTER": "otlp", + "OTEL_ENDPOINT": "http://localhost:4317", + "OTEL_HEADERS": "key=value", + }, + "general_settings": {} + } + + # Mock decrypt to prepend "decrypted-" to values + def mock_decrypt(value, key=None): + if value and isinstance(value, str) and "encrypted" in value: + return f"decrypted-{value}" + return value + + proxy_config = getattr(litellm.proxy.proxy_server, "proxy_config") + + with patch.object( + proxy_config, "get_config", new=AsyncMock(return_value=mock_config_data) + ), patch( + "litellm.proxy.proxy_server.decrypt_value_helper", + side_effect=mock_decrypt + ): + response = client_no_auth.get("/get/config/callbacks") + + assert response.status_code == 200 + result = response.json() + + callbacks = result["callbacks"] + + # Find langfuse callback (success type) + langfuse_callback = next( + (cb for cb in callbacks if cb["name"] == "langfuse"), None + ) + assert langfuse_callback is not None + assert langfuse_callback["type"] == "success" + assert "variables" in langfuse_callback + + # Verify langfuse env vars are present and decrypted + langfuse_vars = langfuse_callback["variables"] + assert "LANGFUSE_PUBLIC_KEY" in langfuse_vars + assert langfuse_vars["LANGFUSE_PUBLIC_KEY"] == "decrypted-encrypted-public-key" + assert "LANGFUSE_SECRET_KEY" in langfuse_vars + assert langfuse_vars["LANGFUSE_SECRET_KEY"] == "decrypted-encrypted-secret-key" + assert "LANGFUSE_HOST" in langfuse_vars + assert langfuse_vars["LANGFUSE_HOST"] == "https://cloud.langfuse.com" + + # Find otel callback (generic type) + otel_callback = next( + (cb for cb in callbacks if cb["name"] == "otel"), None + ) + assert otel_callback is not None + assert otel_callback["type"] == "generic" + assert "variables" in otel_callback + + # Verify otel env vars are present + otel_vars = otel_callback["variables"] + assert "OTEL_EXPORTER" in otel_vars + assert otel_vars["OTEL_EXPORTER"] == "otlp" + assert "OTEL_ENDPOINT" in otel_vars + assert otel_vars["OTEL_ENDPOINT"] == "http://localhost:4317" + assert "OTEL_HEADERS" in otel_vars + assert otel_vars["OTEL_HEADERS"] == "key=value" diff --git a/ui/litellm-dashboard/src/components/settings.test.tsx b/ui/litellm-dashboard/src/components/settings.test.tsx new file mode 100644 index 00000000000..72a265eadd9 --- /dev/null +++ b/ui/litellm-dashboard/src/components/settings.test.tsx @@ -0,0 +1,136 @@ +import { render, screen, fireEvent, waitFor } from "@testing-library/react"; +import { describe, expect, it, beforeAll, beforeEach, vi } from "vitest"; +import Settings from "./settings"; +import * as networking from "./networking"; + +beforeAll(() => { + Object.defineProperty(window, "matchMedia", { + writable: true, + value: (query: string) => ({ + matches: false, + media: query, + onchange: null, + addListener: () => {}, + removeListener: () => {}, + addEventListener: () => {}, + removeEventListener: () => {}, + dispatchEvent: () => true, + }), + }); +}); + +const mockCallbacksData = { + callbacks: [ + { + name: "langfuse", + type: "success", + variables: { + LANGFUSE_PUBLIC_KEY: "test_key", + LANGFUSE_SECRET_KEY: "test_secret", + }, + }, + { + name: "datadog", + type: "success", + variables: { + DD_API_KEY: "test_dd_key", + }, + }, + ], + available_callbacks: [ + { + litellm_callback_name: "langfuse", + ui_callback_name: "Langfuse", + litellm_callback_params: ["LANGFUSE_PUBLIC_KEY", "LANGFUSE_SECRET_KEY"], + }, + { + litellm_callback_name: "datadog", + ui_callback_name: "Datadog", + litellm_callback_params: ["DD_API_KEY"], + }, + ], + alerts: [], +}; + +describe("Settings", () => { + it("should render the settings page", () => { + render(); + }); +}); + +describe("Logging Callbacks Section", () => { + beforeEach(() => { + vi.clearAllMocks(); + }); + + it("should display the list of active callbacks", async () => { + vi.spyOn(networking, "getCallbacksCall").mockResolvedValue(mockCallbacksData); + + render(); + + await waitFor( + () => { + expect(screen.getByText("langfuse")).toBeInTheDocument(); + expect(screen.getByText("datadog")).toBeInTheDocument(); + }, + { timeout: 3000 }, + ); + }); + + it("should open add callback modal and display form", async () => { + vi.spyOn(networking, "getCallbacksCall").mockResolvedValue(mockCallbacksData); + + render(); + + await waitFor(() => { + expect(screen.getByText("langfuse")).toBeInTheDocument(); + }); + + const addButton = screen.getByText("Add Callback"); + fireEvent.click(addButton); + + await waitFor(() => { + expect(screen.getByText("Add Logging Callback")).toBeInTheDocument(); + expect(screen.getByText("LiteLLM Docs: Logging")).toBeInTheDocument(); + }); + }); + + it("should successfully delete a callback", async () => { + const getCallbacksSpy = vi.spyOn(networking, "getCallbacksCall").mockResolvedValue(mockCallbacksData); + const deleteCallbackSpy = vi.spyOn(networking, "deleteCallback").mockResolvedValue(undefined); + + const { container } = render( + , + ); + + await waitFor(() => { + expect(screen.getByText("langfuse")).toBeInTheDocument(); + }); + + const trashIcons = container.querySelectorAll("svg"); + const trashIcon = Array.from(trashIcons).find((svg) => { + const parentElement = svg.parentElement; + return parentElement?.className.includes("text-red") || parentElement?.outerHTML.includes("red"); + }); + + expect(trashIcon).toBeDefined(); + if (trashIcon && trashIcon.parentElement) { + fireEvent.click(trashIcon.parentElement); + } + + await waitFor(() => { + const modalText = screen.getByText((content, element) => { + return element?.tagName.toLowerCase() === "p" && content.includes("Are you sure you want to delete"); + }); + expect(modalText).toBeInTheDocument(); + }); + + const deleteButton = screen.getByRole("button", { name: "Delete" }); + fireEvent.click(deleteButton); + + await waitFor(() => { + expect(deleteCallbackSpy).toHaveBeenCalledWith("test-token", "langfuse"); + expect(getCallbacksSpy).toHaveBeenCalledTimes(2); + }); + }); +}); diff --git a/ui/litellm-dashboard/src/components/settings.tsx b/ui/litellm-dashboard/src/components/settings.tsx index 727c8b9b511..a275214918c 100644 --- a/ui/litellm-dashboard/src/components/settings.tsx +++ b/ui/litellm-dashboard/src/components/settings.tsx @@ -19,11 +19,12 @@ import { Tab, SelectItem, Icon, + Badge, } from "@tremor/react"; import { PencilAltIcon, TrashIcon } from "@heroicons/react/outline"; -import { Modal, Typography, Form, Input, Select, Button as Button2 } from "antd"; +import { Modal, Typography, Form, Input, Select, Button as Button2, Tooltip } from "antd"; import NotificationsManager from "./molecules/notifications_manager"; import EmailSettings from "./email_settings"; @@ -32,10 +33,7 @@ const { Title, Paragraph } = Typography; import { getCallbacksCall, setCallbacksCall, serviceHealthCheck, deleteCallback } from "./networking"; import AlertingSettings from "./alerting/alerting_settings"; import FormItem from "antd/es/form/FormItem"; -import { - CALLBACK_CONFIGS, - getCallbackById, -} from "./callback_info_helpers"; +import { CALLBACK_CONFIGS, getCallbackById } from "./callback_info_helpers"; import { parseErrorMessage } from "./shared/errorUtils"; interface SettingsPageProps { accessToken: string | null; @@ -60,6 +58,7 @@ interface AlertingVariables { interface AlertingObject { name: string; + type?: "success" | "failure" | "generic"; variables: AlertingVariables; } @@ -216,10 +215,10 @@ const Settings: React.FC = ({ accessToken, userRole, userID, const handleSelectedCallbackChange = (callbackName: string) => { setSelectedCallback(callbackName); - + // Get the callback configuration using the new clean structure const callbackConfig = getCallbackById(callbackName); - + // Get the parameters from the callback configuration if (callbackConfig?.dynamic_params) { const params = Object.keys(callbackConfig.dynamic_params); @@ -228,7 +227,7 @@ const Settings: React.FC = ({ accessToken, userRole, userID, setSelectedCallbackParams([]); } }; - + const handleSaveAlerts = async () => { if (!accessToken) { return; @@ -416,54 +415,94 @@ const Settings: React.FC = ({ accessToken, userRole, userID, Active Logging Callbacks - + Callback Name - {/* Callback Env Vars */} + Callback Type + Actions - {callbacks.map((callback, index) => ( - - - {callback.name} - - - - { - setSelectedEditCallback(callback); - setShowEditCallback(true); - }} - /> - handleDeleteCallback(callback.name)} - className="text-red-500 hover:text-red-700 cursor-pointer" - /> - - - - - ))} + {callbacks.map((callback, index) => { + const canEdit = !callback.type || callback.type === "success"; + const tooltipMessage = + callback.type === "failure" + ? "Modifications and deletion of failure type callbacks are not yet supported in the UI" + : callback.type === "generic" + ? "Modifications and deletion of generic type callbacks are not yet supported in the UI" + : ""; + + const getBadgeColor = (type?: string) => { + if (type === "success") return "green"; + if (type === "failure") return "red"; + if (type === "generic") return "blue"; + return "gray"; + }; + + return ( + + + {callback.name} + + + {callback.type ? ( + {callback.type} + ) : ( + success + )} + + +
+ + { + if (canEdit) { + setSelectedEditCallback(callback); + setShowEditCallback(true); + } + }} + className={canEdit ? "cursor-pointer" : "opacity-40 cursor-not-allowed"} + /> + + + { + if (canEdit) { + handleDeleteCallback(callback.name); + } + }} + className={ + canEdit + ? "text-red-500 hover:text-red-700 cursor-pointer" + : "text-red-300 opacity-40 cursor-not-allowed" + } + /> + + +
+
+
+ ); + })}
@@ -594,124 +633,109 @@ const Settings: React.FC = ({ accessToken, userRole, userID, wrapperCol={{ span: 16 }} labelAlign="left" > - + - (option?.children?.toString() ?? "") - .toLowerCase() - .includes(input.toLowerCase()) - } - onChange={(value) => { - handleSelectedCallbackChange(value); - }} - > - {CALLBACK_CONFIGS.map((callbackConfig) => ( - -
-
- {/* eslint-disable-next-line @next/next/no-img-element */} - {`${callbackConfig.displayName} { - e.currentTarget.style.display = 'none'; - }} - /> -
- - {callbackConfig.displayName} - + {CALLBACK_CONFIGS.map((callbackConfig) => ( + +
+
+ {/* eslint-disable-next-line @next/next/no-img-element */} + {`${callbackConfig.displayName} { + e.currentTarget.style.display = "none"; + }} + />
- - ))} - - + {callbackConfig.displayName} +
+
+ ))} + + - {selectedCallbackParams && selectedCallbackParams.length > 0 && ( -
- {selectedCallbackParams.map((param) => { - // Get the callback configuration to look up parameter types - const callbackConfig = getCallbackById(selectedCallback || ''); - const paramType = callbackConfig?.dynamic_params[param] || "text"; - - const fieldLabel = param.replace(/_/g, " ").replace(/\b\w/g, l => l.toUpperCase()); - - return ( - - {fieldLabel} - * - - } - name={param} - key={param} - className="mb-4" - rules={[ - { - required: true, - message: `Please enter the ${fieldLabel.toLowerCase()}`, - }, - ]} - > - {paramType === "password" ? ( - - ) : paramType === "number" ? ( - - ) : ( - - )} - - ); - })} -
- )} + {selectedCallbackParams && selectedCallbackParams.length > 0 && ( +
+ {selectedCallbackParams.map((param) => { + // Get the callback configuration to look up parameter types + const callbackConfig = getCallbackById(selectedCallback || ""); + const paramType = callbackConfig?.dynamic_params[param] || "text"; -
- - - Add Callback - + const fieldLabel = param.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase()); + + return ( + + {fieldLabel} + * + + } + name={param} + key={param} + className="mb-4" + rules={[ + { + required: true, + message: `Please enter the ${fieldLabel.toLowerCase()}`, + }, + ]} + > + {paramType === "password" ? ( + + ) : paramType === "number" ? ( + + ) : ( + + )} + + ); + })}
+ )} + +
+ + Add Callback +
From 0af3a51a974130009027355baa51b16750741d8b Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Thu, 6 Nov 2025 12:48:04 -0800 Subject: [PATCH 002/178] Fix tests --- ui/litellm-dashboard/src/components/settings.test.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ui/litellm-dashboard/src/components/settings.test.tsx b/ui/litellm-dashboard/src/components/settings.test.tsx index 72a265eadd9..20dadf9d2a5 100644 --- a/ui/litellm-dashboard/src/components/settings.test.tsx +++ b/ui/litellm-dashboard/src/components/settings.test.tsx @@ -54,6 +54,10 @@ const mockCallbacksData = { describe("Settings", () => { it("should render the settings page", () => { + vi.spyOn(networking, "alertingSettingsCall").mockResolvedValue([]); + vi.spyOn(networking, "getEmailEventSettings").mockResolvedValue({ settings: [] }); + vi.spyOn(networking, "getCallbacksCall").mockResolvedValue(mockCallbacksData); + render(); }); }); @@ -61,6 +65,8 @@ describe("Settings", () => { describe("Logging Callbacks Section", () => { beforeEach(() => { vi.clearAllMocks(); + vi.spyOn(networking, "alertingSettingsCall").mockResolvedValue([]); + vi.spyOn(networking, "getEmailEventSettings").mockResolvedValue({ settings: [] }); }); it("should display the list of active callbacks", async () => { From 3a96c700b4173aca63a90283ecfce57bfc636f9d Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Fri, 7 Nov 2025 15:02:41 -0800 Subject: [PATCH 003/178] Adjusted based on comments --- litellm/integrations/custom_logger.py | 38 +++++++++++++++++++ litellm/proxy/_types.py | 8 ++++ litellm/proxy/proxy_server.py | 37 +++--------------- tests/local_testing/test_custom_logger.py | 18 +++++++++ .../src/components/settings.tsx | 19 +++++++--- 5 files changed, 82 insertions(+), 38 deletions(-) diff --git a/litellm/integrations/custom_logger.py b/litellm/integrations/custom_logger.py index fd8ab2bad9d..2a08408f7de 100644 --- a/litellm/integrations/custom_logger.py +++ b/litellm/integrations/custom_logger.py @@ -81,6 +81,44 @@ class CustomLogger: # https://docs.litellm.ai/docs/observability/custom_callbac self.turn_off_message_logging = turn_off_message_logging pass + @staticmethod + def get_callback_env_vars(callback_name: Optional[str] = None) -> List[str]: + """ + Return the environment variables associated with a given callback + name as defined in the proxy callback registry. + + Args: + callback_name: The name of the callback to look up. + + Returns: + List[str]: A list of required environment variable names. + """ + if callback_name is None: + return [] + + normalized_name = callback_name.lower() + + alias_map = { + "langfuse_otel": "langfuse", + } + lookup_name = alias_map.get(normalized_name, normalized_name) + + try: + from litellm.proxy._types import AllCallbacks + except Exception: + return [] + + callbacks = AllCallbacks() + callback_info = getattr(callbacks, lookup_name, None) + if callback_info is None: + return [] + + params = getattr(callback_info, "litellm_callback_params", None) + if not params: + return [] + + return list(params) + def log_pre_api_call(self, model, messages, kwargs): pass diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.py index d739727ccab..397bfc9c3b8 100644 --- a/litellm/proxy/_types.py +++ b/litellm/proxy/_types.py @@ -2503,6 +2503,14 @@ class AllCallbacks(LiteLLMPydanticObjectBase): ui_callback_name="Lago Billing", ) + traceloop: CallbackOnUI = CallbackOnUI( + litellm_callback_name="traceloop", + litellm_callback_params=[ + "TRACELoop_API_KEY", + ], + ui_callback_name="Traceloop", + ) + class SpendLogsMetadata(TypedDict): """ diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 4a0d39f4518..9a582814a55 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -153,6 +153,7 @@ from litellm.constants import ( ) from litellm.exceptions import RejectedRequestError from litellm.integrations.SlackAlerting.slack_alerting import SlackAlerting +from litellm.integrations.custom_logger import CustomLogger from litellm.litellm_core_utils.core_helpers import ( _get_parent_otel_span_from_kwargs, get_litellm_metadata_from_kwargs, @@ -9575,35 +9576,7 @@ async def get_config(): # noqa: PLR0915 # Helper function to process callbacks and get environment variables def process_callback(_callback: str, callback_type: str) -> dict: """Process a single callback and return its data with environment variables""" - if _callback == "langfuse" or _callback == "langfuse_otel": - env_vars = [ - "LANGFUSE_PUBLIC_KEY", - "LANGFUSE_SECRET_KEY", - "LANGFUSE_HOST", - ] - elif _callback == "openmeter": - env_vars = [ - "OPENMETER_API_KEY", - ] - elif _callback == "braintrust": - env_vars = [ - "BRAINTRUST_API_KEY", - "BRAINTRUST_API_BASE", - ] - elif _callback == "traceloop": - env_vars = ["TRACELOOP_API_KEY"] - elif _callback == "custom_callback_api": - env_vars = ["GENERIC_LOGGER_ENDPOINT"] - elif _callback == "otel": - env_vars = ["OTEL_EXPORTER", "OTEL_ENDPOINT", "OTEL_HEADERS"] - elif _callback == "langsmith": - env_vars = [ - "LANGSMITH_API_KEY", - "LANGSMITH_PROJECT", - "LANGSMITH_DEFAULT_RUN_NAME", - ] - else: - env_vars = [] + env_vars = CustomLogger.get_callback_env_vars(_callback) env_vars_dict = {} for _var in env_vars: @@ -9625,7 +9598,7 @@ async def get_config(): # noqa: PLR0915 _success_callbacks = _litellm_settings.get("success_callback", []) _failure_callbacks = _litellm_settings.get("failure_callback", []) - _generic_callbacks = _litellm_settings.get("callbacks", []) + _success_and_failure_callbacks = _litellm_settings.get("callbacks", []) _data_to_return = [] """ @@ -9649,8 +9622,8 @@ async def get_config(): # noqa: PLR0915 for _callback in _failure_callbacks: _data_to_return.append(process_callback(_callback, "failure")) - for _callback in _generic_callbacks: - _data_to_return.append(process_callback(_callback, "generic")) + for _callback in _success_and_failure_callbacks: + _data_to_return.append(process_callback(_callback, "success_and_failure")) # Check if slack alerting is on _alerting = _general_settings.get("alerting", []) diff --git a/tests/local_testing/test_custom_logger.py b/tests/local_testing/test_custom_logger.py index 00e7c2d5aa1..f3dc6a0a7a4 100644 --- a/tests/local_testing/test_custom_logger.py +++ b/tests/local_testing/test_custom_logger.py @@ -103,6 +103,24 @@ class TmpFunction: ) +def test_get_callback_env_vars(): + env_vars = CustomLogger.get_callback_env_vars("langfuse") + assert env_vars == [ + "LANGFUSE_PUBLIC_KEY", + "LANGFUSE_SECRET_KEY", + "LANGFUSE_HOST", + ] + + alias_env_vars = CustomLogger.get_callback_env_vars("langfuse_otel") + assert alias_env_vars == env_vars + + missing_env_vars = CustomLogger.get_callback_env_vars("does_not_exist") + assert missing_env_vars == [] + + none_env_vars = CustomLogger.get_callback_env_vars(None) + assert none_env_vars == [] + + @pytest.mark.asyncio async def test_async_chat_openai_stream(): try: diff --git a/ui/litellm-dashboard/src/components/settings.tsx b/ui/litellm-dashboard/src/components/settings.tsx index a275214918c..e8ac54e99dd 100644 --- a/ui/litellm-dashboard/src/components/settings.tsx +++ b/ui/litellm-dashboard/src/components/settings.tsx @@ -58,7 +58,7 @@ interface AlertingVariables { interface AlertingObject { name: string; - type?: "success" | "failure" | "generic"; + type?: "success" | "failure" | "success_and_failure"; variables: AlertingVariables; } @@ -430,17 +430,24 @@ const Settings: React.FC = ({ accessToken, userRole, userID, const tooltipMessage = callback.type === "failure" ? "Modifications and deletion of failure type callbacks are not yet supported in the UI" - : callback.type === "generic" - ? "Modifications and deletion of generic type callbacks are not yet supported in the UI" + : callback.type === "success_and_failure" + ? "Modifications and deletion of success and failure type callbacks are not yet supported in the UI" : ""; const getBadgeColor = (type?: string) => { if (type === "success") return "green"; if (type === "failure") return "red"; - if (type === "generic") return "blue"; + if (type === "success_and_failure") return "blue"; return "gray"; }; + const getBadgeLabel = (type?: string) => { + if (type === "success") return "Success Only"; + if (type === "failure") return "Failure Only"; + if (type === "success_and_failure") return "Success & Failure"; + return "Unknown"; + }; + return ( @@ -448,9 +455,9 @@ const Settings: React.FC = ({ accessToken, userRole, userID, {callback.type ? ( - {callback.type} + {getBadgeLabel(callback.type)} ) : ( - success + Unknown )} From 9be008a54b22d41d4f6727c10afe9335a6c7827a Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Sat, 8 Nov 2025 14:50:53 -0800 Subject: [PATCH 004/178] Fixed typo --- litellm/proxy/_types.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.py index 397bfc9c3b8..17be7c18aab 100644 --- a/litellm/proxy/_types.py +++ b/litellm/proxy/_types.py @@ -2506,7 +2506,7 @@ class AllCallbacks(LiteLLMPydanticObjectBase): traceloop: CallbackOnUI = CallbackOnUI( litellm_callback_name="traceloop", litellm_callback_params=[ - "TRACELoop_API_KEY", + "TRACELOOP_API_KEY", ], ui_callback_name="Traceloop", ) From 67bca6dde4aaacda4c2acadab0bb5f61aaaeaa10 Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Sat, 8 Nov 2025 15:00:58 -0800 Subject: [PATCH 005/178] Fix linting --- litellm/proxy/proxy_server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 9a582814a55..4acd2639d8f 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -9578,7 +9578,7 @@ async def get_config(): # noqa: PLR0915 """Process a single callback and return its data with environment variables""" env_vars = CustomLogger.get_callback_env_vars(_callback) - env_vars_dict = {} + env_vars_dict: dict[str, str | None] = {} for _var in env_vars: env_variable = environment_variables.get(_var, None) if env_variable is None: From 7833b3fdb4ed3d52dbf37d8f8c9c8923b6fd6386 Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Mon, 10 Nov 2025 17:28:13 -0800 Subject: [PATCH 006/178] Addressing comments --- litellm/proxy/common_utils/callback_utils.py | 26 ++++++++++ litellm/proxy/proxy_server.py | 30 ++---------- tests/proxy_unit_tests/test_proxy_server.py | 26 +++++----- .../proxy/common_utils/test_callback_utils.py | 47 +++++++++++++++++++ 4 files changed, 90 insertions(+), 39 deletions(-) diff --git a/litellm/proxy/common_utils/callback_utils.py b/litellm/proxy/common_utils/callback_utils.py index fb7ada8ab10..eb312612779 100644 --- a/litellm/proxy/common_utils/callback_utils.py +++ b/litellm/proxy/common_utils/callback_utils.py @@ -3,8 +3,12 @@ from typing import Any, Dict, List, Literal, Optional import litellm from litellm import get_secret from litellm._logging import verbose_proxy_logger +from litellm.integrations.custom_logger import CustomLogger from litellm.proxy._types import CommonProxyErrors, LiteLLMPromptInjectionParams from litellm.proxy.types_utils.utils import get_instance_fn +from litellm.proxy.common_utils.encrypt_decrypt_utils import ( + decrypt_value_helper, +) blue_color_code = "\033[94m" reset_color_code = "\033[0m" @@ -382,3 +386,25 @@ def get_metadata_variable_name_from_kwargs( - LiteLLM is now moving to using `litellm_metadata` for our metadata """ return "litellm_metadata" if "litellm_metadata" in kwargs else "metadata" + +def process_callback(_callback: str, callback_type: str, environment_variables: dict) -> dict: + """Process a single callback and return its data with environment variables""" + env_vars = CustomLogger.get_callback_env_vars(_callback) + + env_vars_dict: dict[str, str | None] = {} + for _var in env_vars: + env_variable = environment_variables.get(_var, None) + if env_variable is None: + env_vars_dict[_var] = None + else: + # decode + decrypt the value + decrypted_value = decrypt_value_helper( + value=env_variable, key=_var + ) + env_vars_dict[_var] = decrypted_value + + return { + "name": _callback, + "variables": env_vars_dict, + "type": callback_type + } \ No newline at end of file diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 090757da4ad..205609a645c 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -47,6 +47,7 @@ from litellm.types.utils import ( TokenCountResponse, ) from litellm.utils import load_credentials_from_list +from litellm.proxy.common_utils.callback_utils import process_callback if TYPE_CHECKING: from aiohttp import ClientSession @@ -9582,29 +9583,6 @@ async def get_config(): # noqa: PLR0915 _general_settings = config_data.get("general_settings", {}) environment_variables = config_data.get("environment_variables", {}) - # Helper function to process callbacks and get environment variables - def process_callback(_callback: str, callback_type: str) -> dict: - """Process a single callback and return its data with environment variables""" - env_vars = CustomLogger.get_callback_env_vars(_callback) - - env_vars_dict: dict[str, str | None] = {} - for _var in env_vars: - env_variable = environment_variables.get(_var, None) - if env_variable is None: - env_vars_dict[_var] = None - else: - # decode + decrypt the value - decrypted_value = decrypt_value_helper( - value=env_variable, key=_var - ) - env_vars_dict[_var] = decrypted_value - - return { - "name": _callback, - "variables": env_vars_dict, - "type": callback_type - } - _success_callbacks = _litellm_settings.get("success_callback", []) _failure_callbacks = _litellm_settings.get("failure_callback", []) _success_and_failure_callbacks = _litellm_settings.get("callbacks", []) @@ -9626,13 +9604,13 @@ async def get_config(): # noqa: PLR0915 """ for _callback in _success_callbacks: - _data_to_return.append(process_callback(_callback, "success")) + _data_to_return.append(process_callback(_callback, "success", environment_variables)) for _callback in _failure_callbacks: - _data_to_return.append(process_callback(_callback, "failure")) + _data_to_return.append(process_callback(_callback, "failure", environment_variables)) for _callback in _success_and_failure_callbacks: - _data_to_return.append(process_callback(_callback, "success_and_failure")) + _data_to_return.append(process_callback(_callback, "success_and_failure", environment_variables)) # Check if slack alerting is on _alerting = _general_settings.get("alerting", []) diff --git a/tests/proxy_unit_tests/test_proxy_server.py b/tests/proxy_unit_tests/test_proxy_server.py index 71b4503ff3c..17a6f8eb9ae 100644 --- a/tests/proxy_unit_tests/test_proxy_server.py +++ b/tests/proxy_unit_tests/test_proxy_server.py @@ -2409,7 +2409,7 @@ async def test_get_config_callbacks_with_all_types(client_no_auth): Test that /get/config/callbacks returns all three callback types: - success_callback with type="success" - failure_callback with type="failure" - - callbacks (generic) with type="generic" + - callbacks (success_and_failure) with type="success_and_failure" """ from litellm.proxy.proxy_server import ProxyConfig @@ -2437,7 +2437,7 @@ async def test_get_config_callbacks_with_all_types(client_no_auth): with patch.object( proxy_config, "get_config", new=AsyncMock(return_value=mock_config_data) ), patch( - "litellm.proxy.proxy_server.decrypt_value_helper", + "litellm.proxy.common_utils.callback_utils.decrypt_value_helper", side_effect=lambda value, key=None: value ): response = client_no_auth.get("/get/config/callbacks") @@ -2452,20 +2452,20 @@ async def test_get_config_callbacks_with_all_types(client_no_auth): callbacks = result["callbacks"] - # Verify we have all 5 callbacks (2 success + 1 failure + 2 generic) + # Verify we have all 5 callbacks (2 success + 1 failure + 2 success_and_failure) assert len(callbacks) == 5 # Group callbacks by type success_callbacks = [cb for cb in callbacks if cb.get("type") == "success"] failure_callbacks = [cb for cb in callbacks if cb.get("type") == "failure"] - generic_callbacks = [cb for cb in callbacks if cb.get("type") == "generic"] + success_and_failure_callbacks = [cb for cb in callbacks if cb.get("type") == "success_and_failure"] # Verify all callbacks have required fields for callback in callbacks: assert "name" in callback assert "variables" in callback assert "type" in callback - assert callback["type"] in ["success", "failure", "generic"] + assert callback["type"] in ["success", "failure", "success_and_failure"] # Verify success callbacks assert len(success_callbacks) == 2 @@ -2477,11 +2477,11 @@ async def test_get_config_callbacks_with_all_types(client_no_auth): assert len(failure_callbacks) == 1 assert failure_callbacks[0]["name"] == "sentry" - # Verify generic callbacks - assert len(generic_callbacks) == 2 - generic_names = [cb["name"] for cb in generic_callbacks] - assert "otel" in generic_names - assert "langsmith" in generic_names + # Verify success_and_failure callbacks + assert len(success_and_failure_callbacks) == 2 + success_and_failure_names = [cb["name"] for cb in success_and_failure_callbacks] + assert "otel" in success_and_failure_names + assert "langsmith" in success_and_failure_names @pytest.mark.asyncio @@ -2521,7 +2521,7 @@ async def test_get_config_callbacks_environment_variables(client_no_auth): with patch.object( proxy_config, "get_config", new=AsyncMock(return_value=mock_config_data) ), patch( - "litellm.proxy.proxy_server.decrypt_value_helper", + "litellm.proxy.common_utils.callback_utils.decrypt_value_helper", side_effect=mock_decrypt ): response = client_no_auth.get("/get/config/callbacks") @@ -2548,12 +2548,12 @@ async def test_get_config_callbacks_environment_variables(client_no_auth): assert "LANGFUSE_HOST" in langfuse_vars assert langfuse_vars["LANGFUSE_HOST"] == "https://cloud.langfuse.com" - # Find otel callback (generic type) + # Find otel callback (success_and_failure type) otel_callback = next( (cb for cb in callbacks if cb["name"] == "otel"), None ) assert otel_callback is not None - assert otel_callback["type"] == "generic" + assert otel_callback["type"] == "success_and_failure" assert "variables" in otel_callback # Verify otel env vars are present diff --git a/tests/test_litellm/proxy/common_utils/test_callback_utils.py b/tests/test_litellm/proxy/common_utils/test_callback_utils.py index b9ed4b9b508..877f0092182 100644 --- a/tests/test_litellm/proxy/common_utils/test_callback_utils.py +++ b/tests/test_litellm/proxy/common_utils/test_callback_utils.py @@ -9,6 +9,9 @@ from litellm.proxy.common_utils.callback_utils import ( get_remaining_tokens_and_requests_from_request_data, ) +from unittest.mock import patch +from litellm.proxy.common_utils.callback_utils import process_callback + def test_get_remaining_tokens_and_requests_from_request_data(): model_group = "openrouter/google/gemini-2.0-flash-001" @@ -27,3 +30,47 @@ def test_get_remaining_tokens_and_requests_from_request_data(): f"x-litellm-key-remaining-requests-{expected_name}": 100, f"x-litellm-key-remaining-tokens-{expected_name}": 200, } + + +@patch( + "litellm.proxy.common_utils.callback_utils.CustomLogger.get_callback_env_vars", + return_value=["API_KEY", "MISSING_VAR"], +) +@patch( + "litellm.proxy.common_utils.callback_utils.decrypt_value_helper", + side_effect=lambda value, key: f"decrypted-{key}", +) +def test_process_callback_with_env_vars(mock_decrypt, mock_get_env_vars): + environment_variables = { + "API_KEY": "ENC_VALUE", + "UNUSED": "SHOULD_BE_IGNORED", + } + + result = process_callback( + _callback="my_callback", + callback_type="input", + environment_variables=environment_variables, + ) + + assert result["name"] == "my_callback" + assert result["type"] == "input" + assert result["variables"] == { + "API_KEY": "decrypted-API_KEY", + "MISSING_VAR": None, + } + + +@patch( + "litellm.proxy.common_utils.callback_utils.CustomLogger.get_callback_env_vars", + return_value=[], +) +def test_process_callback_with_no_required_env_vars(mock_get_env_vars): + result = process_callback( + _callback="another_callback", + callback_type="output", + environment_variables={"SHOULD_NOT_BE_USED": "VALUE"}, + ) + + assert result["name"] == "another_callback" + assert result["type"] == "output" + assert result["variables"] == {} From e49f21c918efd6ee8d54800981d767e417081994 Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Wed, 26 Nov 2025 18:57:57 +0530 Subject: [PATCH 007/178] Make sure that media resolution is only for gemini 3 model --- .../llms/vertex_ai/gemini/transformation.py | 18 ++++--- ...test_vertex_and_google_ai_studio_gemini.py | 47 +++++++++++++++++-- 2 files changed, 56 insertions(+), 9 deletions(-) diff --git a/litellm/llms/vertex_ai/gemini/transformation.py b/litellm/llms/vertex_ai/gemini/transformation.py index e4fcd35b954..04fde04f2c1 100644 --- a/litellm/llms/vertex_ai/gemini/transformation.py +++ b/litellm/llms/vertex_ai/gemini/transformation.py @@ -28,7 +28,6 @@ from litellm.types.files import ( get_file_type_from_extension, is_gemini_1_5_accepted_file_type, ) -from litellm.types.utils import LlmProviders from litellm.types.llms.openai import ( AllMessageValues, ChatCompletionAssistantMessage, @@ -48,7 +47,7 @@ from litellm.types.llms.vertex_ai import ( ToolConfig, Tools, ) -from litellm.types.utils import GenericImageParsingChunk +from litellm.types.utils import GenericImageParsingChunk, LlmProviders from ..common_utils import ( _check_text_in_content, @@ -82,6 +81,7 @@ def _process_gemini_image( image_url: str, format: Optional[str] = None, media_resolution: Optional[Literal["low", "medium", "high"]] = None, + model: Optional[str] = None, ) -> PartType: """ Given an image URL, return the appropriate PartType for Gemini @@ -118,16 +118,19 @@ def _process_gemini_image( # https links for unsupported mime types and base64 images image = convert_to_anthropic_image_obj(image_url, format=format) _blob: BlobType = {"data": image["data"], "mime_type": image["media_type"]} - if media_resolution is not None: - _blob["media_resolution"] = media_resolution + # media_resolution on individual Part objects is exclusive to Gemini 3 models + if media_resolution is not None and model is not None: + from .vertex_and_google_ai_studio_gemini import VertexGeminiConfig + if VertexGeminiConfig._is_gemini_3_or_newer(model): + _blob["media_resolution"] = media_resolution # Convert snake_case keys to camelCase for JSON serialization # The TypedDict uses snake_case, but the API expects camelCase _blob_dict = dict(_blob) if "media_resolution" in _blob_dict: - _blob_dict["mediaResolution"] = _blob_dict.pop("media_resolution") + _blob_dict["media_resolution"] = _blob_dict.pop("media_resolution") if "mime_type" in _blob_dict: - _blob_dict["mimeType"] = _blob_dict.pop("mime_type") + _blob_dict["mime_type"] = _blob_dict.pop("mime_type") return PartType(inline_data=cast(BlobType, _blob_dict)) raise Exception("Invalid image received - {}".format(image_url)) @@ -247,6 +250,7 @@ def _gemini_convert_messages_with_history( # noqa: PLR0915 image_url=image_url, format=format, media_resolution=media_resolution, + model=model, ) _parts.append(_part) elif element["type"] == "input_audio": @@ -271,6 +275,7 @@ def _gemini_convert_messages_with_history( # noqa: PLR0915 _part = _process_gemini_image( image_url=openai_image_str, format=audio_format_modified, + model=model, ) _parts.append(_part) elif element["type"] == "file": @@ -287,6 +292,7 @@ def _gemini_convert_messages_with_history( # noqa: PLR0915 _part = _process_gemini_image( image_url=passed_file, format=format, + model=model, ) _parts.append(_part) except Exception: diff --git a/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py b/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py index 2b305dbade1..6bd0fb52f1d 100644 --- a/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py +++ b/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py @@ -1795,7 +1795,9 @@ def test_media_resolution_from_detail_parameter(): } ] - contents = _gemini_convert_messages_with_history(messages=messages) + contents = _gemini_convert_messages_with_history( + messages=messages, model="gemini-3-pro-preview" + ) # Verify media_resolution is set in the inline_data # Note: Gemini adds a blank text part when there's no text, so we expect 2 parts @@ -1837,7 +1839,9 @@ def test_media_resolution_low_detail(): } ] - contents = _gemini_convert_messages_with_history(messages=messages) + contents = _gemini_convert_messages_with_history( + messages=messages, model="gemini-3-pro-preview" + ) # Find the part with inline_data image_part = None @@ -1951,7 +1955,9 @@ def test_media_resolution_per_part(): } ] - contents = _gemini_convert_messages_with_history(messages=messages) + contents = _gemini_convert_messages_with_history( + messages=messages, model="gemini-3-pro-preview" + ) # Should have one content with multiple parts assert len(contents) == 1 @@ -1968,6 +1974,41 @@ def test_media_resolution_per_part(): assert image2_part["inline_data"]["mediaResolution"] == "high" +def test_media_resolution_only_for_gemini_3_models(): + """Ensure mediaResolution is not added for non-Gemini 3 models.""" + from litellm.llms.vertex_ai.gemini.transformation import ( + _gemini_convert_messages_with_history, + ) + + base64_image = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==" + messages = [ + { + "role": "user", + "content": [ + { + "type": "image_url", + "image_url": { + "url": base64_image, + "detail": "high", + }, + } + ], + } + ] + + contents = _gemini_convert_messages_with_history( + messages=messages, model="gemini-2.5-pro" + ) + image_part = None + for part in contents[0]["parts"]: + if "inline_data" in part: + image_part = part + break + assert image_part is not None + assert "inline_data" in image_part + assert "mediaResolution" not in image_part["inline_data"] + + def test_gemini_3_image_models_no_thinking_config(): """ Test that Gemini 3 image models do NOT receive automatic thinkingConfig. From 9a85ffceffa528b561170f804435359fdb02b4ce Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Wed, 26 Nov 2025 21:45:50 +0530 Subject: [PATCH 008/178] Fix tests related to mediaResolution --- tests/llm_translation/test_prompt_factory.py | 4 ++-- ...test_vertex_and_google_ai_studio_gemini.py | 20 +++++++++---------- .../llms/vertex_ai/test_vertex.py | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/llm_translation/test_prompt_factory.py b/tests/llm_translation/test_prompt_factory.py index 1ed1e327ec2..abd8ae52157 100644 --- a/tests/llm_translation/test_prompt_factory.py +++ b/tests/llm_translation/test_prompt_factory.py @@ -567,7 +567,7 @@ def test_vertex_only_image_user_message(): }, ] - response = _gemini_convert_messages_with_history(messages=messages) + response = _gemini_convert_messages_with_history(messages=messages, model="gemini-1.5-pro") expected_response = [ { @@ -576,7 +576,7 @@ def test_vertex_only_image_user_message(): { "inline_data": { "data": "/9j/2wCEAAgGBgcGBQ", - "mimeType": "image/jpeg", + "mime_type": "image/jpeg", } }, {"text": " "}, diff --git a/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py b/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py index 6bd0fb52f1d..92be385c04f 100644 --- a/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py +++ b/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py @@ -1811,9 +1811,9 @@ def test_media_resolution_from_detail_parameter(): break assert image_part is not None assert "inline_data" in image_part - # The TypedDict uses snake_case internally, but mediaResolution is camelCase in the dict - assert "mediaResolution" in image_part["inline_data"] - assert image_part["inline_data"]["mediaResolution"] == "high" + # The TypedDict uses snake_case internally, and we keep it as snake_case + assert "media_resolution" in image_part["inline_data"] + assert image_part["inline_data"]["media_resolution"] == "high" def test_media_resolution_low_detail(): @@ -1851,7 +1851,7 @@ def test_media_resolution_low_detail(): break assert image_part is not None assert "inline_data" in image_part - assert image_part["inline_data"]["mediaResolution"] == "low" + assert image_part["inline_data"]["media_resolution"] == "low" def test_media_resolution_auto_detail(): @@ -1888,8 +1888,8 @@ def test_media_resolution_auto_detail(): break assert image_part is not None assert "inline_data" in image_part - # mediaResolution should not be set for auto - assert "mediaResolution" not in image_part["inline_data"] or image_part["inline_data"].get("mediaResolution") is None + # media_resolution should not be set for auto + assert "media_resolution" not in image_part["inline_data"] or image_part["inline_data"].get("media_resolution") is None # Test with None messages_none = [ @@ -1915,8 +1915,8 @@ def test_media_resolution_auto_detail(): break assert image_part is not None assert "inline_data" in image_part - # mediaResolution should not be set - assert "mediaResolution" not in image_part["inline_data"] or image_part["inline_data"].get("mediaResolution") is None + # media_resolution should not be set + assert "media_resolution" not in image_part["inline_data"] or image_part["inline_data"].get("media_resolution") is None def test_media_resolution_per_part(): @@ -1966,12 +1966,12 @@ def test_media_resolution_per_part(): # First image should have low resolution (first part is the image) image1_part = contents[0]["parts"][0] assert "inline_data" in image1_part - assert image1_part["inline_data"]["mediaResolution"] == "low" + assert image1_part["inline_data"]["media_resolution"] == "low" # Second image should have high resolution (third part is the second image) image2_part = contents[0]["parts"][2] assert "inline_data" in image2_part - assert image2_part["inline_data"]["mediaResolution"] == "high" + assert image2_part["inline_data"]["media_resolution"] == "high" def test_media_resolution_only_for_gemini_3_models(): diff --git a/tests/test_litellm/llms/vertex_ai/test_vertex.py b/tests/test_litellm/llms/vertex_ai/test_vertex.py index 394cd2978bd..39ed09f81be 100644 --- a/tests/test_litellm/llms/vertex_ai/test_vertex.py +++ b/tests/test_litellm/llms/vertex_ai/test_vertex.py @@ -1241,7 +1241,7 @@ def test_process_gemini_image(): base64_image = "data:image/jpeg;base64,/9j/4AAQSkZJRg..." base64_result = _process_gemini_image(base64_image) print("base64_result", base64_result) - assert base64_result["inline_data"]["mimeType"] == "image/jpeg" + assert base64_result["inline_data"]["mime_type"] == "image/jpeg" assert base64_result["inline_data"]["data"] == "/9j/4AAQSkZJRg..." From 11079c5b97968bb2eb6be061cb226ea01f311156 Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Thu, 27 Nov 2025 23:04:45 +0530 Subject: [PATCH 009/178] Update transformation.py --- litellm/llms/vertex_ai/gemini/transformation.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/litellm/llms/vertex_ai/gemini/transformation.py b/litellm/llms/vertex_ai/gemini/transformation.py index 04fde04f2c1..58f6817cbcc 100644 --- a/litellm/llms/vertex_ai/gemini/transformation.py +++ b/litellm/llms/vertex_ai/gemini/transformation.py @@ -124,14 +124,6 @@ def _process_gemini_image( if VertexGeminiConfig._is_gemini_3_or_newer(model): _blob["media_resolution"] = media_resolution - # Convert snake_case keys to camelCase for JSON serialization - # The TypedDict uses snake_case, but the API expects camelCase - _blob_dict = dict(_blob) - if "media_resolution" in _blob_dict: - _blob_dict["media_resolution"] = _blob_dict.pop("media_resolution") - if "mime_type" in _blob_dict: - _blob_dict["mime_type"] = _blob_dict.pop("mime_type") - return PartType(inline_data=cast(BlobType, _blob_dict)) raise Exception("Invalid image received - {}".format(image_url)) except Exception as e: From bf1308e86bdcb3e86fb5ef2b976418dabe910c72 Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Wed, 29 Oct 2025 06:21:35 +0530 Subject: [PATCH 010/178] Support for Custom Vertex AI Models via PSC Endpoint with api_base (#15953) * Support for Custom Vertex AI Models via PSC Endpoint with api_base * Add docs related psc * remove not needed files * remove print statemnt * fix mypy errors --- docs/my-website/docs/providers/vertex.md | 47 ++++ litellm/llms/vertex_ai/batches/handler.py | 8 + litellm/llms/vertex_ai/common_utils.py | 10 +- .../vertex_ai_context_caching.py | 4 + .../vertex_embeddings/transformation.py | 3 + litellm/llms/vertex_ai/vertex_llm_base.py | 48 +++- .../vertex_ai/vertex_model_garden/main.py | 4 + .../test_vertex_ai_psc_endpoint_support.py | 258 ++++++++++++++++++ 8 files changed, 378 insertions(+), 4 deletions(-) create mode 100644 tests/test_litellm/llms/vertex_ai/test_vertex_ai_psc_endpoint_support.py diff --git a/docs/my-website/docs/providers/vertex.md b/docs/my-website/docs/providers/vertex.md index 70babea3814..8e333b69ef7 100644 --- a/docs/my-website/docs/providers/vertex.md +++ b/docs/my-website/docs/providers/vertex.md @@ -1604,6 +1604,53 @@ litellm.vertex_location = "us-central1 # Your Location | gemini-2.5-flash-preview-09-2025 | `completion('gemini-2.5-flash-preview-09-2025', messages)`, `completion('vertex_ai/gemini-2.5-flash-preview-09-2025', messages)` | | gemini-2.5-flash-lite-preview-09-2025 | `completion('gemini-2.5-flash-lite-preview-09-2025', messages)`, `completion('vertex_ai/gemini-2.5-flash-lite-preview-09-2025', messages)` | +## Private Service Connect (PSC) Endpoints + +LiteLLM supports Vertex AI models deployed to Private Service Connect (PSC) endpoints, allowing you to use custom `api_base` URLs for private deployments. + +### Usage + +```python +from litellm import completion + +# Use PSC endpoint with custom api_base +response = completion( + model="vertex_ai/1234567890", # Numeric endpoint ID + messages=[{"role": "user", "content": "Hello!"}], + api_base="http://10.96.32.8", # Your PSC endpoint + vertex_project="my-project-id", + vertex_location="us-central1" +) +``` + +**Key Features:** +- Supports both numeric endpoint IDs and custom model names +- Works with both completion and embedding endpoints +- Automatically constructs full PSC URL: `{api_base}/v1/projects/{project}/locations/{location}/endpoints/{model}:{endpoint}` +- Compatible with streaming requests + +### Configuration + +Add PSC endpoints to your `config.yaml`: + +```yaml +model_list: + - model_name: psc-gemini + litellm_params: + model: vertex_ai/1234567890 # Numeric endpoint ID + api_base: "http://10.96.32.8" # Your PSC endpoint + vertex_project: "my-project-id" + vertex_location: "us-central1" + vertex_credentials: "/path/to/service_account.json" + - model_name: psc-embedding + litellm_params: + model: vertex_ai/text-embedding-004 + api_base: "http://10.96.32.8" # Your PSC endpoint + vertex_project: "my-project-id" + vertex_location: "us-central1" + vertex_credentials: "/path/to/service_account.json" +``` + ## Fine-tuned Models You can call fine-tuned Vertex AI Gemini models through LiteLLM diff --git a/litellm/llms/vertex_ai/batches/handler.py b/litellm/llms/vertex_ai/batches/handler.py index 864cc190312..edae91ff9a3 100644 --- a/litellm/llms/vertex_ai/batches/handler.py +++ b/litellm/llms/vertex_ai/batches/handler.py @@ -61,6 +61,10 @@ class VertexAIBatchPrediction(VertexLLM): stream=None, auth_header=None, url=default_api_base, + model=None, + vertex_project=vertex_project or project_id, + vertex_location=vertex_location or "us-central1", + vertex_api_version="v1", ) headers = { @@ -166,6 +170,10 @@ class VertexAIBatchPrediction(VertexLLM): stream=None, auth_header=None, url=default_api_base, + model=None, + vertex_project=vertex_project or project_id, + vertex_location=vertex_location or "us-central1", + vertex_api_version="v1", ) headers = { diff --git a/litellm/llms/vertex_ai/common_utils.py b/litellm/llms/vertex_ai/common_utils.py index dc6a3170afe..aaee922a3f0 100644 --- a/litellm/llms/vertex_ai/common_utils.py +++ b/litellm/llms/vertex_ai/common_utils.py @@ -60,6 +60,9 @@ def get_vertex_ai_model_route( >>> get_vertex_ai_model_route("openai/gpt-oss-120b") VertexAIModelRoute.MODEL_GARDEN + + >>> get_vertex_ai_model_route("1234567890", {"api_base": "http://10.96.32.8"}) + VertexAIModelRoute.GEMINI # Numeric endpoints with api_base use HTTP path """ from litellm.llms.vertex_ai.vertex_ai_partner_models.main import ( VertexAIPartnerModels, @@ -69,7 +72,12 @@ def get_vertex_ai_model_route( if litellm_params and litellm_params.get("base_model") is not None: if "gemini" in litellm_params["base_model"]: return VertexAIModelRoute.GEMINI - + + # Check if numeric endpoint ID with custom api_base (PSC endpoint) + # Route to GEMINI (HTTP path) to support PSC endpoints properly + if model.isdigit() and litellm_params and litellm_params.get("api_base"): + return VertexAIModelRoute.GEMINI + # Check for partner models (llama, mistral, claude, etc.) if VertexAIPartnerModels.is_vertex_partner_model(model=model): return VertexAIModelRoute.PARTNER_MODELS diff --git a/litellm/llms/vertex_ai/context_caching/vertex_ai_context_caching.py b/litellm/llms/vertex_ai/context_caching/vertex_ai_context_caching.py index 26be4d3c2b8..cff1bebceb9 100644 --- a/litellm/llms/vertex_ai/context_caching/vertex_ai_context_caching.py +++ b/litellm/llms/vertex_ai/context_caching/vertex_ai_context_caching.py @@ -85,6 +85,10 @@ class ContextCachingEndpoints(VertexBase): stream=None, auth_header=auth_header, url=url, + model=None, + vertex_project=vertex_project, + vertex_location=vertex_location, + vertex_api_version="v1beta1" if custom_llm_provider == "vertex_ai_beta" else "v1", ) def check_cache( diff --git a/litellm/llms/vertex_ai/vertex_embeddings/transformation.py b/litellm/llms/vertex_ai/vertex_embeddings/transformation.py index 97af558041d..caaf00e199e 100644 --- a/litellm/llms/vertex_ai/vertex_embeddings/transformation.py +++ b/litellm/llms/vertex_ai/vertex_embeddings/transformation.py @@ -167,6 +167,9 @@ class VertexAITextEmbeddingConfig(BaseModel): vertex_request["parameters"] = TextEmbeddingFineTunedParameters( **optional_params ) + # Remove 'shared_session' from parameters if present + if vertex_request["parameters"] is not None and "shared_session" in vertex_request["parameters"]: + del vertex_request["parameters"]["shared_session"] # type: ignore[typeddict-item] return vertex_request diff --git a/litellm/llms/vertex_ai/vertex_llm_base.py b/litellm/llms/vertex_ai/vertex_llm_base.py index 9ddbc461a70..a5c44617fab 100644 --- a/litellm/llms/vertex_ai/vertex_llm_base.py +++ b/litellm/llms/vertex_ai/vertex_llm_base.py @@ -241,6 +241,9 @@ class VertexBase: auth_header=None, url=default_api_base, model=model, + vertex_project=vertex_project or project_id, + vertex_location=vertex_location or "us-central1", + vertex_api_version="v1", # Partner models typically use v1 ) return api_base @@ -289,9 +292,18 @@ class VertexBase: auth_header: Optional[str], url: str, model: Optional[str] = None, + vertex_project: Optional[str] = None, + vertex_location: Optional[str] = None, + vertex_api_version: Optional[Literal["v1", "v1beta1"]] = None, ) -> Tuple[Optional[str], str]: """ for cloudflare ai gateway - https://github.com/BerriAI/litellm/issues/4317 + + Handles custom api_base for: + 1. Gemini (Google AI Studio) - constructs /models/{model}:{endpoint} + 2. Vertex AI with standard proxies - constructs {api_base}:{endpoint} + 3. Vertex AI with PSC endpoints - constructs full path structure + {api_base}/v1/projects/{project}/locations/{location}/endpoints/{model}:{endpoint} ## Returns - (auth_header, url) - Tuple[Optional[str], str] @@ -311,8 +323,34 @@ class VertexBase: if gemini_api_key is not None: auth_header = {"x-goog-api-key": gemini_api_key} # type: ignore[assignment] else: - url = "{}:{}".format(api_base, endpoint) - + # For Vertex AI + # Check if this is a PSC endpoint or custom deployment + # PSC/custom endpoints need the full path structure + if vertex_project and vertex_location and model: + # Check if model is numeric (endpoint ID) or if api_base doesn't contain googleapis.com + # These are indicators of PSC/custom endpoints + is_psc_or_custom = ( + "googleapis.com" not in api_base.lower() or model.isdigit() + ) + + if is_psc_or_custom: + # Construct full PSC/custom endpoint URL + # Format: {api_base}/v1/projects/{project}/locations/{location}/endpoints/{model}:{endpoint} + version = vertex_api_version or "v1" + url = "{}/{}/projects/{}/locations/{}/endpoints/{}:{}".format( + api_base.rstrip("/"), + version, + vertex_project, + vertex_location, + model, + endpoint, + ) + else: + # Standard proxy - just append endpoint + url = "{}:{}".format(api_base, endpoint) + else: + # Fallback to simple format if we don't have all parameters + url = "{}:{}".format(api_base, endpoint) if stream is True: url = url + "?alt=sse" return auth_header, url @@ -339,6 +377,7 @@ class VertexBase: Returns token, url """ + version: Optional[Literal["v1beta1", "v1"]] = None if custom_llm_provider == "gemini": url, endpoint = _get_gemini_url( mode=mode, @@ -354,7 +393,7 @@ class VertexBase: ) ### SET RUNTIME ENDPOINT ### - version: Literal["v1beta1", "v1"] = ( + version = ( "v1beta1" if should_use_v1beta1_features is True else "v1" ) url, endpoint = _get_vertex_url( @@ -375,6 +414,9 @@ class VertexBase: stream=stream, url=url, model=model, + vertex_project=vertex_project, + vertex_location=vertex_location, + vertex_api_version=version, ) def _handle_reauthentication( diff --git a/litellm/llms/vertex_ai/vertex_model_garden/main.py b/litellm/llms/vertex_ai/vertex_model_garden/main.py index 1c57096734b..225e75a5add 100644 --- a/litellm/llms/vertex_ai/vertex_model_garden/main.py +++ b/litellm/llms/vertex_ai/vertex_model_garden/main.py @@ -123,6 +123,10 @@ class VertexAIModelGardenModels(VertexBase): stream=stream, auth_header=None, url=default_api_base, + model=model, + vertex_project=vertex_project or project_id, + vertex_location=vertex_location or "us-central1", + vertex_api_version="v1beta1", ) model = "" return openai_like_chat_completions.completion( diff --git a/tests/test_litellm/llms/vertex_ai/test_vertex_ai_psc_endpoint_support.py b/tests/test_litellm/llms/vertex_ai/test_vertex_ai_psc_endpoint_support.py new file mode 100644 index 00000000000..46f365094c0 --- /dev/null +++ b/tests/test_litellm/llms/vertex_ai/test_vertex_ai_psc_endpoint_support.py @@ -0,0 +1,258 @@ +""" +Unit tests for Vertex AI Private Service Connect (PSC) endpoint support + +Tests that LiteLLM properly constructs URLs when using custom api_base +for PSC endpoints. +""" + +import pytest +import sys +import os + +# Add the litellm package to the path +sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../../../..")) + +from litellm.llms.vertex_ai.vertex_llm_base import VertexBase + + +class TestVertexAIPSCEndpointSupport: + """Test cases for PSC endpoint URL construction""" + + def test_psc_endpoint_url_construction_basic(self): + """Test basic PSC endpoint URL construction for predict endpoint""" + vertex_base = VertexBase() + psc_api_base = "http://10.96.32.8" + endpoint_id = "1234567890" + project_id = "test-project" + location = "us-central1" + + auth_header, url = vertex_base._check_custom_proxy( + api_base=psc_api_base, + custom_llm_provider="vertex_ai", + gemini_api_key=None, + endpoint="predict", + stream=False, + auth_header="test-token", + url="", # This will be replaced + model=endpoint_id, + vertex_project=project_id, + vertex_location=location, + vertex_api_version="v1", + ) + + expected_url = f"{psc_api_base}/v1/projects/{project_id}/locations/{location}/endpoints/{endpoint_id}:predict" + assert ( + url == expected_url + ), f"Expected {expected_url}, but got {url}" + + def test_psc_endpoint_url_construction_with_streaming(self): + """Test PSC endpoint URL construction with streaming enabled""" + vertex_base = VertexBase() + psc_api_base = "http://10.96.32.8" + endpoint_id = "1234567890" + project_id = "test-project" + location = "us-central1" + + auth_header, url = vertex_base._check_custom_proxy( + api_base=psc_api_base, + custom_llm_provider="vertex_ai", + gemini_api_key=None, + endpoint="streamGenerateContent", + stream=True, + auth_header="test-token", + url="", + model=endpoint_id, + vertex_project=project_id, + vertex_location=location, + vertex_api_version="v1", + ) + + expected_url = f"{psc_api_base}/v1/projects/{project_id}/locations/{location}/endpoints/{endpoint_id}:streamGenerateContent?alt=sse" + assert ( + url == expected_url + ), f"Expected {expected_url}, but got {url}" + + def test_psc_endpoint_url_construction_v1beta1(self): + """Test PSC endpoint URL construction with v1beta1 API version""" + vertex_base = VertexBase() + psc_api_base = "http://10.96.32.8" + endpoint_id = "1234567890" + project_id = "test-project" + location = "us-central1" + + auth_header, url = vertex_base._check_custom_proxy( + api_base=psc_api_base, + custom_llm_provider="vertex_ai", + gemini_api_key=None, + endpoint="predict", + stream=False, + auth_header="test-token", + url="", + model=endpoint_id, + vertex_project=project_id, + vertex_location=location, + vertex_api_version="v1beta1", + ) + + expected_url = f"{psc_api_base}/v1beta1/projects/{project_id}/locations/{location}/endpoints/{endpoint_id}:predict" + assert ( + url == expected_url + ), f"Expected {expected_url}, but got {url}" + + def test_psc_endpoint_url_with_https(self): + """Test PSC endpoint URL construction with HTTPS""" + vertex_base = VertexBase() + psc_api_base = "https://10.96.32.8" + endpoint_id = "1234567890" + project_id = "test-project" + location = "us-central1" + + auth_header, url = vertex_base._check_custom_proxy( + api_base=psc_api_base, + custom_llm_provider="vertex_ai", + gemini_api_key=None, + endpoint="predict", + stream=False, + auth_header="test-token", + url="", + model=endpoint_id, + vertex_project=project_id, + vertex_location=location, + vertex_api_version="v1", + ) + + expected_url = f"{psc_api_base}/v1/projects/{project_id}/locations/{location}/endpoints/{endpoint_id}:predict" + assert ( + url == expected_url + ), f"Expected {expected_url}, but got {url}" + + def test_psc_endpoint_with_trailing_slash(self): + """Test that trailing slashes in api_base are handled correctly""" + vertex_base = VertexBase() + psc_api_base = "http://10.96.32.8/" + endpoint_id = "1234567890" + project_id = "test-project" + location = "us-central1" + + auth_header, url = vertex_base._check_custom_proxy( + api_base=psc_api_base, + custom_llm_provider="vertex_ai", + gemini_api_key=None, + endpoint="predict", + stream=False, + auth_header="test-token", + url="", + model=endpoint_id, + vertex_project=project_id, + vertex_location=location, + vertex_api_version="v1", + ) + + # rstrip('/') should remove the trailing slash + expected_url = f"{psc_api_base.rstrip('/')}/v1/projects/{project_id}/locations/{location}/endpoints/{endpoint_id}:predict" + assert ( + url == expected_url + ), f"Expected {expected_url}, but got {url}" + + def test_standard_proxy_with_googleapis(self): + """Test that standard proxies with googleapis.com in URL use simple format""" + vertex_base = VertexBase() + proxy_api_base = "https://my-proxy.googleapis.com" + endpoint_id = "gemini-pro" # Not numeric + project_id = "test-project" + location = "us-central1" + + auth_header, url = vertex_base._check_custom_proxy( + api_base=proxy_api_base, + custom_llm_provider="vertex_ai", + gemini_api_key=None, + endpoint="generateContent", + stream=False, + auth_header="test-token", + url="", + model=endpoint_id, + vertex_project=project_id, + vertex_location=location, + vertex_api_version="v1", + ) + + # Should use simple format: api_base:endpoint + expected_url = f"{proxy_api_base}:generateContent" + assert ( + url == expected_url + ), f"Expected {expected_url}, but got {url}" + + def test_custom_proxy_with_numeric_model(self): + """Test that numeric model IDs trigger PSC-style URL construction""" + vertex_base = VertexBase() + proxy_api_base = "https://my-custom-proxy.example.com" + endpoint_id = "9876543210" # Numeric endpoint ID + project_id = "test-project" + location = "us-central1" + + auth_header, url = vertex_base._check_custom_proxy( + api_base=proxy_api_base, + custom_llm_provider="vertex_ai", + gemini_api_key=None, + endpoint="predict", + stream=False, + auth_header="test-token", + url="", + model=endpoint_id, + vertex_project=project_id, + vertex_location=location, + vertex_api_version="v1", + ) + + # Numeric model should trigger full path construction + expected_url = f"{proxy_api_base}/v1/projects/{project_id}/locations/{location}/endpoints/{endpoint_id}:predict" + assert ( + url == expected_url + ), f"Expected {expected_url}, but got {url}" + + def test_no_api_base_returns_original_url(self): + """Test that when api_base is None, the original URL is returned""" + vertex_base = VertexBase() + original_url = "https://us-central1-aiplatform.googleapis.com/v1/projects/test/locations/us-central1/publishers/google/models/gemini-pro:generateContent" + + auth_header, url = vertex_base._check_custom_proxy( + api_base=None, + custom_llm_provider="vertex_ai", + gemini_api_key=None, + endpoint="generateContent", + stream=False, + auth_header="test-token", + url=original_url, + model="gemini-pro", + vertex_project="test-project", + vertex_location="us-central1", + vertex_api_version="v1", + ) + + # When api_base is None, original URL should be returned unchanged + assert url == original_url, f"Expected {original_url}, but got {url}" + + def test_auth_header_preserved(self): + """Test that auth_header is properly preserved""" + vertex_base = VertexBase() + psc_api_base = "http://10.96.32.8" + test_auth_header = "Bearer test-token-12345" + + auth_header, url = vertex_base._check_custom_proxy( + api_base=psc_api_base, + custom_llm_provider="vertex_ai", + gemini_api_key=None, + endpoint="predict", + stream=False, + auth_header=test_auth_header, + url="", + model="1234567890", + vertex_project="test-project", + vertex_location="us-central1", + vertex_api_version="v1", + ) + + assert ( + auth_header == test_auth_header + ), f"Auth header should be preserved, got {auth_header}" + From 62f2bb0ed0e8e4cd8f4633e2e6ea742d03a2d15a Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Tue, 28 Oct 2025 18:10:35 -0700 Subject: [PATCH 011/178] add TextEmbeddingBGEInput --- litellm/llms/vertex_ai/vertex_embeddings/types.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/litellm/llms/vertex_ai/vertex_embeddings/types.py b/litellm/llms/vertex_ai/vertex_embeddings/types.py index 7f85ea46f31..fa9794d79a5 100644 --- a/litellm/llms/vertex_ai/vertex_embeddings/types.py +++ b/litellm/llms/vertex_ai/vertex_embeddings/types.py @@ -25,6 +25,12 @@ class TextEmbeddingInput(TypedDict, total=False): title: Optional[str] +class TextEmbeddingBGEInput(TypedDict, total=False): + prompt: str + task_type: Optional[TaskType] + title: Optional[str] + + # Fine-tuned models require a different input format # Ref: https://console.cloud.google.com/vertex-ai/model-garden?hl=en&project=adroit-crow-413218&pageState=(%22galleryStateKey%22:(%22f%22:(%22g%22:%5B%5D,%22o%22:%5B%5D),%22s%22:%22%22)) class TextEmbeddingFineTunedInput(TypedDict, total=False): @@ -44,7 +50,7 @@ class EmbeddingParameters(TypedDict, total=False): class VertexEmbeddingRequest(TypedDict, total=False): - instances: Union[List[TextEmbeddingInput], List[TextEmbeddingFineTunedInput]] + instances: Union[List[TextEmbeddingInput], List[TextEmbeddingBGEInput], List[TextEmbeddingFineTunedInput]] parameters: Optional[Union[EmbeddingParameters, TextEmbeddingFineTunedParameters]] From 39e750d3b2c3d68a88ee8de3abbde0aef5ad653f Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Tue, 28 Oct 2025 18:10:45 -0700 Subject: [PATCH 012/178] add VertexBGEConfig --- .../llms/vertex_ai/vertex_embeddings/bge.py | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 litellm/llms/vertex_ai/vertex_embeddings/bge.py diff --git a/litellm/llms/vertex_ai/vertex_embeddings/bge.py b/litellm/llms/vertex_ai/vertex_embeddings/bge.py new file mode 100644 index 00000000000..401f7ebd907 --- /dev/null +++ b/litellm/llms/vertex_ai/vertex_embeddings/bge.py @@ -0,0 +1,100 @@ +""" +Vertex AI BGE (BAAI General Embedding) Configuration + +BGE models deployed on Vertex AI require different input format: +- Use "prompt" instead of "content" as the input field +""" + +from typing import List, Optional, Union + +from .types import ( + EmbeddingParameters, + TaskType, + TextEmbeddingBGEInput, + VertexEmbeddingRequest, +) + + +class VertexBGEConfig: + """ + Configuration and transformation logic for BGE models on Vertex AI. + + BGE (BAAI General Embedding) models use a different request format + where the input field is named "prompt" instead of "content". + """ + + @staticmethod + def is_bge_model(model: str) -> bool: + """ + Check if the model is a BGE (BAAI General Embedding) model. + + Args: + model: The model name + + Returns: + bool: True if the model is a BGE model + """ + return "bge" in model.lower() + + @staticmethod + def transform_request( + input: Union[list, str], optional_params: dict, model: str + ) -> VertexEmbeddingRequest: + """ + Transforms an OpenAI request to a Vertex BGE embedding request. + + BGE models use "prompt" instead of "content" as the input field. + + Args: + input: The input text(s) to embed + optional_params: Optional parameters for the request + model: The model name + + Returns: + VertexEmbeddingRequest: The transformed request + """ + vertex_request: VertexEmbeddingRequest = VertexEmbeddingRequest() + vertex_text_embedding_input_list: List[TextEmbeddingBGEInput] = [] + task_type: Optional[TaskType] = optional_params.get("task_type") + title = optional_params.get("title") + + if isinstance(input, str): + input = [input] + + for text in input: + embedding_input = VertexBGEConfig._create_embedding_input( + prompt=text, task_type=task_type, title=title + ) + vertex_text_embedding_input_list.append(embedding_input) + + vertex_request["instances"] = vertex_text_embedding_input_list + vertex_request["parameters"] = EmbeddingParameters(**optional_params) + + return vertex_request + + @staticmethod + def _create_embedding_input( + prompt: str, + task_type: Optional[TaskType] = None, + title: Optional[str] = None, + ) -> TextEmbeddingBGEInput: + """ + Creates a TextEmbeddingBGEInput object for BGE models. + + BGE models use "prompt" instead of "content" as the input field. + + Args: + prompt: The prompt to be embedded + task_type: The type of task to be performed + title: The title of the document to be embedded + + Returns: + TextEmbeddingBGEInput: A TextEmbeddingBGEInput object + """ + text_embedding_input = TextEmbeddingBGEInput(prompt=prompt) + if task_type is not None: + text_embedding_input["task_type"] = task_type + if title is not None: + text_embedding_input["title"] = title + return text_embedding_input + From 3293ac8a3d282717b32e1b4aa562caede70151eb Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Tue, 28 Oct 2025 18:11:01 -0700 Subject: [PATCH 013/178] add BGE handling --- .../llms/vertex_ai/vertex_embeddings/transformation.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/litellm/llms/vertex_ai/vertex_embeddings/transformation.py b/litellm/llms/vertex_ai/vertex_embeddings/transformation.py index caaf00e199e..7bbe13e3597 100644 --- a/litellm/llms/vertex_ai/vertex_embeddings/transformation.py +++ b/litellm/llms/vertex_ai/vertex_embeddings/transformation.py @@ -5,6 +5,7 @@ from pydantic import BaseModel from litellm.types.utils import EmbeddingResponse, Usage +from .bge import VertexBGEConfig from .types import * @@ -109,6 +110,11 @@ class VertexAITextEmbeddingConfig(BaseModel): return self._transform_openai_request_to_fine_tuned_embedding_request( input, optional_params, model ) + + if VertexBGEConfig.is_bge_model(model): + return VertexBGEConfig.transform_request( + input=input, optional_params=optional_params, model=model + ) vertex_request: VertexEmbeddingRequest = VertexEmbeddingRequest() vertex_text_embedding_input_list: List[TextEmbeddingInput] = [] @@ -186,8 +192,8 @@ class VertexAITextEmbeddingConfig(BaseModel): Args: content (str): The content to be embedded. - task_type (Optional[TaskType]): The type of task to be performed". - title (Optional[str]): The title of the document to be embedded + task_type (Optional[TaskType]): The type of task to be performed. + title (Optional[str]): The title of the document to be embedded. Returns: TextEmbeddingInput: A TextEmbeddingInput object. From f2befcf6572c58d97ef977d496afadc9d3766deb Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Tue, 28 Oct 2025 18:12:29 -0700 Subject: [PATCH 014/178] test_vertex_ai_bge_embedding_with_custom_api_base --- .../llms/vertex_ai/test_bge_embedding.py | 106 ++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 tests/test_litellm/llms/vertex_ai/test_bge_embedding.py diff --git a/tests/test_litellm/llms/vertex_ai/test_bge_embedding.py b/tests/test_litellm/llms/vertex_ai/test_bge_embedding.py new file mode 100644 index 00000000000..d7bd07f53ef --- /dev/null +++ b/tests/test_litellm/llms/vertex_ai/test_bge_embedding.py @@ -0,0 +1,106 @@ +""" +Test BGE embeddings with Vertex AI using custom api_base. + +This test ensures that BGE embeddings work correctly with Vertex AI +and that the request body is properly formatted. +""" + +import json +import os +import sys +from unittest.mock import MagicMock, patch + +sys.path.insert( + 0, os.path.abspath("../../../..") +) + +import pytest + +import litellm +from litellm.llms.custom_httpx.http_handler import HTTPHandler + + +def test_vertex_ai_bge_embedding_with_custom_api_base(): + """ + Test Vertex AI BGE embeddings with custom api_base. + + This test verifies that when using a BGE model with Vertex AI and + a custom api_base, the request is properly formatted and sent to + the correct endpoint. + """ + client = HTTPHandler() + + def mock_auth_token(*args, **kwargs): + return "fake-token", "fake-project" + + with patch.object(client, "post") as mock_post, patch( + "litellm.llms.vertex_ai.vertex_embeddings.embedding_handler.VertexEmbedding._ensure_access_token", + side_effect=mock_auth_token + ): + mock_response = MagicMock() + mock_response.status_code = 200 + mock_response.json.return_value = { + "predictions": [ + { + "embeddings": { + "values": [0.1, 0.2, 0.3, 0.4, 0.5], + "statistics": {"token_count": 2} + } + }, + { + "embeddings": { + "values": [0.6, 0.7, 0.8, 0.9, 1.0], + "statistics": {"token_count": 2} + } + } + ] + } + mock_post.return_value = mock_response + + response = litellm.embedding( + model="vertex_ai/bge-small-en-v1.5", + input=["Hello", "World"], + api_base="http://10.96.32.8", + client=client + ) + + mock_post.assert_called_once() + + call_args = mock_post.call_args + kwargs = call_args.kwargs if hasattr(call_args, 'kwargs') else call_args[1] + + if "url" in kwargs: + api_url_called = kwargs["url"] + elif len(call_args[0]) > 0: + api_url_called = call_args[0][0] + else: + api_url_called = "Unknown" + + # Vertex AI may use 'json' or 'data' parameter + if "json" in kwargs: + request_data = kwargs["json"] + elif "data" in kwargs: + request_data = json.loads(kwargs["data"]) + else: + request_data = {} + + print("\n" + "="*50) + print("Mock Request Body Received:") + print("="*50) + print(json.dumps(request_data, indent=2)) + print("="*50) + print(f"API Base: {api_url_called}") + print("="*50 + "\n") + + assert "instances" in request_data + assert len(request_data["instances"]) == 2 + # BGE models should use "prompt" instead of "content" + assert "prompt" in request_data["instances"][0] + assert request_data["instances"][0]["prompt"] == "Hello" + assert "prompt" in request_data["instances"][1] + assert request_data["instances"][1]["prompt"] == "World" + + assert isinstance(response.data, list) + assert len(response.data) == 2 + assert "embedding" in response.data[0] + From c821acd61a1eef41589df3410b8d2d23d9395ab0 Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Tue, 28 Oct 2025 18:14:25 -0700 Subject: [PATCH 015/178] fix request transform vertex BGE --- .../llms/vertex_ai/vertex_embeddings/bge.py | 54 ++++++++++++++++++- .../vertex_embeddings/transformation.py | 5 ++ 2 files changed, 57 insertions(+), 2 deletions(-) diff --git a/litellm/llms/vertex_ai/vertex_embeddings/bge.py b/litellm/llms/vertex_ai/vertex_embeddings/bge.py index 401f7ebd907..1bfa362ee98 100644 --- a/litellm/llms/vertex_ai/vertex_embeddings/bge.py +++ b/litellm/llms/vertex_ai/vertex_embeddings/bge.py @@ -1,12 +1,15 @@ """ Vertex AI BGE (BAAI General Embedding) Configuration -BGE models deployed on Vertex AI require different input format: -- Use "prompt" instead of "content" as the input field +BGE models deployed on Vertex AI require different input/output format: +- Request: Use "prompt" instead of "content" as the input field +- Response: Embeddings are returned directly as arrays, not wrapped in objects """ from typing import List, Optional, Union +from litellm.types.utils import EmbeddingResponse, Usage + from .types import ( EmbeddingParameters, TaskType, @@ -98,3 +101,50 @@ class VertexBGEConfig: text_embedding_input["title"] = title return text_embedding_input + @staticmethod + def transform_response( + response: dict, model: str, model_response: EmbeddingResponse + ) -> EmbeddingResponse: + """ + Transforms a Vertex BGE embedding response to OpenAI format. + + BGE models return embeddings directly as arrays in predictions: + { + "predictions": [ + [0.002, 0.021, ...], + [0.003, 0.022, ...] + ] + } + + Args: + response: The raw response from Vertex AI + model: The model name + model_response: The EmbeddingResponse object to populate + + Returns: + EmbeddingResponse: The transformed response in OpenAI format + """ + _predictions = response["predictions"] + + embedding_response = [] + # BGE models don't return token counts, so we estimate or set to 0 + input_tokens = 0 + + for idx, embedding_values in enumerate(_predictions): + embedding_response.append( + { + "object": "embedding", + "index": idx, + "embedding": embedding_values, + } + ) + + model_response.object = "list" + model_response.data = embedding_response + model_response.model = model + usage = Usage( + prompt_tokens=input_tokens, completion_tokens=0, total_tokens=input_tokens + ) + setattr(model_response, "usage", usage) + return model_response + diff --git a/litellm/llms/vertex_ai/vertex_embeddings/transformation.py b/litellm/llms/vertex_ai/vertex_embeddings/transformation.py index 7bbe13e3597..77da3ce7c01 100644 --- a/litellm/llms/vertex_ai/vertex_embeddings/transformation.py +++ b/litellm/llms/vertex_ai/vertex_embeddings/transformation.py @@ -215,6 +215,11 @@ class VertexAITextEmbeddingConfig(BaseModel): return self._transform_vertex_response_to_openai_for_fine_tuned_models( response, model, model_response ) + + if VertexBGEConfig.is_bge_model(model): + return VertexBGEConfig.transform_response( + response=response, model=model, model_response=model_response + ) _predictions = response["predictions"] From 8957770e68489ea0e36fda49cf0f4114753433f4 Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Tue, 28 Oct 2025 18:14:34 -0700 Subject: [PATCH 016/178] test_vertex_ai_bge_embedding_with_custom_api_base --- .../llms/vertex_ai/test_bge_embedding.py | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/tests/test_litellm/llms/vertex_ai/test_bge_embedding.py b/tests/test_litellm/llms/vertex_ai/test_bge_embedding.py index d7bd07f53ef..636df93b026 100644 --- a/tests/test_litellm/llms/vertex_ai/test_bge_embedding.py +++ b/tests/test_litellm/llms/vertex_ai/test_bge_embedding.py @@ -39,21 +39,16 @@ def test_vertex_ai_bge_embedding_with_custom_api_base(): ): mock_response = MagicMock() mock_response.status_code = 200 + # BGE models return embeddings directly as arrays, not wrapped in objects mock_response.json.return_value = { "predictions": [ - { - "embeddings": { - "values": [0.1, 0.2, 0.3, 0.4, 0.5], - "statistics": {"token_count": 2} - } - }, - { - "embeddings": { - "values": [0.6, 0.7, 0.8, 0.9, 1.0], - "statistics": {"token_count": 2} - } - } - ] + [0.1, 0.2, 0.3, 0.4, 0.5], + [0.6, 0.7, 0.8, 0.9, 1.0] + ], + "deployedModelId": "849506872875548672", + "model": "projects/1060139831167/locations/us-central1/models/baai_bge-small-en-v1.5", + "modelDisplayName": "baai_bge-small-en-v1.5", + "modelVersionId": "1" } mock_post.return_value = mock_response From 0abf450b7e0f768b3295a815fbac25c42b8cca64 Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Tue, 28 Oct 2025 18:15:58 -0700 Subject: [PATCH 017/178] tes BGE --- .../llms/vertex_ai/vertex_embeddings/bge.py | 15 +++ .../test_bge_response_transformation.py | 93 +++++++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 tests/test_litellm/llms/vertex_ai/test_bge_response_transformation.py diff --git a/litellm/llms/vertex_ai/vertex_embeddings/bge.py b/litellm/llms/vertex_ai/vertex_embeddings/bge.py index 1bfa362ee98..b8979f55880 100644 --- a/litellm/llms/vertex_ai/vertex_embeddings/bge.py +++ b/litellm/llms/vertex_ai/vertex_embeddings/bge.py @@ -123,14 +123,29 @@ class VertexBGEConfig: Returns: EmbeddingResponse: The transformed response in OpenAI format + + Raises: + KeyError: If response doesn't contain 'predictions' + ValueError: If predictions is not a list or contains invalid data """ + if "predictions" not in response: + raise KeyError("Response missing 'predictions' field") + _predictions = response["predictions"] + + if not isinstance(_predictions, list): + raise ValueError(f"Expected 'predictions' to be a list, got {type(_predictions)}") embedding_response = [] # BGE models don't return token counts, so we estimate or set to 0 input_tokens = 0 for idx, embedding_values in enumerate(_predictions): + if not isinstance(embedding_values, list): + raise ValueError( + f"Expected embedding at index {idx} to be a list, got {type(embedding_values)}" + ) + embedding_response.append( { "object": "embedding", diff --git a/tests/test_litellm/llms/vertex_ai/test_bge_response_transformation.py b/tests/test_litellm/llms/vertex_ai/test_bge_response_transformation.py new file mode 100644 index 00000000000..a3f28678229 --- /dev/null +++ b/tests/test_litellm/llms/vertex_ai/test_bge_response_transformation.py @@ -0,0 +1,93 @@ +""" +Test BGE response transformation validation. + +This test verifies that the BGE response transformer properly validates +and handles different response formats. +""" + +import os +import sys + +sys.path.insert( + 0, os.path.abspath("../../../..") +) + +import pytest + +from litellm.llms.vertex_ai.vertex_embeddings.bge import VertexBGEConfig +from litellm.types.utils import EmbeddingResponse + + +def test_bge_response_transformation_success(): + """ + Test successful BGE response transformation. + + Verifies that a valid BGE response is properly transformed + to OpenAI format. + """ + response = { + "predictions": [ + [0.1, 0.2, 0.3], + [0.4, 0.5, 0.6] + ], + "deployedModelId": "123456", + "model": "projects/test/models/bge-base" + } + + model_response = EmbeddingResponse() + result = VertexBGEConfig.transform_response( + response=response, + model="bge-small-en-v1.5", + model_response=model_response + ) + + assert result.object == "list" + assert len(result.data) == 2 + assert result.data[0]["embedding"] == [0.1, 0.2, 0.3] + assert result.data[1]["embedding"] == [0.4, 0.5, 0.6] + assert result.data[0]["index"] == 0 + assert result.data[1]["index"] == 1 + assert result.model == "bge-small-en-v1.5" + + +def test_bge_response_missing_predictions(): + """ + Test BGE response transformation with missing predictions field. + + Verifies that a KeyError is raised when the response doesn't + contain the required 'predictions' field. + """ + response = { + "deployedModelId": "123456", + "model": "projects/test/models/bge-base" + } + + model_response = EmbeddingResponse() + + with pytest.raises(KeyError, match="Response missing 'predictions' field"): + VertexBGEConfig.transform_response( + response=response, + model="bge-small-en-v1.5", + model_response=model_response + ) + + +def test_bge_response_invalid_predictions_type(): + """ + Test BGE response transformation with invalid predictions type. + + Verifies that a ValueError is raised when predictions is not a list. + """ + response = { + "predictions": "not-a-list" + } + + model_response = EmbeddingResponse() + + with pytest.raises(ValueError, match="Expected 'predictions' to be a list"): + VertexBGEConfig.transform_response( + response=response, + model="bge-small-en-v1.5", + model_response=model_response + ) + From 58d9531869f9588ca7f473f2edca60b170a65f4a Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Tue, 28 Oct 2025 18:38:48 -0700 Subject: [PATCH 018/178] test_is_bge_model_detection --- .../test_bge_response_transformation.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/test_litellm/llms/vertex_ai/test_bge_response_transformation.py b/tests/test_litellm/llms/vertex_ai/test_bge_response_transformation.py index a3f28678229..20150501adf 100644 --- a/tests/test_litellm/llms/vertex_ai/test_bge_response_transformation.py +++ b/tests/test_litellm/llms/vertex_ai/test_bge_response_transformation.py @@ -18,6 +18,24 @@ from litellm.llms.vertex_ai.vertex_embeddings.bge import VertexBGEConfig from litellm.types.utils import EmbeddingResponse +def test_is_bge_model_detection(): + """ + Test BGE model detection for post-provider-split patterns. + + After main.py splits the provider, model strings are passed without the provider prefix. + Model name transformation (bge/ -> numeric ID) is handled in common_utils._get_vertex_url(). + """ + # Should detect BGE models (after provider split) + assert VertexBGEConfig.is_bge_model("bge-small-en-v1.5") is True + assert VertexBGEConfig.is_bge_model("bge/204379420394258432") is True + assert VertexBGEConfig.is_bge_model("BGE-large-en-v1.5") is True # case insensitive + + # Should not detect non-BGE models + assert VertexBGEConfig.is_bge_model("textembedding-gecko") is False + assert VertexBGEConfig.is_bge_model("gemma") is False + assert VertexBGEConfig.is_bge_model("123456789") is False + + def test_bge_response_transformation_success(): """ Test successful BGE response transformation. From 88b2cfc789665a0ea174a383ae10576fe7225725 Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Tue, 28 Oct 2025 18:41:33 -0700 Subject: [PATCH 019/178] docs cleanup --- docs/my-website/docs/providers/vertex.md | 509 ----------------- .../docs/providers/vertex_embedding.md | 511 ++++++++++++++++++ docs/my-website/sidebars.js | 1 + 3 files changed, 512 insertions(+), 509 deletions(-) create mode 100644 docs/my-website/docs/providers/vertex_embedding.md diff --git a/docs/my-website/docs/providers/vertex.md b/docs/my-website/docs/providers/vertex.md index 8e333b69ef7..5df63582446 100644 --- a/docs/my-website/docs/providers/vertex.md +++ b/docs/my-website/docs/providers/vertex.md @@ -2089,515 +2089,6 @@ curl http://0.0.0.0:4000/v1/chat/completions \ | code-gecko@latest| `completion('code-gecko@latest', messages)` | -## **Embedding Models** - -#### Usage - Embedding - - - - -```python -import litellm -from litellm import embedding -litellm.vertex_project = "hardy-device-38811" # Your Project ID -litellm.vertex_location = "us-central1" # proj location - -response = embedding( - model="vertex_ai/textembedding-gecko", - input=["good morning from litellm"], -) -print(response) -``` - - - - - -1. Add model to config.yaml -```yaml -model_list: - - model_name: snowflake-arctic-embed-m-long-1731622468876 - litellm_params: - model: vertex_ai/ - vertex_project: "adroit-crow-413218" - vertex_location: "us-central1" - vertex_credentials: adroit-crow-413218-a956eef1a2a8.json - -litellm_settings: - drop_params: True -``` - -2. Start Proxy - -``` -$ litellm --config /path/to/config.yaml -``` - -3. Make Request using OpenAI Python SDK, Langchain Python SDK - -```python -import openai - -client = openai.OpenAI(api_key="sk-1234", base_url="http://0.0.0.0:4000") - -response = client.embeddings.create( - model="snowflake-arctic-embed-m-long-1731622468876", - input = ["good morning from litellm", "this is another item"], -) - -print(response) -``` - - - - - -#### Supported Embedding Models -All models listed [here](https://github.com/BerriAI/litellm/blob/57f37f743886a0249f630a6792d49dffc2c5d9b7/model_prices_and_context_window.json#L835) are supported - -| Model Name | Function Call | -|--------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| text-embedding-004 | `embedding(model="vertex_ai/text-embedding-004", input)` | -| text-multilingual-embedding-002 | `embedding(model="vertex_ai/text-multilingual-embedding-002", input)` | -| textembedding-gecko | `embedding(model="vertex_ai/textembedding-gecko", input)` | -| textembedding-gecko-multilingual | `embedding(model="vertex_ai/textembedding-gecko-multilingual", input)` | -| textembedding-gecko-multilingual@001 | `embedding(model="vertex_ai/textembedding-gecko-multilingual@001", input)` | -| textembedding-gecko@001 | `embedding(model="vertex_ai/textembedding-gecko@001", input)` | -| textembedding-gecko@003 | `embedding(model="vertex_ai/textembedding-gecko@003", input)` | -| text-embedding-preview-0409 | `embedding(model="vertex_ai/text-embedding-preview-0409", input)` | -| text-multilingual-embedding-preview-0409 | `embedding(model="vertex_ai/text-multilingual-embedding-preview-0409", input)` | -| Fine-tuned OR Custom Embedding models | `embedding(model="vertex_ai/", input)` | - -### Supported OpenAI (Unified) Params - -| [param](../embedding/supported_embedding.md#input-params-for-litellmembedding) | type | [vertex equivalent](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/text-embeddings-api) | -|-------|-------------|--------------------| -| `input` | **string or List[string]** | `instances` | -| `dimensions` | **int** | `output_dimensionality` | -| `input_type` | **Literal["RETRIEVAL_QUERY","RETRIEVAL_DOCUMENT", "SEMANTIC_SIMILARITY", "CLASSIFICATION", "CLUSTERING", "QUESTION_ANSWERING", "FACT_VERIFICATION"]** | `task_type` | - -#### Usage with OpenAI (Unified) Params - - - - - -```python -response = litellm.embedding( - model="vertex_ai/text-embedding-004", - input=["good morning from litellm", "gm"] - input_type = "RETRIEVAL_DOCUMENT", - dimensions=1, -) -``` - - - - -```python -import openai - -client = openai.OpenAI(api_key="sk-1234", base_url="http://0.0.0.0:4000") - -response = client.embeddings.create( - model="text-embedding-004", - input = ["good morning from litellm", "gm"], - dimensions=1, - extra_body = { - "input_type": "RETRIEVAL_QUERY", - } -) - -print(response) -``` - - - - -### Supported Vertex Specific Params - -| param | type | -|-------|-------------| -| `auto_truncate` | **bool** | -| `task_type` | **Literal["RETRIEVAL_QUERY","RETRIEVAL_DOCUMENT", "SEMANTIC_SIMILARITY", "CLASSIFICATION", "CLUSTERING", "QUESTION_ANSWERING", "FACT_VERIFICATION"]** | -| `title` | **str** | - -#### Usage with Vertex Specific Params (Use `task_type` and `title`) - -You can pass any vertex specific params to the embedding model. Just pass them to the embedding function like this: - -[Relevant Vertex AI doc with all embedding params](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/text-embeddings-api#request_body) - - - - -```python -response = litellm.embedding( - model="vertex_ai/text-embedding-004", - input=["good morning from litellm", "gm"] - task_type = "RETRIEVAL_DOCUMENT", - title = "test", - dimensions=1, - auto_truncate=True, -) -``` - - - - -```python -import openai - -client = openai.OpenAI(api_key="sk-1234", base_url="http://0.0.0.0:4000") - -response = client.embeddings.create( - model="text-embedding-004", - input = ["good morning from litellm", "gm"], - dimensions=1, - extra_body = { - "task_type": "RETRIEVAL_QUERY", - "auto_truncate": True, - "title": "test", - } -) - -print(response) -``` - - - -## **Multi-Modal Embeddings** - - -Known Limitations: -- Only supports 1 image / video / image per request -- Only supports GCS or base64 encoded images / videos - -### Usage - - - - -Using GCS Images - -```python -response = await litellm.aembedding( - model="vertex_ai/multimodalembedding@001", - input="gs://cloud-samples-data/vertex-ai/llm/prompts/landmark1.png" # will be sent as a gcs image -) -``` - -Using base 64 encoded images - -```python -response = await litellm.aembedding( - model="vertex_ai/multimodalembedding@001", - input="data:image/jpeg;base64,..." # will be sent as a base64 encoded image -) -``` - - - - -1. Add model to config.yaml -```yaml -model_list: - - model_name: multimodalembedding@001 - litellm_params: - model: vertex_ai/multimodalembedding@001 - vertex_project: "adroit-crow-413218" - vertex_location: "us-central1" - vertex_credentials: adroit-crow-413218-a956eef1a2a8.json - -litellm_settings: - drop_params: True -``` - -2. Start Proxy - -``` -$ litellm --config /path/to/config.yaml -``` - -3. Make Request use OpenAI Python SDK, Langchain Python SDK - - - - - - -Requests with GCS Image / Video URI - -```python -import openai - -client = openai.OpenAI(api_key="sk-1234", base_url="http://0.0.0.0:4000") - -# # request sent to model set on litellm proxy, `litellm --model` -response = client.embeddings.create( - model="multimodalembedding@001", - input = "gs://cloud-samples-data/vertex-ai/llm/prompts/landmark1.png", -) - -print(response) -``` - -Requests with base64 encoded images - -```python -import openai - -client = openai.OpenAI(api_key="sk-1234", base_url="http://0.0.0.0:4000") - -# # request sent to model set on litellm proxy, `litellm --model` -response = client.embeddings.create( - model="multimodalembedding@001", - input = "data:image/jpeg;base64,...", -) - -print(response) -``` - - - - - -Requests with GCS Image / Video URI -```python -from langchain_openai import OpenAIEmbeddings - -embeddings_models = "multimodalembedding@001" - -embeddings = OpenAIEmbeddings( - model="multimodalembedding@001", - base_url="http://0.0.0.0:4000", - api_key="sk-1234", # type: ignore -) - - -query_result = embeddings.embed_query( - "gs://cloud-samples-data/vertex-ai/llm/prompts/landmark1.png" -) -print(query_result) - -``` - -Requests with base64 encoded images - -```python -from langchain_openai import OpenAIEmbeddings - -embeddings_models = "multimodalembedding@001" - -embeddings = OpenAIEmbeddings( - model="multimodalembedding@001", - base_url="http://0.0.0.0:4000", - api_key="sk-1234", # type: ignore -) - - -query_result = embeddings.embed_query( - "data:image/jpeg;base64,..." -) -print(query_result) - -``` - - - - - - - - - -1. Add model to config.yaml -```yaml -default_vertex_config: - vertex_project: "adroit-crow-413218" - vertex_location: "us-central1" - vertex_credentials: adroit-crow-413218-a956eef1a2a8.json -``` - -2. Start Proxy - -``` -$ litellm --config /path/to/config.yaml -``` - -3. Make Request use OpenAI Python SDK - -```python -import vertexai - -from vertexai.vision_models import Image, MultiModalEmbeddingModel, Video -from vertexai.vision_models import VideoSegmentConfig -from google.auth.credentials import Credentials - - -LITELLM_PROXY_API_KEY = "sk-1234" -LITELLM_PROXY_BASE = "http://0.0.0.0:4000/vertex-ai" - -import datetime - -class CredentialsWrapper(Credentials): - def __init__(self, token=None): - super().__init__() - self.token = token - self.expiry = None # or set to a future date if needed - - def refresh(self, request): - pass - - def apply(self, headers, token=None): - headers['Authorization'] = f'Bearer {self.token}' - - @property - def expired(self): - return False # Always consider the token as non-expired - - @property - def valid(self): - return True # Always consider the credentials as valid - -credentials = CredentialsWrapper(token=LITELLM_PROXY_API_KEY) - -vertexai.init( - project="adroit-crow-413218", - location="us-central1", - api_endpoint=LITELLM_PROXY_BASE, - credentials = credentials, - api_transport="rest", - -) - -model = MultiModalEmbeddingModel.from_pretrained("multimodalembedding") -image = Image.load_from_file( - "gs://cloud-samples-data/vertex-ai/llm/prompts/landmark1.png" -) - -embeddings = model.get_embeddings( - image=image, - contextual_text="Colosseum", - dimension=1408, -) -print(f"Image Embedding: {embeddings.image_embedding}") -print(f"Text Embedding: {embeddings.text_embedding}") -``` - - - - - -### Text + Image + Video Embeddings - - - - -Text + Image - -```python -response = await litellm.aembedding( - model="vertex_ai/multimodalembedding@001", - input=["hey", "gs://cloud-samples-data/vertex-ai/llm/prompts/landmark1.png"] # will be sent as a gcs image -) -``` - -Text + Video - -```python -response = await litellm.aembedding( - model="vertex_ai/multimodalembedding@001", - input=["hey", "gs://my-bucket/embeddings/supermarket-video.mp4"] # will be sent as a gcs image -) -``` - -Image + Video - -```python -response = await litellm.aembedding( - model="vertex_ai/multimodalembedding@001", - input=["gs://cloud-samples-data/vertex-ai/llm/prompts/landmark1.png", "gs://my-bucket/embeddings/supermarket-video.mp4"] # will be sent as a gcs image -) -``` - - - - - -1. Add model to config.yaml -```yaml -model_list: - - model_name: multimodalembedding@001 - litellm_params: - model: vertex_ai/multimodalembedding@001 - vertex_project: "adroit-crow-413218" - vertex_location: "us-central1" - vertex_credentials: adroit-crow-413218-a956eef1a2a8.json - -litellm_settings: - drop_params: True -``` - -2. Start Proxy - -``` -$ litellm --config /path/to/config.yaml -``` - -3. Make Request use OpenAI Python SDK, Langchain Python SDK - - -Text + Image - -```python -import openai - -client = openai.OpenAI(api_key="sk-1234", base_url="http://0.0.0.0:4000") - -# # request sent to model set on litellm proxy, `litellm --model` -response = client.embeddings.create( - model="multimodalembedding@001", - input = ["hey", "gs://cloud-samples-data/vertex-ai/llm/prompts/landmark1.png"], -) - -print(response) -``` - -Text + Video -```python -import openai - -client = openai.OpenAI(api_key="sk-1234", base_url="http://0.0.0.0:4000") - -# # request sent to model set on litellm proxy, `litellm --model` -response = client.embeddings.create( - model="multimodalembedding@001", - input = ["hey", "gs://my-bucket/embeddings/supermarket-video.mp4"], -) - -print(response) -``` - -Image + Video -```python -import openai - -client = openai.OpenAI(api_key="sk-1234", base_url="http://0.0.0.0:4000") - -# # request sent to model set on litellm proxy, `litellm --model` -response = client.embeddings.create( - model="multimodalembedding@001", - input = ["gs://cloud-samples-data/vertex-ai/llm/prompts/landmark1.png", "gs://my-bucket/embeddings/supermarket-video.mp4"], -) - -print(response) -``` - - - - - ## **Gemini TTS (Text-to-Speech) Audio Output** :::info diff --git a/docs/my-website/docs/providers/vertex_embedding.md b/docs/my-website/docs/providers/vertex_embedding.md new file mode 100644 index 00000000000..25580935387 --- /dev/null +++ b/docs/my-website/docs/providers/vertex_embedding.md @@ -0,0 +1,511 @@ +import Image from '@theme/IdealImage'; +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Vertex AI Embedding + +## Usage - Embedding + + + + +```python +import litellm +from litellm import embedding +litellm.vertex_project = "hardy-device-38811" # Your Project ID +litellm.vertex_location = "us-central1" # proj location + +response = embedding( + model="vertex_ai/textembedding-gecko", + input=["good morning from litellm"], +) +print(response) +``` + + + + + +1. Add model to config.yaml +```yaml +model_list: + - model_name: snowflake-arctic-embed-m-long-1731622468876 + litellm_params: + model: vertex_ai/ + vertex_project: "adroit-crow-413218" + vertex_location: "us-central1" + vertex_credentials: adroit-crow-413218-a956eef1a2a8.json + +litellm_settings: + drop_params: True +``` + +2. Start Proxy + +``` +$ litellm --config /path/to/config.yaml +``` + +3. Make Request using OpenAI Python SDK, Langchain Python SDK + +```python +import openai + +client = openai.OpenAI(api_key="sk-1234", base_url="http://0.0.0.0:4000") + +response = client.embeddings.create( + model="snowflake-arctic-embed-m-long-1731622468876", + input = ["good morning from litellm", "this is another item"], +) + +print(response) +``` + + + + + +#### Supported Embedding Models +All models listed [here](https://github.com/BerriAI/litellm/blob/57f37f743886a0249f630a6792d49dffc2c5d9b7/model_prices_and_context_window.json#L835) are supported + +| Model Name | Function Call | +|--------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| text-embedding-004 | `embedding(model="vertex_ai/text-embedding-004", input)` | +| text-multilingual-embedding-002 | `embedding(model="vertex_ai/text-multilingual-embedding-002", input)` | +| textembedding-gecko | `embedding(model="vertex_ai/textembedding-gecko", input)` | +| textembedding-gecko-multilingual | `embedding(model="vertex_ai/textembedding-gecko-multilingual", input)` | +| textembedding-gecko-multilingual@001 | `embedding(model="vertex_ai/textembedding-gecko-multilingual@001", input)` | +| textembedding-gecko@001 | `embedding(model="vertex_ai/textembedding-gecko@001", input)` | +| textembedding-gecko@003 | `embedding(model="vertex_ai/textembedding-gecko@003", input)` | +| text-embedding-preview-0409 | `embedding(model="vertex_ai/text-embedding-preview-0409", input)` | +| text-multilingual-embedding-preview-0409 | `embedding(model="vertex_ai/text-multilingual-embedding-preview-0409", input)` | +| Fine-tuned OR Custom Embedding models | `embedding(model="vertex_ai/", input)` | + +### Supported OpenAI (Unified) Params + +| [param](../embedding/supported_embedding.md#input-params-for-litellmembedding) | type | [vertex equivalent](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/text-embeddings-api) | +|-------|-------------|--------------------| +| `input` | **string or List[string]** | `instances` | +| `dimensions` | **int** | `output_dimensionality` | +| `input_type` | **Literal["RETRIEVAL_QUERY","RETRIEVAL_DOCUMENT", "SEMANTIC_SIMILARITY", "CLASSIFICATION", "CLUSTERING", "QUESTION_ANSWERING", "FACT_VERIFICATION"]** | `task_type` | + +#### Usage with OpenAI (Unified) Params + + + + + +```python +response = litellm.embedding( + model="vertex_ai/text-embedding-004", + input=["good morning from litellm", "gm"] + input_type = "RETRIEVAL_DOCUMENT", + dimensions=1, +) +``` + + + + +```python +import openai + +client = openai.OpenAI(api_key="sk-1234", base_url="http://0.0.0.0:4000") + +response = client.embeddings.create( + model="text-embedding-004", + input = ["good morning from litellm", "gm"], + dimensions=1, + extra_body = { + "input_type": "RETRIEVAL_QUERY", + } +) + +print(response) +``` + + + + +### Supported Vertex Specific Params + +| param | type | +|-------|-------------| +| `auto_truncate` | **bool** | +| `task_type` | **Literal["RETRIEVAL_QUERY","RETRIEVAL_DOCUMENT", "SEMANTIC_SIMILARITY", "CLASSIFICATION", "CLUSTERING", "QUESTION_ANSWERING", "FACT_VERIFICATION"]** | +| `title` | **str** | + +#### Usage with Vertex Specific Params (Use `task_type` and `title`) + +You can pass any vertex specific params to the embedding model. Just pass them to the embedding function like this: + +[Relevant Vertex AI doc with all embedding params](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/text-embeddings-api#request_body) + + + + +```python +response = litellm.embedding( + model="vertex_ai/text-embedding-004", + input=["good morning from litellm", "gm"] + task_type = "RETRIEVAL_DOCUMENT", + title = "test", + dimensions=1, + auto_truncate=True, +) +``` + + + + +```python +import openai + +client = openai.OpenAI(api_key="sk-1234", base_url="http://0.0.0.0:4000") + +response = client.embeddings.create( + model="text-embedding-004", + input = ["good morning from litellm", "gm"], + dimensions=1, + extra_body = { + "task_type": "RETRIEVAL_QUERY", + "auto_truncate": True, + "title": "test", + } +) + +print(response) +``` + + + +## **Multi-Modal Embeddings** + + +Known Limitations: +- Only supports 1 image / video / image per request +- Only supports GCS or base64 encoded images / videos + +### Usage + + + + +Using GCS Images + +```python +response = await litellm.aembedding( + model="vertex_ai/multimodalembedding@001", + input="gs://cloud-samples-data/vertex-ai/llm/prompts/landmark1.png" # will be sent as a gcs image +) +``` + +Using base 64 encoded images + +```python +response = await litellm.aembedding( + model="vertex_ai/multimodalembedding@001", + input="data:image/jpeg;base64,..." # will be sent as a base64 encoded image +) +``` + + + + +1. Add model to config.yaml +```yaml +model_list: + - model_name: multimodalembedding@001 + litellm_params: + model: vertex_ai/multimodalembedding@001 + vertex_project: "adroit-crow-413218" + vertex_location: "us-central1" + vertex_credentials: adroit-crow-413218-a956eef1a2a8.json + +litellm_settings: + drop_params: True +``` + +2. Start Proxy + +``` +$ litellm --config /path/to/config.yaml +``` + +3. Make Request use OpenAI Python SDK, Langchain Python SDK + + + + + + +Requests with GCS Image / Video URI + +```python +import openai + +client = openai.OpenAI(api_key="sk-1234", base_url="http://0.0.0.0:4000") + +# # request sent to model set on litellm proxy, `litellm --model` +response = client.embeddings.create( + model="multimodalembedding@001", + input = "gs://cloud-samples-data/vertex-ai/llm/prompts/landmark1.png", +) + +print(response) +``` + +Requests with base64 encoded images + +```python +import openai + +client = openai.OpenAI(api_key="sk-1234", base_url="http://0.0.0.0:4000") + +# # request sent to model set on litellm proxy, `litellm --model` +response = client.embeddings.create( + model="multimodalembedding@001", + input = "data:image/jpeg;base64,...", +) + +print(response) +``` + + + + + +Requests with GCS Image / Video URI +```python +from langchain_openai import OpenAIEmbeddings + +embeddings_models = "multimodalembedding@001" + +embeddings = OpenAIEmbeddings( + model="multimodalembedding@001", + base_url="http://0.0.0.0:4000", + api_key="sk-1234", # type: ignore +) + + +query_result = embeddings.embed_query( + "gs://cloud-samples-data/vertex-ai/llm/prompts/landmark1.png" +) +print(query_result) + +``` + +Requests with base64 encoded images + +```python +from langchain_openai import OpenAIEmbeddings + +embeddings_models = "multimodalembedding@001" + +embeddings = OpenAIEmbeddings( + model="multimodalembedding@001", + base_url="http://0.0.0.0:4000", + api_key="sk-1234", # type: ignore +) + + +query_result = embeddings.embed_query( + "data:image/jpeg;base64,..." +) +print(query_result) + +``` + + + + + + + + + +1. Add model to config.yaml +```yaml +default_vertex_config: + vertex_project: "adroit-crow-413218" + vertex_location: "us-central1" + vertex_credentials: adroit-crow-413218-a956eef1a2a8.json +``` + +2. Start Proxy + +``` +$ litellm --config /path/to/config.yaml +``` + +3. Make Request use OpenAI Python SDK + +```python +import vertexai + +from vertexai.vision_models import Image, MultiModalEmbeddingModel, Video +from vertexai.vision_models import VideoSegmentConfig +from google.auth.credentials import Credentials + + +LITELLM_PROXY_API_KEY = "sk-1234" +LITELLM_PROXY_BASE = "http://0.0.0.0:4000/vertex-ai" + +import datetime + +class CredentialsWrapper(Credentials): + def __init__(self, token=None): + super().__init__() + self.token = token + self.expiry = None # or set to a future date if needed + + def refresh(self, request): + pass + + def apply(self, headers, token=None): + headers['Authorization'] = f'Bearer {self.token}' + + @property + def expired(self): + return False # Always consider the token as non-expired + + @property + def valid(self): + return True # Always consider the credentials as valid + +credentials = CredentialsWrapper(token=LITELLM_PROXY_API_KEY) + +vertexai.init( + project="adroit-crow-413218", + location="us-central1", + api_endpoint=LITELLM_PROXY_BASE, + credentials = credentials, + api_transport="rest", + +) + +model = MultiModalEmbeddingModel.from_pretrained("multimodalembedding") +image = Image.load_from_file( + "gs://cloud-samples-data/vertex-ai/llm/prompts/landmark1.png" +) + +embeddings = model.get_embeddings( + image=image, + contextual_text="Colosseum", + dimension=1408, +) +print(f"Image Embedding: {embeddings.image_embedding}") +print(f"Text Embedding: {embeddings.text_embedding}") +``` + + + + + +### Text + Image + Video Embeddings + + + + +Text + Image + +```python +response = await litellm.aembedding( + model="vertex_ai/multimodalembedding@001", + input=["hey", "gs://cloud-samples-data/vertex-ai/llm/prompts/landmark1.png"] # will be sent as a gcs image +) +``` + +Text + Video + +```python +response = await litellm.aembedding( + model="vertex_ai/multimodalembedding@001", + input=["hey", "gs://my-bucket/embeddings/supermarket-video.mp4"] # will be sent as a gcs image +) +``` + +Image + Video + +```python +response = await litellm.aembedding( + model="vertex_ai/multimodalembedding@001", + input=["gs://cloud-samples-data/vertex-ai/llm/prompts/landmark1.png", "gs://my-bucket/embeddings/supermarket-video.mp4"] # will be sent as a gcs image +) +``` + + + + + +1. Add model to config.yaml +```yaml +model_list: + - model_name: multimodalembedding@001 + litellm_params: + model: vertex_ai/multimodalembedding@001 + vertex_project: "adroit-crow-413218" + vertex_location: "us-central1" + vertex_credentials: adroit-crow-413218-a956eef1a2a8.json + +litellm_settings: + drop_params: True +``` + +2. Start Proxy + +``` +$ litellm --config /path/to/config.yaml +``` + +3. Make Request use OpenAI Python SDK, Langchain Python SDK + + +Text + Image + +```python +import openai + +client = openai.OpenAI(api_key="sk-1234", base_url="http://0.0.0.0:4000") + +# # request sent to model set on litellm proxy, `litellm --model` +response = client.embeddings.create( + model="multimodalembedding@001", + input = ["hey", "gs://cloud-samples-data/vertex-ai/llm/prompts/landmark1.png"], +) + +print(response) +``` + +Text + Video +```python +import openai + +client = openai.OpenAI(api_key="sk-1234", base_url="http://0.0.0.0:4000") + +# # request sent to model set on litellm proxy, `litellm --model` +response = client.embeddings.create( + model="multimodalembedding@001", + input = ["hey", "gs://my-bucket/embeddings/supermarket-video.mp4"], +) + +print(response) +``` + +Image + Video +```python +import openai + +client = openai.OpenAI(api_key="sk-1234", base_url="http://0.0.0.0:4000") + +# # request sent to model set on litellm proxy, `litellm --model` +response = client.embeddings.create( + model="multimodalembedding@001", + input = ["gs://cloud-samples-data/vertex-ai/llm/prompts/landmark1.png", "gs://my-bucket/embeddings/supermarket-video.mp4"], +) + +print(response) +``` + + + \ No newline at end of file diff --git a/docs/my-website/sidebars.js b/docs/my-website/sidebars.js index e467711b59d..789cf690285 100644 --- a/docs/my-website/sidebars.js +++ b/docs/my-website/sidebars.js @@ -519,6 +519,7 @@ const sidebars = { "providers/vertex_ai/videos", "providers/vertex_partner", "providers/vertex_self_deployed", + "providers/vertex_embedding", "providers/vertex_image", "providers/vertex_batch", "providers/vertex_ocr", From 6341b531a020be1ef6efd5bca4aae4bc11303978 Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Tue, 28 Oct 2025 18:46:05 -0700 Subject: [PATCH 020/178] handling BGE URL --- litellm/llms/vertex_ai/common_utils.py | 42 +++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/litellm/llms/vertex_ai/common_utils.py b/litellm/llms/vertex_ai/common_utils.py index aaee922a3f0..430ed909173 100644 --- a/litellm/llms/vertex_ai/common_utils.py +++ b/litellm/llms/vertex_ai/common_utils.py @@ -144,6 +144,36 @@ all_gemini_url_modes = Literal[ ] +def _get_embedding_url( + model: str, + vertex_project: Optional[str], + vertex_location: Optional[str], + vertex_api_version: Literal["v1", "v1beta1"], +) -> Tuple[str, str]: + """ + Get URL for embedding models. + + Handles special patterns: + - bge/endpoint_id -> strips to endpoint_id for endpoints/ routing + - numeric model -> routes to endpoints/ + - regular model -> routes to publishers/google/models/ + """ + from litellm.llms.vertex_ai.vertex_embeddings.bge import VertexBGEConfig + endpoint = "predict" + + # Handle BGE models with pattern bge/endpoint_id (similar to gemma/ pattern) + # After provider split: vertex_ai/bge/123456 -> bge/123456 -> 123456 + if VertexBGEConfig.is_bge_model(model): + model = model.replace("bge/", "", 1) + + url = f"https://{vertex_location}-aiplatform.googleapis.com/v1/projects/{vertex_project}/locations/{vertex_location}/publishers/google/models/{model}:{endpoint}" + if model.isdigit(): + # https://us-central1-aiplatform.googleapis.com/v1/projects/$PROJECT_ID/locations/us-central1/endpoints/$ENDPOINT_ID:predict + url = f"https://{vertex_location}-aiplatform.googleapis.com/{vertex_api_version}/projects/{vertex_project}/locations/{vertex_location}/endpoints/{model}:{endpoint}" + + return url, endpoint + + def _get_vertex_url( mode: all_gemini_url_modes, model: str, @@ -156,6 +186,7 @@ def _get_vertex_url( endpoint: Optional[str] = None model = litellm.VertexGeminiConfig.get_model_for_vertex_ai_url(model=model) + if mode == "chat": ### SET RUNTIME ENDPOINT ### endpoint = "generateContent" @@ -180,11 +211,12 @@ def _get_vertex_url( if stream is True: url += "?alt=sse" elif mode == "embedding": - endpoint = "predict" - url = f"https://{vertex_location}-aiplatform.googleapis.com/v1/projects/{vertex_project}/locations/{vertex_location}/publishers/google/models/{model}:{endpoint}" - if model.isdigit(): - # https://us-central1-aiplatform.googleapis.com/v1/projects/$PROJECT_ID/locations/us-central1/endpoints/$ENDPOINT_ID:predict - url = f"https://{vertex_location}-aiplatform.googleapis.com/{vertex_api_version}/projects/{vertex_project}/locations/{vertex_location}/endpoints/{model}:{endpoint}" + return _get_embedding_url( + model=model, + vertex_project=vertex_project, + vertex_location=vertex_location, + vertex_api_version=vertex_api_version, + ) elif mode == "image_generation": endpoint = "predict" url = f"https://{vertex_location}-aiplatform.googleapis.com/v1/projects/{vertex_project}/locations/{vertex_location}/publishers/google/models/{model}:{endpoint}" From 8ea8c674e1fb4a891f92dce5f05d96ae54a9ea3f Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Tue, 28 Oct 2025 18:46:31 -0700 Subject: [PATCH 021/178] fix VertexBGEConfig --- .../llms/vertex_ai/vertex_embeddings/bge.py | 21 +++++++++++++++++-- .../vertex_embeddings/transformation.py | 7 +++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/litellm/llms/vertex_ai/vertex_embeddings/bge.py b/litellm/llms/vertex_ai/vertex_embeddings/bge.py index b8979f55880..2eff0ba96db 100644 --- a/litellm/llms/vertex_ai/vertex_embeddings/bge.py +++ b/litellm/llms/vertex_ai/vertex_embeddings/bge.py @@ -4,6 +4,10 @@ Vertex AI BGE (BAAI General Embedding) Configuration BGE models deployed on Vertex AI require different input/output format: - Request: Use "prompt" instead of "content" as the input field - Response: Embeddings are returned directly as arrays, not wrapped in objects + +Model name handling: +- Model names like "bge/endpoint_id" are automatically transformed in common_utils._get_vertex_url() +- This module focuses on request/response transformation only """ from typing import List, Optional, Union @@ -24,6 +28,13 @@ class VertexBGEConfig: BGE (BAAI General Embedding) models use a different request format where the input field is named "prompt" instead of "content". + + Supported model patterns (after provider split in main.py): + - "bge-small-en-v1.5" (model name) + - "bge/204379420394258432" (endpoint ID pattern) + + Note: Model name transformation (bge/ -> numeric ID) is handled automatically + in common_utils._get_vertex_url(). This class focuses on request/response format only. """ @staticmethod @@ -31,13 +42,19 @@ class VertexBGEConfig: """ Check if the model is a BGE (BAAI General Embedding) model. + After provider split in main.py, supports: + - "bge-small-en-v1.5" (model name) + - "bge/204379420394258432" (endpoint ID pattern) + Args: - model: The model name + model: The model name after provider split Returns: bool: True if the model is a BGE model """ - return "bge" in model.lower() + model_lower = model.lower() + # Check for "bge/" prefix (endpoint pattern) or "bge" in model name + return model_lower.startswith("bge/") or "bge" in model_lower @staticmethod def transform_request( diff --git a/litellm/llms/vertex_ai/vertex_embeddings/transformation.py b/litellm/llms/vertex_ai/vertex_embeddings/transformation.py index 77da3ce7c01..5a3a4a7188a 100644 --- a/litellm/llms/vertex_ai/vertex_embeddings/transformation.py +++ b/litellm/llms/vertex_ai/vertex_embeddings/transformation.py @@ -5,7 +5,6 @@ from pydantic import BaseModel from litellm.types.utils import EmbeddingResponse, Usage -from .bge import VertexBGEConfig from .types import * @@ -106,11 +105,12 @@ class VertexAITextEmbeddingConfig(BaseModel): """ Transforms an openai request to a vertex embedding request. """ + # Import here to avoid circular import issues with litellm.__init__ + from litellm.llms.vertex_ai.vertex_embeddings.bge import VertexBGEConfig if model.isdigit(): return self._transform_openai_request_to_fine_tuned_embedding_request( input, optional_params, model ) - if VertexBGEConfig.is_bge_model(model): return VertexBGEConfig.transform_request( input=input, optional_params=optional_params, model=model @@ -216,6 +216,9 @@ class VertexAITextEmbeddingConfig(BaseModel): response, model, model_response ) + # Import here to avoid circular import issues with litellm.__init__ + from litellm.llms.vertex_ai.vertex_embeddings.bge import VertexBGEConfig + if VertexBGEConfig.is_bge_model(model): return VertexBGEConfig.transform_response( response=response, model=model, model_response=model_response From 075a80b7471927541aa082f2c30eb28e816d9d03 Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Tue, 28 Oct 2025 18:48:19 -0700 Subject: [PATCH 022/178] test_vertex_ai_bge_with_endpoint_id_pattern --- .../llms/vertex_ai/test_bge_embedding.py | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/tests/test_litellm/llms/vertex_ai/test_bge_embedding.py b/tests/test_litellm/llms/vertex_ai/test_bge_embedding.py index 636df93b026..75e6f08c822 100644 --- a/tests/test_litellm/llms/vertex_ai/test_bge_embedding.py +++ b/tests/test_litellm/llms/vertex_ai/test_bge_embedding.py @@ -99,3 +99,85 @@ def test_vertex_ai_bge_embedding_with_custom_api_base(): assert len(response.data) == 2 assert "embedding" in response.data[0] + +def test_vertex_ai_bge_with_endpoint_id_pattern(): + """ + Test BGE with vertex_ai/bge/endpoint_id pattern. + + This test verifies that the pattern vertex_ai/bge/204379420394258432 + correctly triggers BGE transformations and routes to the endpoint. + """ + client = HTTPHandler() + + def mock_auth_token(*args, **kwargs): + return "fake-token", "fake-project" + + with patch.object(client, "post") as mock_post, patch( + "litellm.llms.vertex_ai.vertex_embeddings.embedding_handler.VertexEmbedding._ensure_access_token", + side_effect=mock_auth_token + ): + mock_response = MagicMock() + mock_response.status_code = 200 + mock_response.json.return_value = { + "predictions": [ + [0.1, 0.2, 0.3, 0.4, 0.5], + [0.6, 0.7, 0.8, 0.9, 1.0] + ], + "deployedModelId": "204379420394258432", + "model": "projects/1060139831167/locations/europe-west4/models/baai_bge-base-en", + "modelDisplayName": "baai_bge-base-en", + "modelVersionId": "1" + } + mock_post.return_value = mock_response + + response = litellm.embedding( + model="vertex_ai/bge/204379420394258432", + input=["Hello", "World"], + vertex_project="1060139831167", + vertex_location="europe-west4", + client=client + ) + + mock_post.assert_called_once() + + call_args = mock_post.call_args + kwargs = call_args.kwargs if hasattr(call_args, 'kwargs') else call_args[1] + + if "url" in kwargs: + api_url_called = kwargs["url"] + elif len(call_args[0]) > 0: + api_url_called = call_args[0][0] + else: + api_url_called = "Unknown" + + # Vertex AI may use 'json' or 'data' parameter + if "json" in kwargs: + request_data = kwargs["json"] + elif "data" in kwargs: + request_data = json.loads(kwargs["data"]) + else: + request_data = {} + + print("\n" + "="*50) + print("BGE Endpoint Pattern Test:") + print("="*50) + print(f"Model: vertex_ai/bge/204379420394258432") + print(f"API URL: {api_url_called}") + print("Request Body:") + print(json.dumps(request_data, indent=2)) + print("="*50 + "\n") + + # Verify URL contains the endpoint ID and uses endpoints/ path + assert "204379420394258432" in api_url_called, f"Endpoint ID not in URL: {api_url_called}" + assert "endpoints" in api_url_called, f"Expected 'endpoints' in URL, got: {api_url_called}" + + # Verify BGE-specific request format (uses "prompt" not "content") + assert "instances" in request_data + assert "prompt" in request_data["instances"][0] + assert request_data["instances"][0]["prompt"] == "Hello" + + # Verify response + assert isinstance(response.data, list) + assert len(response.data) == 2 + + From b7fe25c97db1a3a77b1bc23b65c43e964cbda42a Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Tue, 28 Oct 2025 18:53:32 -0700 Subject: [PATCH 023/178] docs vertex BGE --- .../docs/providers/vertex_embedding.md | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/docs/my-website/docs/providers/vertex_embedding.md b/docs/my-website/docs/providers/vertex_embedding.md index 25580935387..023db6130f7 100644 --- a/docs/my-website/docs/providers/vertex_embedding.md +++ b/docs/my-website/docs/providers/vertex_embedding.md @@ -179,6 +179,70 @@ print(response) +## **BGE Embeddings** + +Use BGE (Baidu General Embedding) models deployed on Vertex AI. + +### Usage + + + + +```python showLineNumbers title="Using BGE on Vertex AI" +import litellm + +response = litellm.embedding( + model="vertex_ai/bge/", + input=["Hello", "World"], + vertex_project="your-project-id", + vertex_location="your-location" +) + +print(response) +``` + + + + + +1. Add model to config.yaml +```yaml showLineNumbers title="config.yaml" +model_list: + - model_name: bge-embedding + litellm_params: + model: vertex_ai/bge/ + vertex_project: "your-project-id" + vertex_location: "us-central1" + vertex_credentials: your-credentials.json + +litellm_settings: + drop_params: True +``` + +2. Start Proxy + +```bash +$ litellm --config /path/to/config.yaml +``` + +3. Make Request using OpenAI Python SDK + +```python showLineNumbers title="Making requests to BGE" +import openai + +client = openai.OpenAI(api_key="sk-1234", base_url="http://0.0.0.0:4000") + +response = client.embeddings.create( + model="bge-embedding", + input=["good morning from litellm", "this is another item"] +) + +print(response) +``` + + + + ## **Multi-Modal Embeddings** From a79002c1fe42c204c1f9c1e3f15b009e80744d3f Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Tue, 28 Oct 2025 18:57:20 -0700 Subject: [PATCH 024/178] docs --- docs/my-website/docs/providers/vertex_embedding.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/my-website/docs/providers/vertex_embedding.md b/docs/my-website/docs/providers/vertex_embedding.md index 023db6130f7..ad2c03debb1 100644 --- a/docs/my-website/docs/providers/vertex_embedding.md +++ b/docs/my-website/docs/providers/vertex_embedding.md @@ -240,6 +240,18 @@ response = client.embeddings.create( print(response) ``` +Using a Private Service Connect (PSC) endpoint + +```yaml showLineNumbers title="config.yaml (PSC)" +model_list: + - model_name: bge-small-en-v1.5 + litellm_params: + model: vertex_ai/1234567890 + api_base: http://10.96.32.8 # Your PSC IP + vertex_project: my-project-id #optional + vertex_location: us-central1 #optional +``` + From fcc108b554867de286ac56fe4d66f25c96fbdb1d Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Tue, 28 Oct 2025 18:57:35 -0700 Subject: [PATCH 025/178] docs fix --- docs/my-website/docs/providers/vertex_embedding.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/my-website/docs/providers/vertex_embedding.md b/docs/my-website/docs/providers/vertex_embedding.md index ad2c03debb1..5656ade337b 100644 --- a/docs/my-website/docs/providers/vertex_embedding.md +++ b/docs/my-website/docs/providers/vertex_embedding.md @@ -246,7 +246,7 @@ Using a Private Service Connect (PSC) endpoint model_list: - model_name: bge-small-en-v1.5 litellm_params: - model: vertex_ai/1234567890 + model: vertex_ai/bge/1234567890 api_base: http://10.96.32.8 # Your PSC IP vertex_project: my-project-id #optional vertex_location: us-central1 #optional From c0a083ff61546bf0aeca3ea4e952d0281508382e Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Wed, 29 Oct 2025 09:53:23 -0700 Subject: [PATCH 026/178] fix VertexAIModelRoute --- litellm/llms/vertex_ai/common_utils.py | 42 +++----------------------- 1 file changed, 5 insertions(+), 37 deletions(-) diff --git a/litellm/llms/vertex_ai/common_utils.py b/litellm/llms/vertex_ai/common_utils.py index 430ed909173..aaee922a3f0 100644 --- a/litellm/llms/vertex_ai/common_utils.py +++ b/litellm/llms/vertex_ai/common_utils.py @@ -144,36 +144,6 @@ all_gemini_url_modes = Literal[ ] -def _get_embedding_url( - model: str, - vertex_project: Optional[str], - vertex_location: Optional[str], - vertex_api_version: Literal["v1", "v1beta1"], -) -> Tuple[str, str]: - """ - Get URL for embedding models. - - Handles special patterns: - - bge/endpoint_id -> strips to endpoint_id for endpoints/ routing - - numeric model -> routes to endpoints/ - - regular model -> routes to publishers/google/models/ - """ - from litellm.llms.vertex_ai.vertex_embeddings.bge import VertexBGEConfig - endpoint = "predict" - - # Handle BGE models with pattern bge/endpoint_id (similar to gemma/ pattern) - # After provider split: vertex_ai/bge/123456 -> bge/123456 -> 123456 - if VertexBGEConfig.is_bge_model(model): - model = model.replace("bge/", "", 1) - - url = f"https://{vertex_location}-aiplatform.googleapis.com/v1/projects/{vertex_project}/locations/{vertex_location}/publishers/google/models/{model}:{endpoint}" - if model.isdigit(): - # https://us-central1-aiplatform.googleapis.com/v1/projects/$PROJECT_ID/locations/us-central1/endpoints/$ENDPOINT_ID:predict - url = f"https://{vertex_location}-aiplatform.googleapis.com/{vertex_api_version}/projects/{vertex_project}/locations/{vertex_location}/endpoints/{model}:{endpoint}" - - return url, endpoint - - def _get_vertex_url( mode: all_gemini_url_modes, model: str, @@ -186,7 +156,6 @@ def _get_vertex_url( endpoint: Optional[str] = None model = litellm.VertexGeminiConfig.get_model_for_vertex_ai_url(model=model) - if mode == "chat": ### SET RUNTIME ENDPOINT ### endpoint = "generateContent" @@ -211,12 +180,11 @@ def _get_vertex_url( if stream is True: url += "?alt=sse" elif mode == "embedding": - return _get_embedding_url( - model=model, - vertex_project=vertex_project, - vertex_location=vertex_location, - vertex_api_version=vertex_api_version, - ) + endpoint = "predict" + url = f"https://{vertex_location}-aiplatform.googleapis.com/v1/projects/{vertex_project}/locations/{vertex_location}/publishers/google/models/{model}:{endpoint}" + if model.isdigit(): + # https://us-central1-aiplatform.googleapis.com/v1/projects/$PROJECT_ID/locations/us-central1/endpoints/$ENDPOINT_ID:predict + url = f"https://{vertex_location}-aiplatform.googleapis.com/{vertex_api_version}/projects/{vertex_project}/locations/{vertex_location}/endpoints/{model}:{endpoint}" elif mode == "image_generation": endpoint = "predict" url = f"https://{vertex_location}-aiplatform.googleapis.com/v1/projects/{vertex_project}/locations/{vertex_location}/publishers/google/models/{model}:{endpoint}" From 8a9c9af55f23d67b80450aeaaaf36c8a0d80a097 Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Wed, 29 Oct 2025 09:53:52 -0700 Subject: [PATCH 027/178] from ..common_utils import VertexAIError, get_vertex_base_model_name add --- litellm/llms/vertex_ai/vertex_model_garden/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/litellm/llms/vertex_ai/vertex_model_garden/main.py b/litellm/llms/vertex_ai/vertex_model_garden/main.py index 225e75a5add..fe7d0862e02 100644 --- a/litellm/llms/vertex_ai/vertex_model_garden/main.py +++ b/litellm/llms/vertex_ai/vertex_model_garden/main.py @@ -22,7 +22,7 @@ import httpx # type: ignore from litellm.utils import ModelResponse -from ..common_utils import VertexAIError +from ..common_utils import VertexAIError, get_vertex_base_model_name from ..vertex_llm_base import VertexBase @@ -89,7 +89,7 @@ class VertexAIModelGardenModels(VertexBase): message="""Upgrade vertex ai. Run `pip install "google-cloud-aiplatform>=1.38"`""", ) try: - model = model.replace("openai/", "") + model = get_vertex_base_model_name(model=model) vertex_httpx_logic = VertexLLM() access_token, project_id = vertex_httpx_logic._ensure_access_token( From 87b75afe12d6b2bc4644979e596bff5b750ea2dd Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Wed, 29 Oct 2025 09:54:20 -0700 Subject: [PATCH 028/178] fix VertexAIGemmaModels --- litellm/llms/vertex_ai/vertex_gemma_models/main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/litellm/llms/vertex_ai/vertex_gemma_models/main.py b/litellm/llms/vertex_ai/vertex_gemma_models/main.py index 8203b285ebd..41bd6b5431e 100644 --- a/litellm/llms/vertex_ai/vertex_gemma_models/main.py +++ b/litellm/llms/vertex_ai/vertex_gemma_models/main.py @@ -25,7 +25,7 @@ import httpx # type: ignore from litellm.utils import ModelResponse -from ..common_utils import VertexAIError +from ..common_utils import VertexAIError, get_vertex_base_model_name from ..vertex_llm_base import VertexBase @@ -82,7 +82,8 @@ class VertexAIGemmaModels(VertexBase): message="""Upgrade vertex ai. Run `pip install "google-cloud-aiplatform>=1.38"`""", ) try: - model = model.replace("gemma/", "") + + model = get_vertex_base_model_name(model=model) vertex_httpx_logic = VertexLLM() access_token, project_id = vertex_httpx_logic._ensure_access_token( From bfa7f12d4c78a7e89222815c51d3bc517a7f9c3d Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Wed, 29 Oct 2025 09:54:59 -0700 Subject: [PATCH 029/178] fix get_vertex_base_model_name --- litellm/llms/vertex_ai/vertex_llm_base.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/litellm/llms/vertex_ai/vertex_llm_base.py b/litellm/llms/vertex_ai/vertex_llm_base.py index a5c44617fab..ce50bf311e1 100644 --- a/litellm/llms/vertex_ai/vertex_llm_base.py +++ b/litellm/llms/vertex_ai/vertex_llm_base.py @@ -19,6 +19,7 @@ from .common_utils import ( _get_gemini_url, _get_vertex_url, all_gemini_url_modes, + get_vertex_base_model_name, is_global_only_vertex_model, ) @@ -327,10 +328,13 @@ class VertexBase: # Check if this is a PSC endpoint or custom deployment # PSC/custom endpoints need the full path structure if vertex_project and vertex_location and model: + # Strip routing prefixes (bge/, gemma/, etc.) for endpoint URL construction + model_for_url = get_vertex_base_model_name(model=model) + # Check if model is numeric (endpoint ID) or if api_base doesn't contain googleapis.com # These are indicators of PSC/custom endpoints is_psc_or_custom = ( - "googleapis.com" not in api_base.lower() or model.isdigit() + "googleapis.com" not in api_base.lower() or model_for_url.isdigit() ) if is_psc_or_custom: @@ -342,7 +346,7 @@ class VertexBase: version, vertex_project, vertex_location, - model, + model_for_url, endpoint, ) else: From fe03833d3bae772ffd2d05603d1348186a9a874a Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Wed, 29 Oct 2025 10:01:06 -0700 Subject: [PATCH 030/178] test_vertex_ai_bge_psc_endpoint_url_construction --- .../llms/vertex_ai/test_bge_embedding.py | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/tests/test_litellm/llms/vertex_ai/test_bge_embedding.py b/tests/test_litellm/llms/vertex_ai/test_bge_embedding.py index 75e6f08c822..156ab95184a 100644 --- a/tests/test_litellm/llms/vertex_ai/test_bge_embedding.py +++ b/tests/test_litellm/llms/vertex_ai/test_bge_embedding.py @@ -181,3 +181,71 @@ def test_vertex_ai_bge_with_endpoint_id_pattern(): assert len(response.data) == 2 +def test_vertex_ai_bge_psc_endpoint_url_construction(): + """ + Test that BGE models with PSC endpoints construct correct URL without bge/ prefix. + + Verifies that vertex_ai/bge/378943383978115072 with api_base http://10.128.16.2 + constructs URL: http://10.128.16.2/v1/projects/{project}/locations/{location}/endpoints/378943383978115072:predict + + The bge/ prefix should be stripped from the endpoint URL. + """ + client = HTTPHandler() + + def mock_auth_token(*args, **kwargs): + return "fake-token", "gen-lang-client-0682925754" + + with patch.object(client, "post") as mock_post, patch( + "litellm.llms.vertex_ai.vertex_embeddings.embedding_handler.VertexEmbedding._ensure_access_token", + side_effect=mock_auth_token + ): + mock_response = MagicMock() + mock_response.status_code = 200 + mock_response.json.return_value = { + "predictions": [ + [0.1, 0.2, 0.3, 0.4, 0.5] + ] + } + mock_post.return_value = mock_response + + response = litellm.embedding( + model="vertex_ai/bge/378943383978115072", + input=["The food was delicious and the waiter.."], + api_base="http://10.128.16.2", + vertex_project="gen-lang-client-0682925754", + vertex_location="us-central1", + client=client + ) + + mock_post.assert_called_once() + + call_args = mock_post.call_args + kwargs = call_args.kwargs if hasattr(call_args, 'kwargs') else call_args[1] + + if "url" in kwargs: + api_url_called = kwargs["url"] + elif len(call_args[0]) > 0: + api_url_called = call_args[0][0] + else: + api_url_called = "Unknown" + + print("\n" + "="*50) + print("PSC Endpoint URL Construction Test:") + print("="*50) + print(f"Model: vertex_ai/bge/378943383978115072") + print(f"API Base: http://10.128.16.2") + print(f"Constructed URL: {api_url_called}") + print("="*50 + "\n") + + # Verify the URL is constructed correctly + expected_url = "http://10.128.16.2/v1/projects/gen-lang-client-0682925754/locations/us-central1/endpoints/378943383978115072:predict" + assert api_url_called == expected_url, f"Expected URL: {expected_url}, Got: {api_url_called}" + + # Verify bge/ prefix is NOT in the URL + assert "bge/" not in api_url_called, f"URL should not contain 'bge/' prefix: {api_url_called}" + + # Verify response works + assert isinstance(response.data, list) + assert len(response.data) == 1 + + From 2201e12accfd27e531937d2f3a1b00dd400a9fe1 Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Tue, 2 Dec 2025 22:08:23 +0530 Subject: [PATCH 031/178] Fix import error --- litellm/llms/vertex_ai/common_utils.py | 87 +++++++++++++++++-- .../test_vertex_ai_psc_endpoint_support.py | 5 +- 2 files changed, 83 insertions(+), 9 deletions(-) diff --git a/litellm/llms/vertex_ai/common_utils.py b/litellm/llms/vertex_ai/common_utils.py index aaee922a3f0..836234f6f13 100644 --- a/litellm/llms/vertex_ai/common_utils.py +++ b/litellm/llms/vertex_ai/common_utils.py @@ -31,9 +31,11 @@ class VertexAIModelRoute(str, Enum): PARTNER_MODELS = "partner_models" GEMINI = "gemini" GEMMA = "gemma" + BGE = "bge" MODEL_GARDEN = "model_garden" NON_GEMINI = "non_gemini" +VERTEX_AI_MODEL_ROUTES = [f"{route.value}/" for route in VertexAIModelRoute] def get_vertex_ai_model_route( model: str, litellm_params: Optional[dict] = None @@ -81,7 +83,11 @@ def get_vertex_ai_model_route( # Check for partner models (llama, mistral, claude, etc.) if VertexAIPartnerModels.is_vertex_partner_model(model=model): return VertexAIModelRoute.PARTNER_MODELS - + + # Check for BGE models + if "bge/" in model or "bge" in model.lower(): + return VertexAIModelRoute.BGE + # Check for gemma models if "gemma/" in model: return VertexAIModelRoute.GEMMA @@ -144,6 +150,71 @@ all_gemini_url_modes = Literal[ ] +def get_vertex_base_model_name(model: str) -> str: + """ + Strip routing prefixes from model name for PSC/endpoint URL construction. + + Patterns like "bge/", "gemma/", "openai/" are used for internal routing but + should not appear in the actual endpoint URL. Routing prefixes are derived + from VertexAIModelRoute enum values. + + Args: + model: The model name with potential prefix (e.g., "bge/123456", "gemma/gemma-3-12b-it") + + Returns: + str: The model name without routing prefix (e.g., "123456", "gemma-3-12b-it") + + Examples: + >>> get_vertex_base_model_name("bge/378943383978115072") + "378943383978115072" + + >>> get_vertex_base_model_name("gemma/gemma-3-12b-it") + "gemma-3-12b-it" + + >>> get_vertex_base_model_name("openai/gpt-oss-120b") + "gpt-oss-120b" + + >>> get_vertex_base_model_name("1234567890") + "1234567890" + """ + # Derive routing prefixes from VertexAIModelRoute enum + # Map specific routes to their prefixes (some routes like PARTNER_MODELS, GEMINI don't have prefixes) + + + for route in VERTEX_AI_MODEL_ROUTES: + if model.startswith(route): + return model.replace(route, "", 1) + + return model + + +def _get_embedding_url( + model: str, + vertex_project: Optional[str], + vertex_location: Optional[str], + vertex_api_version: Literal["v1", "v1beta1"], +) -> Tuple[str, str]: + """ + Get URL for embedding models. + + Handles special patterns: + - bge/endpoint_id -> strips to endpoint_id for endpoints/ routing + - numeric model -> routes to endpoints/ + - regular model -> routes to publishers/google/models/ + """ + endpoint = "predict" + + # Strip routing prefixes (bge/, gemma/, etc.) for endpoint URL construction + model = get_vertex_base_model_name(model=model) + + url = f"https://{vertex_location}-aiplatform.googleapis.com/v1/projects/{vertex_project}/locations/{vertex_location}/publishers/google/models/{model}:{endpoint}" + if model.isdigit(): + # https://us-central1-aiplatform.googleapis.com/v1/projects/$PROJECT_ID/locations/us-central1/endpoints/$ENDPOINT_ID:predict + url = f"https://{vertex_location}-aiplatform.googleapis.com/{vertex_api_version}/projects/{vertex_project}/locations/{vertex_location}/endpoints/{model}:{endpoint}" + + return url, endpoint + + def _get_vertex_url( mode: all_gemini_url_modes, model: str, @@ -156,6 +227,7 @@ def _get_vertex_url( endpoint: Optional[str] = None model = litellm.VertexGeminiConfig.get_model_for_vertex_ai_url(model=model) + if mode == "chat": ### SET RUNTIME ENDPOINT ### endpoint = "generateContent" @@ -180,11 +252,12 @@ def _get_vertex_url( if stream is True: url += "?alt=sse" elif mode == "embedding": - endpoint = "predict" - url = f"https://{vertex_location}-aiplatform.googleapis.com/v1/projects/{vertex_project}/locations/{vertex_location}/publishers/google/models/{model}:{endpoint}" - if model.isdigit(): - # https://us-central1-aiplatform.googleapis.com/v1/projects/$PROJECT_ID/locations/us-central1/endpoints/$ENDPOINT_ID:predict - url = f"https://{vertex_location}-aiplatform.googleapis.com/{vertex_api_version}/projects/{vertex_project}/locations/{vertex_location}/endpoints/{model}:{endpoint}" + return _get_embedding_url( + model=model, + vertex_project=vertex_project, + vertex_location=vertex_location, + vertex_api_version=vertex_api_version, + ) elif mode == "image_generation": endpoint = "predict" url = f"https://{vertex_location}-aiplatform.googleapis.com/v1/projects/{vertex_project}/locations/{vertex_location}/publishers/google/models/{model}:{endpoint}" @@ -870,4 +943,4 @@ class VertexAITokenCounter(BaseTokenCounter): original_response=result, ) - return None + return None \ No newline at end of file diff --git a/tests/test_litellm/llms/vertex_ai/test_vertex_ai_psc_endpoint_support.py b/tests/test_litellm/llms/vertex_ai/test_vertex_ai_psc_endpoint_support.py index 46f365094c0..c158c93be9d 100644 --- a/tests/test_litellm/llms/vertex_ai/test_vertex_ai_psc_endpoint_support.py +++ b/tests/test_litellm/llms/vertex_ai/test_vertex_ai_psc_endpoint_support.py @@ -5,9 +5,10 @@ Tests that LiteLLM properly constructs URLs when using custom api_base for PSC endpoints. """ -import pytest -import sys import os +import sys + +import pytest # Add the litellm package to the path sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../../../..")) From 46ebf425d56b6369f61188b64e26c8daad87a373 Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Thu, 4 Dec 2025 21:39:42 +0530 Subject: [PATCH 032/178] Fix : test_vertexai_model_garden_model_completion --- litellm/llms/vertex_ai/common_utils.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/litellm/llms/vertex_ai/common_utils.py b/litellm/llms/vertex_ai/common_utils.py index 836234f6f13..c0dfda00abe 100644 --- a/litellm/llms/vertex_ai/common_utils.py +++ b/litellm/llms/vertex_ai/common_utils.py @@ -34,6 +34,7 @@ class VertexAIModelRoute(str, Enum): BGE = "bge" MODEL_GARDEN = "model_garden" NON_GEMINI = "non_gemini" + OPENAI_COMPATIBLE = "openai" VERTEX_AI_MODEL_ROUTES = [f"{route.value}/" for route in VertexAIModelRoute] @@ -179,8 +180,6 @@ def get_vertex_base_model_name(model: str) -> str: """ # Derive routing prefixes from VertexAIModelRoute enum # Map specific routes to their prefixes (some routes like PARTNER_MODELS, GEMINI don't have prefixes) - - for route in VERTEX_AI_MODEL_ROUTES: if model.startswith(route): return model.replace(route, "", 1) From 562afb208d586cdb944a0052dec430a12f2618af Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Thu, 4 Dec 2025 12:30:08 -0800 Subject: [PATCH 033/178] v0 customer usage, pending tests + extras version bump --- .../litellm_proxy_extras/schema.prisma | 28 ++++ litellm/constants.py | 1 + litellm/proxy/_types.py | 2 + litellm/proxy/db/db_spend_update_writer.py | 120 +++++++++++++++++- .../redis_update_buffer.py | 36 ++++++ .../customer_endpoints.py | 80 +++++++++++- litellm/proxy/schema.prisma | 28 ++++ schema.prisma | 28 ++++ 8 files changed, 319 insertions(+), 4 deletions(-) diff --git a/litellm-proxy-extras/litellm_proxy_extras/schema.prisma b/litellm-proxy-extras/litellm_proxy_extras/schema.prisma index 2883dfc4b82..4d4a127f7e8 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/schema.prisma +++ b/litellm-proxy-extras/litellm_proxy_extras/schema.prisma @@ -462,6 +462,34 @@ model LiteLLM_DailyOrganizationSpend { @@index([mcp_namespaced_tool_name]) } +// Track daily end user (customer) spend metrics per model and key +model LiteLLM_DailyEndUserSpend { + id String @id @default(uuid()) + end_user_id String? + date String + api_key String + model String? + model_group String? + custom_llm_provider String? + mcp_namespaced_tool_name String? + prompt_tokens BigInt @default(0) + completion_tokens BigInt @default(0) + cache_read_input_tokens BigInt @default(0) + cache_creation_input_tokens BigInt @default(0) + spend Float @default(0.0) + api_requests BigInt @default(0) + successful_requests BigInt @default(0) + failed_requests BigInt @default(0) + created_at DateTime @default(now()) + updated_at DateTime @updatedAt + @@unique([end_user_id, date, api_key, model, custom_llm_provider, mcp_namespaced_tool_name]) + @@index([date]) + @@index([end_user_id]) + @@index([api_key]) + @@index([model]) + @@index([mcp_namespaced_tool_name]) +} + // Track daily team spend metrics per model and key model LiteLLM_DailyTeamSpend { id String @id @default(uuid()) diff --git a/litellm/constants.py b/litellm/constants.py index fa9f1d527af..ededd35001f 100644 --- a/litellm/constants.py +++ b/litellm/constants.py @@ -149,6 +149,7 @@ REDIS_UPDATE_BUFFER_KEY = "litellm_spend_update_buffer" REDIS_DAILY_SPEND_UPDATE_BUFFER_KEY = "litellm_daily_spend_update_buffer" REDIS_DAILY_TEAM_SPEND_UPDATE_BUFFER_KEY = "litellm_daily_team_spend_update_buffer" REDIS_DAILY_ORG_SPEND_UPDATE_BUFFER_KEY = "litellm_daily_org_spend_update_buffer" +REDIS_DAILY_END_USER_SPEND_UPDATE_BUFFER_KEY = "litellm_daily_end_user_spend_update_buffer" REDIS_DAILY_TAG_SPEND_UPDATE_BUFFER_KEY = "litellm_daily_tag_spend_update_buffer" MAX_REDIS_BUFFER_DEQUEUE_COUNT = int(os.getenv("MAX_REDIS_BUFFER_DEQUEUE_COUNT", 100)) MAX_SIZE_IN_MEMORY_QUEUE = int(os.getenv("MAX_SIZE_IN_MEMORY_QUEUE", 10000)) diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.py index 53a8627bc8f..b8731bd2e55 100644 --- a/litellm/proxy/_types.py +++ b/litellm/proxy/_types.py @@ -3615,6 +3615,8 @@ class DailyOrganizationSpendTransaction(BaseDailySpendTransaction): class DailyUserSpendTransaction(BaseDailySpendTransaction): user_id: str +class DailyEndUserSpendTransaction(BaseDailySpendTransaction): + end_user_id: str class DailyTagSpendTransaction(BaseDailySpendTransaction): request_id: Optional[str] diff --git a/litellm/proxy/db/db_spend_update_writer.py b/litellm/proxy/db/db_spend_update_writer.py index 6c9289e3ff6..715a6ebd25d 100644 --- a/litellm/proxy/db/db_spend_update_writer.py +++ b/litellm/proxy/db/db_spend_update_writer.py @@ -25,6 +25,7 @@ from litellm.proxy._types import ( DailyTagSpendTransaction, DailyOrganizationSpendTransaction, DailyTeamSpendTransaction, + DailyEndUserSpendTransaction, DailyUserSpendTransaction, DBSpendUpdateTransactions, Litellm_EntityType, @@ -65,6 +66,7 @@ class DBSpendUpdateWriter: self.spend_update_queue = SpendUpdateQueue() self.daily_spend_update_queue = DailySpendUpdateQueue() self.daily_team_spend_update_queue = DailySpendUpdateQueue() + self.daily_end_user_spend_update_queue = DailySpendUpdateQueue() self.daily_org_spend_update_queue = DailySpendUpdateQueue() self.daily_tag_spend_update_queue = DailySpendUpdateQueue() @@ -182,6 +184,13 @@ class DBSpendUpdateWriter: ) ) + asyncio.create_task( + self.add_spend_log_transaction_to_daily_end_user_transaction( + payload=payload, + prisma_client=prisma_client, + ) + ) + asyncio.create_task( self.add_spend_log_transaction_to_daily_team_transaction( payload=payload, @@ -475,6 +484,7 @@ class DBSpendUpdateWriter: daily_spend_update_queue=self.daily_spend_update_queue, daily_team_spend_update_queue=self.daily_team_spend_update_queue, daily_org_spend_update_queue=self.daily_org_spend_update_queue, + daily_end_user_spend_update_queue=self.daily_end_user_spend_update_queue, daily_tag_spend_update_queue=self.daily_tag_spend_update_queue, ) @@ -538,6 +548,16 @@ class DBSpendUpdateWriter: proxy_logging_obj=proxy_logging_obj, daily_spend_transactions=daily_tag_spend_update_transactions, ) + daily_end_user_spend_update_transactions = ( + await self.redis_update_buffer.get_all_daily_end_user_spend_update_transactions_from_redis_buffer() + ) + if daily_end_user_spend_update_transactions is not None: + await DBSpendUpdateWriter.update_daily_end_user_spend( + n_retry_times=n_retry_times, + prisma_client=prisma_client, + proxy_logging_obj=proxy_logging_obj, + daily_spend_transactions=daily_end_user_spend_update_transactions, + ) except Exception as e: verbose_proxy_logger.error(f"Error committing spend updates: {e}") finally: @@ -627,6 +647,20 @@ class DBSpendUpdateWriter: daily_spend_transactions=daily_tag_spend_update_transactions, ) + ################## Daily End-User Spend Update Transactions ################## + # Aggregate all in memory daily end-user spend transactions and commit to db + daily_end_user_spend_update_transactions = cast( + Dict[str, DailyEndUserSpendTransaction], + await self.daily_end_user_spend_update_queue.flush_and_get_aggregated_daily_spend_update_transactions(), + ) + + await DBSpendUpdateWriter.update_daily_end_user_spend( + n_retry_times=n_retry_times, + prisma_client=prisma_client, + proxy_logging_obj=proxy_logging_obj, + daily_spend_transactions=daily_end_user_spend_update_transactions, + ) + async def _commit_spend_updates_to_db( # noqa: PLR0915 self, prisma_client: PrismaClient, @@ -990,6 +1024,20 @@ class DBSpendUpdateWriter: ) -> None: ... + @overload + @staticmethod + async def _update_daily_spend( + n_retry_times: int, + prisma_client: PrismaClient, + proxy_logging_obj: ProxyLogging, + daily_spend_transactions: Dict[str, DailyEndUserSpendTransaction], + entity_type: Literal["end_user"], + entity_id_field: str, + table_name: str, + unique_constraint_name: str, + ) -> None: + ... + @overload @staticmethod async def _update_daily_spend( @@ -1015,14 +1063,15 @@ class DBSpendUpdateWriter: Dict[str, DailyTeamSpendTransaction], Dict[str, DailyTagSpendTransaction], Dict[str, DailyOrganizationSpendTransaction], + Dict[str, DailyEndUserSpendTransaction], ], - entity_type: Literal["user", "team", "org", "tag"], + entity_type: Literal["user", "team", "org", "tag", "end_user"], entity_id_field: str, table_name: str, unique_constraint_name: str, ) -> None: """ - Generic function to update daily spend for any entity type (user, team, org, tag) + Generic function to update daily spend for any entity type (user, team, org, tag, end_user) """ from litellm.proxy.utils import _raise_failed_update_spend_exception @@ -1267,6 +1316,27 @@ class DBSpendUpdateWriter: unique_constraint_name="organization_id_date_api_key_model_custom_llm_provider_mcp_namespaced_tool_name", ) + @staticmethod + async def update_daily_end_user_spend( + n_retry_times: int, + prisma_client: PrismaClient, + proxy_logging_obj: ProxyLogging, + daily_spend_transactions: Dict[str, DailyEndUserSpendTransaction], + ): + """ + Batch job to update LiteLLM_DailyEndUserSpend table using in-memory daily_spend_transactions + """ + await DBSpendUpdateWriter._update_daily_spend( + n_retry_times=n_retry_times, + prisma_client=prisma_client, + proxy_logging_obj=proxy_logging_obj, + daily_spend_transactions=daily_spend_transactions, + entity_type="end_user", + entity_id_field="end_user_id", + table_name="litellm_dailyenduserspend", + unique_constraint_name="end_user_id_date_api_key_model_custom_llm_provider_mcp_namespaced_tool_name", + ) + @staticmethod async def update_daily_tag_spend( n_retry_times: int, @@ -1292,7 +1362,7 @@ class DBSpendUpdateWriter: self, payload: Union[dict, SpendLogsPayload], prisma_client: PrismaClient, - type: Literal["user", "team", "org", "request_tags"] = "user", + type: Literal["user", "team", "org", "request_tags", "end_user"] = "user", ) -> Optional[BaseDailySpendTransaction]: common_expected_keys = ["startTime", "api_key"] if type == "user": @@ -1303,6 +1373,8 @@ class DBSpendUpdateWriter: expected_keys = ["organization_id", *common_expected_keys] elif type == "request_tags": expected_keys = ["request_tags", *common_expected_keys] + elif type == "end_user": + expected_keys = ["end_user_id", *common_expected_keys] else: raise ValueError(f"Invalid type: {type}") if not all(key in payload for key in expected_keys): @@ -1474,6 +1546,48 @@ class DBSpendUpdateWriter: update={daily_transaction_key: daily_transaction} ) + async def add_spend_log_transaction_to_daily_end_user_transaction( + self, + payload: SpendLogsPayload, + prisma_client: Optional[PrismaClient] = None, + ) -> None: + if prisma_client is None: + verbose_proxy_logger.debug( + "prisma_client is None. Skipping writing spend logs to db." + ) + return + + end_user_id = payload.get("end_user") + if end_user_id is None or end_user_id == "": + verbose_proxy_logger.debug( + "end_user is None or empty for request. Skipping incrementing end user spend." + ) + return + + payload_with_end_user_id = cast( + SpendLogsPayload, + { + **payload, + "end_user_id": end_user_id, + }, + ) + + base_daily_transaction = ( + await self._common_add_spend_log_transaction_to_daily_transaction( + payload_with_end_user_id, prisma_client, "end_user" + ) + ) + if base_daily_transaction is None: + return + + daily_transaction_key = f"{end_user_id}_{base_daily_transaction['date']}_{payload_with_end_user_id['api_key']}_{payload_with_end_user_id['model']}_{payload_with_end_user_id['custom_llm_provider']}" + daily_transaction = DailyEndUserSpendTransaction( + end_user_id=end_user_id, **base_daily_transaction + ) + await self.daily_end_user_spend_update_queue.add_update( + update={daily_transaction_key: daily_transaction} + ) + async def add_spend_log_transaction_to_daily_tag_transaction( self, payload: SpendLogsPayload, diff --git a/litellm/proxy/db/db_transaction_queue/redis_update_buffer.py b/litellm/proxy/db/db_transaction_queue/redis_update_buffer.py index 921fd9701bd..e3b20d7266d 100644 --- a/litellm/proxy/db/db_transaction_queue/redis_update_buffer.py +++ b/litellm/proxy/db/db_transaction_queue/redis_update_buffer.py @@ -16,6 +16,7 @@ from litellm.constants import ( REDIS_DAILY_TAG_SPEND_UPDATE_BUFFER_KEY, REDIS_DAILY_TEAM_SPEND_UPDATE_BUFFER_KEY, REDIS_DAILY_ORG_SPEND_UPDATE_BUFFER_KEY, + REDIS_DAILY_END_USER_SPEND_UPDATE_BUFFER_KEY, REDIS_UPDATE_BUFFER_KEY, ) from litellm.litellm_core_utils.safe_json_dumps import safe_dumps @@ -24,6 +25,7 @@ from litellm.proxy._types import ( DailyTeamSpendTransaction, DailyUserSpendTransaction, DailyOrganizationSpendTransaction, + DailyEndUserSpendTransaction, DBSpendUpdateTransactions, ) from litellm.proxy.db.db_transaction_queue.base_update_queue import service_logger_obj @@ -107,6 +109,7 @@ class RedisUpdateBuffer: daily_spend_update_queue: DailySpendUpdateQueue, daily_team_spend_update_queue: DailySpendUpdateQueue, daily_org_spend_update_queue: DailySpendUpdateQueue, + daily_end_user_spend_update_queue: DailySpendUpdateQueue, daily_tag_spend_update_queue: DailySpendUpdateQueue, ): """ @@ -172,6 +175,9 @@ class RedisUpdateBuffer: daily_org_spend_update_transactions = ( await daily_org_spend_update_queue.flush_and_get_aggregated_daily_spend_update_transactions() ) + daily_end_user_spend_update_transactions = ( + await daily_end_user_spend_update_queue.flush_and_get_aggregated_daily_spend_update_transactions() + ) daily_tag_spend_update_transactions = ( await daily_tag_spend_update_queue.flush_and_get_aggregated_daily_spend_update_transactions() ) @@ -207,6 +213,12 @@ class RedisUpdateBuffer: service_type=ServiceTypes.REDIS_DAILY_SPEND_UPDATE_QUEUE, ) + await self._store_transactions_in_redis( + transactions=daily_end_user_spend_update_transactions, + redis_key=REDIS_DAILY_END_USER_SPEND_UPDATE_BUFFER_KEY, + service_type=ServiceTypes.REDIS_DAILY_END_USER_SPEND_UPDATE_QUEUE, + ) + await self._store_transactions_in_redis( transactions=daily_tag_spend_update_transactions, redis_key=REDIS_DAILY_TAG_SPEND_UPDATE_BUFFER_KEY, @@ -365,6 +377,30 @@ class RedisUpdateBuffer: ), ) + async def get_all_daily_end_user_spend_update_transactions_from_redis_buffer( + self, + ) -> Optional[Dict[str, DailyEndUserSpendTransaction]]: + """ + Gets all the daily end-user spend update transactions from Redis + """ + if self.redis_cache is None: + return None + list_of_transactions = await self.redis_cache.async_lpop( + key=REDIS_DAILY_END_USER_SPEND_UPDATE_BUFFER_KEY, + count=MAX_REDIS_BUFFER_DEQUEUE_COUNT, + ) + if list_of_transactions is None: + return None + list_of_daily_spend_update_transactions = [ + json.loads(transaction) for transaction in list_of_transactions + ] + return cast( + Dict[str, DailyEndUserSpendTransaction], + DailySpendUpdateQueue.get_aggregated_daily_spend_update_transactions( + list_of_daily_spend_update_transactions + ), + ) + async def get_all_daily_tag_spend_update_transactions_from_redis_buffer( self, ) -> Optional[Dict[str, DailyTagSpendTransaction]]: diff --git a/litellm/proxy/management_endpoints/customer_endpoints.py b/litellm/proxy/management_endpoints/customer_endpoints.py index 3afbbdd5a4b..9ff0fe6e590 100644 --- a/litellm/proxy/management_endpoints/customer_endpoints.py +++ b/litellm/proxy/management_endpoints/customer_endpoints.py @@ -20,6 +20,10 @@ from litellm._logging import verbose_proxy_logger from litellm.proxy._types import * from litellm.proxy.auth.user_api_key_auth import user_api_key_auth from litellm.proxy.utils import handle_exception_on_proxy +from litellm.types.proxy.management_endpoints.common_daily_activity import ( + SpendAnalyticsPaginatedResponse, +) +from litellm.proxy.management_endpoints.common_daily_activity import get_daily_activity router = APIRouter() @@ -673,4 +677,78 @@ async def list_end_user( str(e) ) ) - raise handle_exception_on_proxy(e) \ No newline at end of file + raise handle_exception_on_proxy(e) + +@router.get( + "/customer/daily/activity", + tags=["Customer Management"], + dependencies=[Depends(user_api_key_auth)], + response_model=SpendAnalyticsPaginatedResponse, +) +@router.get( + "/end_user/daily/activity", + tags=["Customer Management"], + include_in_schema=False, + dependencies=[Depends(user_api_key_auth)], +) +async def get_customer_daily_activity( + end_user_ids: Optional[str] = None, + start_date: Optional[str] = None, + end_date: Optional[str] = None, + model: Optional[str] = None, + api_key: Optional[str] = None, + page: int = 1, + page_size: int = 10, + exclude_end_user_ids: Optional[str] = None, + user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth), +): + + """ + Get daily activity for specific organizations or all accessible organizations. + """ + from litellm.proxy.proxy_server import ( + prisma_client, + ) + + if prisma_client is None: + raise HTTPException( + status_code=500, + detail={"error": CommonProxyErrors.db_not_connected_error.value}, + ) + + # Parse comma-separated ids + end_user_ids_list = end_user_ids.split(",") if end_user_ids else None + exclude_end_user_ids_list: Optional[List[str]] = None + if exclude_end_user_ids: + exclude_end_user_ids_list = ( + exclude_end_user_ids.split(",") if exclude_end_user_ids else None + ) + + + # Fetch organization aliases for metadata + where_condition = {} + if end_user_ids_list: + where_condition["user_id"] = {"in": list(end_user_ids_list)} + end_user_aliases = await prisma_client.db.litellm_endusertable.find_many( + where=where_condition + ) + end_user_alias_metadata = { + e.user_id: {"alias": e.alias} + for e in end_user_aliases + } + + # Query daily activity for organizations + return await get_daily_activity( + prisma_client=prisma_client, + table_name="litellm_dailyenduserspend", + entity_id_field="end_user_id", + entity_id=end_user_ids_list, + entity_metadata_field=end_user_alias_metadata, + exclude_entity_ids=exclude_end_user_ids_list, + start_date=start_date, + end_date=end_date, + model=model, + api_key=api_key, + page=page, + page_size=page_size, + ) \ No newline at end of file diff --git a/litellm/proxy/schema.prisma b/litellm/proxy/schema.prisma index 2883dfc4b82..4d4a127f7e8 100644 --- a/litellm/proxy/schema.prisma +++ b/litellm/proxy/schema.prisma @@ -462,6 +462,34 @@ model LiteLLM_DailyOrganizationSpend { @@index([mcp_namespaced_tool_name]) } +// Track daily end user (customer) spend metrics per model and key +model LiteLLM_DailyEndUserSpend { + id String @id @default(uuid()) + end_user_id String? + date String + api_key String + model String? + model_group String? + custom_llm_provider String? + mcp_namespaced_tool_name String? + prompt_tokens BigInt @default(0) + completion_tokens BigInt @default(0) + cache_read_input_tokens BigInt @default(0) + cache_creation_input_tokens BigInt @default(0) + spend Float @default(0.0) + api_requests BigInt @default(0) + successful_requests BigInt @default(0) + failed_requests BigInt @default(0) + created_at DateTime @default(now()) + updated_at DateTime @updatedAt + @@unique([end_user_id, date, api_key, model, custom_llm_provider, mcp_namespaced_tool_name]) + @@index([date]) + @@index([end_user_id]) + @@index([api_key]) + @@index([model]) + @@index([mcp_namespaced_tool_name]) +} + // Track daily team spend metrics per model and key model LiteLLM_DailyTeamSpend { id String @id @default(uuid()) diff --git a/schema.prisma b/schema.prisma index 2883dfc4b82..4d4a127f7e8 100644 --- a/schema.prisma +++ b/schema.prisma @@ -462,6 +462,34 @@ model LiteLLM_DailyOrganizationSpend { @@index([mcp_namespaced_tool_name]) } +// Track daily end user (customer) spend metrics per model and key +model LiteLLM_DailyEndUserSpend { + id String @id @default(uuid()) + end_user_id String? + date String + api_key String + model String? + model_group String? + custom_llm_provider String? + mcp_namespaced_tool_name String? + prompt_tokens BigInt @default(0) + completion_tokens BigInt @default(0) + cache_read_input_tokens BigInt @default(0) + cache_creation_input_tokens BigInt @default(0) + spend Float @default(0.0) + api_requests BigInt @default(0) + successful_requests BigInt @default(0) + failed_requests BigInt @default(0) + created_at DateTime @default(now()) + updated_at DateTime @updatedAt + @@unique([end_user_id, date, api_key, model, custom_llm_provider, mcp_namespaced_tool_name]) + @@index([date]) + @@index([end_user_id]) + @@index([api_key]) + @@index([model]) + @@index([mcp_namespaced_tool_name]) +} + // Track daily team spend metrics per model and key model LiteLLM_DailyTeamSpend { id String @id @default(uuid()) From 2e65c464ade1a0dd5e86a2902f2e2fe1b01f1168 Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Thu, 4 Dec 2025 12:36:15 -0800 Subject: [PATCH 034/178] Adding tests --- .../proxy/db/test_db_spend_update_writer.py | 75 +++++++++++++- .../test_customer_endpoints.py | 98 ++++++++++++++++++- 2 files changed, 171 insertions(+), 2 deletions(-) diff --git a/tests/test_litellm/proxy/db/test_db_spend_update_writer.py b/tests/test_litellm/proxy/db/test_db_spend_update_writer.py index 181d21b44f6..db6c318357c 100644 --- a/tests/test_litellm/proxy/db/test_db_spend_update_writer.py +++ b/tests/test_litellm/proxy/db/test_db_spend_update_writer.py @@ -572,4 +572,77 @@ async def test_add_spend_log_transaction_to_daily_org_transaction_skips_when_org org_id=None, ) - writer.daily_org_spend_update_queue.add_update.assert_not_called() \ No newline at end of file + writer.daily_org_spend_update_queue.add_update.assert_not_called() + + +@pytest.mark.asyncio +async def test_add_spend_log_transaction_to_daily_end_user_transaction_injects_end_user_id_and_queues_update(): + writer = DBSpendUpdateWriter() + mock_prisma = MagicMock() + mock_prisma.get_request_status = MagicMock(return_value="success") + + end_user_id = "end-user-xyz" + payload = { + "request_id": "req-1", + "user": "test-user", + "end_user": end_user_id, + "startTime": "2024-01-01T12:00:00", + "api_key": "test-key", + "model": "gpt-4", + "custom_llm_provider": "openai", + "model_group": "gpt-4-group", + "prompt_tokens": 10, + "completion_tokens": 5, + "spend": 0.2, + "metadata": '{"usage_object": {}}', + } + + writer.daily_end_user_spend_update_queue.add_update = AsyncMock() + + await writer.add_spend_log_transaction_to_daily_end_user_transaction( + payload=payload, + prisma_client=mock_prisma, + ) + + writer.daily_end_user_spend_update_queue.add_update.assert_called_once() + + call_args = writer.daily_end_user_spend_update_queue.add_update.call_args[1] + update_dict = call_args["update"] + assert len(update_dict) == 1 + for key, transaction in update_dict.items(): + assert key == f"{end_user_id}_2024-01-01_test-key_gpt-4_openai" + assert transaction["end_user_id"] == end_user_id + assert transaction["date"] == "2024-01-01" + assert transaction["api_key"] == "test-key" + assert transaction["model"] == "gpt-4" + assert transaction["custom_llm_provider"] == "openai" + + +@pytest.mark.asyncio +async def test_add_spend_log_transaction_to_daily_end_user_transaction_skips_when_end_user_id_missing(): + writer = DBSpendUpdateWriter() + mock_prisma = MagicMock() + mock_prisma.get_request_status = MagicMock(return_value="success") + + payload = { + "request_id": "req-2", + "user": "test-user", + "startTime": "2024-01-01T12:00:00", + "api_key": "test-key", + "model": "gpt-4", + "custom_llm_provider": "openai", + "model_group": "gpt-4-group", + "prompt_tokens": 10, + "completion_tokens": 5, + "spend": 0.2, + "metadata": '{"usage_object": {}}', + } + + writer.daily_end_user_spend_update_queue.add_update = AsyncMock() + + await writer.add_spend_log_transaction_to_daily_end_user_transaction( + payload=payload, + prisma_client=mock_prisma, + ) + + writer.daily_end_user_spend_update_queue.add_update.assert_not_called() \ No newline at end of file diff --git a/tests/test_litellm/proxy/management_endpoints/test_customer_endpoints.py b/tests/test_litellm/proxy/management_endpoints/test_customer_endpoints.py index 86a6ceec25e..25ff6f89427 100644 --- a/tests/test_litellm/proxy/management_endpoints/test_customer_endpoints.py +++ b/tests/test_litellm/proxy/management_endpoints/test_customer_endpoints.py @@ -1,4 +1,4 @@ -from unittest.mock import AsyncMock, patch +from unittest.mock import AsyncMock, MagicMock, patch import pytest from fastapi import FastAPI, HTTPException, Request, status @@ -301,3 +301,99 @@ def test_customer_endpoints_error_schema_consistency(mock_prisma_client, mock_us for key in ["message", "type", "code"]: assert isinstance(error1[key], str), f"error1[{key}] should be a string" assert isinstance(error2[key], str), f"error2[{key}] should be a string" + + +@pytest.mark.asyncio +async def test_get_customer_daily_activity_admin_param_passing(monkeypatch): + from litellm.proxy._types import LitellmUserRoles, UserAPIKeyAuth + from litellm.proxy.management_endpoints import customer_endpoints + from litellm.proxy.management_endpoints.customer_endpoints import ( + get_customer_daily_activity, + ) + + mock_prisma_client = AsyncMock() + mock_prisma_client.db.litellm_endusertable.find_many = AsyncMock( + return_value=[] + ) + monkeypatch.setattr("litellm.proxy.proxy_server.prisma_client", mock_prisma_client) + + mocked_response = MagicMock(name="SpendAnalyticsPaginatedResponse") + get_daily_activity_mock = AsyncMock(return_value=mocked_response) + monkeypatch.setattr( + customer_endpoints, "get_daily_activity", get_daily_activity_mock + ) + + auth = UserAPIKeyAuth(user_role=LitellmUserRoles.PROXY_ADMIN, user_id="admin1") + result = await get_customer_daily_activity( + end_user_ids="end-user-1,end-user-2", + start_date="2024-01-01", + end_date="2024-01-31", + model="gpt-4", + api_key="test-key", + page=2, + page_size=5, + exclude_end_user_ids="end-user-3", + user_api_key_dict=auth, + ) + + get_daily_activity_mock.assert_awaited_once() + kwargs = get_daily_activity_mock.call_args.kwargs + assert kwargs["table_name"] == "litellm_dailyenduserspend" + assert kwargs["entity_id_field"] == "end_user_id" + assert kwargs["entity_id"] == ["end-user-1", "end-user-2"] + assert kwargs["exclude_entity_ids"] == ["end-user-3"] + assert kwargs["start_date"] == "2024-01-01" + assert kwargs["end_date"] == "2024-01-31" + assert kwargs["model"] == "gpt-4" + assert kwargs["api_key"] == "test-key" + assert kwargs["page"] == 2 + assert kwargs["page_size"] == 5 + + assert result is mocked_response + + +@pytest.mark.asyncio +async def test_get_customer_daily_activity_with_end_user_aliases(monkeypatch): + from litellm.proxy._types import LitellmUserRoles, UserAPIKeyAuth + from litellm.proxy.management_endpoints import customer_endpoints + from litellm.proxy.management_endpoints.customer_endpoints import ( + get_customer_daily_activity, + ) + + mock_prisma_client = AsyncMock() + mock_end_user1 = MagicMock() + mock_end_user1.user_id = "end-user-1" + mock_end_user1.alias = "Customer One" + mock_end_user2 = MagicMock() + mock_end_user2.user_id = "end-user-2" + mock_end_user2.alias = "Customer Two" + + mock_prisma_client.db.litellm_endusertable.find_many = AsyncMock( + return_value=[mock_end_user1, mock_end_user2] + ) + monkeypatch.setattr("litellm.proxy.proxy_server.prisma_client", mock_prisma_client) + + mocked_response = MagicMock(name="SpendAnalyticsPaginatedResponse") + get_daily_activity_mock = AsyncMock(return_value=mocked_response) + monkeypatch.setattr( + customer_endpoints, "get_daily_activity", get_daily_activity_mock + ) + + auth = UserAPIKeyAuth(user_role=LitellmUserRoles.PROXY_ADMIN, user_id="admin1") + await get_customer_daily_activity( + end_user_ids="end-user-1,end-user-2", + start_date="2024-01-01", + end_date="2024-01-31", + model=None, + api_key=None, + page=1, + page_size=10, + exclude_end_user_ids=None, + user_api_key_dict=auth, + ) + + kwargs = get_daily_activity_mock.call_args.kwargs + assert kwargs["entity_metadata_field"] == { + "end-user-1": {"alias": "Customer One"}, + "end-user-2": {"alias": "Customer Two"}, + } From 5439f03bfcb74175633cf57a3d9b75af3854fbd6 Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Thu, 4 Dec 2025 12:56:43 -0800 Subject: [PATCH 035/178] =?UTF-8?q?bump:=20version=200.4.9=20=E2=86=92=200?= =?UTF-8?q?.4.10?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- litellm-proxy-extras/pyproject.toml | 4 ++-- pyproject.toml | 2 +- requirements.txt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/litellm-proxy-extras/pyproject.toml b/litellm-proxy-extras/pyproject.toml index 6bc576e4f3d..cc8a92b9c67 100644 --- a/litellm-proxy-extras/pyproject.toml +++ b/litellm-proxy-extras/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "litellm-proxy-extras" -version = "0.4.9" +version = "0.4.10" description = "Additional files for the LiteLLM Proxy. Reduces the size of the main litellm package." authors = ["BerriAI"] readme = "README.md" @@ -22,7 +22,7 @@ requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" [tool.commitizen] -version = "0.4.9" +version = "0.4.10" version_files = [ "pyproject.toml:version", "../requirements.txt:litellm-proxy-extras==", diff --git a/pyproject.toml b/pyproject.toml index 81e31a5ea81..da31bc9d8ac 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -59,7 +59,7 @@ websockets = {version = "^15.0.1", optional = true} boto3 = {version = "1.36.0", optional = true} redisvl = {version = "^0.4.1", optional = true, markers = "python_version >= '3.9' and python_version < '3.14'"} mcp = {version = "^1.21.2", optional = true, python = ">=3.10"} -litellm-proxy-extras = {version = "0.4.9", optional = true} +litellm-proxy-extras = {version = "0.4.10", optional = true} rich = {version = "13.7.1", optional = true} litellm-enterprise = {version = "0.1.22", optional = true} diskcache = {version = "^5.6.1", optional = true} diff --git a/requirements.txt b/requirements.txt index b61428588d7..ac1eba2f4c4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -44,7 +44,7 @@ sentry_sdk==2.21.0 # for sentry error handling detect-secrets==1.5.0 # Enterprise - secret detection / masking in LLM requests cryptography==44.0.1 tzdata==2025.1 # IANA time zone database -litellm-proxy-extras==0.4.9 # for proxy extras - e.g. prisma migrations +litellm-proxy-extras==0.4.10 # for proxy extras - e.g. prisma migrations ### LITELLM PACKAGE DEPENDENCIES python-dotenv==1.0.1 # for env tiktoken==0.8.0 # for calculating usage From 183437795042392776c3ef6e8c798cfeafebb9c7 Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Thu, 4 Dec 2025 12:57:06 -0800 Subject: [PATCH 036/178] Adding migration --- .../migration.sql | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 litellm-proxy-extras/litellm_proxy_extras/migrations/20251204124859_add_end_user_spend_table/migration.sql diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251204124859_add_end_user_spend_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251204124859_add_end_user_spend_table/migration.sql new file mode 100644 index 00000000000..c4234785c54 --- /dev/null +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251204124859_add_end_user_spend_table/migration.sql @@ -0,0 +1,42 @@ +-- CreateTable +CREATE TABLE "LiteLLM_DailyEndUserSpend" ( + "id" TEXT NOT NULL, + "end_user_id" TEXT, + "date" TEXT NOT NULL, + "api_key" TEXT NOT NULL, + "model" TEXT, + "model_group" TEXT, + "custom_llm_provider" TEXT, + "mcp_namespaced_tool_name" TEXT, + "prompt_tokens" BIGINT NOT NULL DEFAULT 0, + "completion_tokens" BIGINT NOT NULL DEFAULT 0, + "cache_read_input_tokens" BIGINT NOT NULL DEFAULT 0, + "cache_creation_input_tokens" BIGINT NOT NULL DEFAULT 0, + "spend" DOUBLE PRECISION NOT NULL DEFAULT 0.0, + "api_requests" BIGINT NOT NULL DEFAULT 0, + "successful_requests" BIGINT NOT NULL DEFAULT 0, + "failed_requests" BIGINT NOT NULL DEFAULT 0, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "LiteLLM_DailyEndUserSpend_pkey" PRIMARY KEY ("id") +); + +-- CreateIndex +CREATE INDEX "LiteLLM_DailyEndUserSpend_date_idx" ON "LiteLLM_DailyEndUserSpend"("date"); + +-- CreateIndex +CREATE INDEX "LiteLLM_DailyEndUserSpend_end_user_id_idx" ON "LiteLLM_DailyEndUserSpend"("end_user_id"); + +-- CreateIndex +CREATE INDEX "LiteLLM_DailyEndUserSpend_api_key_idx" ON "LiteLLM_DailyEndUserSpend"("api_key"); + +-- CreateIndex +CREATE INDEX "LiteLLM_DailyEndUserSpend_model_idx" ON "LiteLLM_DailyEndUserSpend"("model"); + +-- CreateIndex +CREATE INDEX "LiteLLM_DailyEndUserSpend_mcp_namespaced_tool_name_idx" ON "LiteLLM_DailyEndUserSpend"("mcp_namespaced_tool_name"); + +-- CreateIndex +CREATE UNIQUE INDEX "LiteLLM_DailyEndUserSpend_end_user_id_date_api_key_model_cu_key" ON "LiteLLM_DailyEndUserSpend"("end_user_id", "date", "api_key", "model", "custom_llm_provider", "mcp_namespaced_tool_name"); + From b12ccb1a7acb21567f46e3b149651bf13fb6502a Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Thu, 4 Dec 2025 13:11:20 -0800 Subject: [PATCH 037/178] Publish proxy extras --- ...litellm_proxy_extras-0.4.10-py3-none-any.whl | Bin 0 -> 40415 bytes .../dist/litellm_proxy_extras-0.4.10.tar.gz | Bin 0 -> 18851 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 litellm-proxy-extras/dist/litellm_proxy_extras-0.4.10-py3-none-any.whl create mode 100644 litellm-proxy-extras/dist/litellm_proxy_extras-0.4.10.tar.gz diff --git a/litellm-proxy-extras/dist/litellm_proxy_extras-0.4.10-py3-none-any.whl b/litellm-proxy-extras/dist/litellm_proxy_extras-0.4.10-py3-none-any.whl new file mode 100644 index 0000000000000000000000000000000000000000..ce4e805663a67d925d8007a8a098125eb98a0cf7 GIT binary patch literal 40415 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 literal 0 HcmV?d00001 diff --git a/litellm-proxy-extras/dist/litellm_proxy_extras-0.4.10.tar.gz b/litellm-proxy-extras/dist/litellm_proxy_extras-0.4.10.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..a4e218ee2fac4ef1cd3ebbeddd774e5596707a85 GIT binary patch literal 18851 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 YOr;N3pXyV69?s|g10(g}%mDZT0IGmedjJ3c literal 0 HcmV?d00001 From 5a2e89a49ef3b104f55412956a7b8a74a0bbdee8 Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Thu, 4 Dec 2025 15:13:17 -0800 Subject: [PATCH 038/178] Customer Usage UI --- .../hooks/customers/useCustomers.ts | 41 +++++++++++++++++ .../EntityUsageExport/ExportTypeSelector.tsx | 4 +- .../EntityUsageExport/UsageExportHeader.tsx | 2 +- .../src/components/EntityUsageExport/types.ts | 3 +- .../src/components/EntityUsageExport/utils.ts | 8 ++-- .../src/components/entity_usage.test.tsx | 19 ++++++++ .../src/components/entity_usage.tsx | 19 +++++++- .../src/components/networking.tsx | 21 ++++++++- .../src/components/new_usage.test.tsx | 46 +++++++++++++++++++ .../src/components/new_usage.tsx | 22 ++++++++- 10 files changed, 173 insertions(+), 12 deletions(-) create mode 100644 ui/litellm-dashboard/src/app/(dashboard)/hooks/customers/useCustomers.ts diff --git a/ui/litellm-dashboard/src/app/(dashboard)/hooks/customers/useCustomers.ts b/ui/litellm-dashboard/src/app/(dashboard)/hooks/customers/useCustomers.ts new file mode 100644 index 00000000000..10cbedc04d3 --- /dev/null +++ b/ui/litellm-dashboard/src/app/(dashboard)/hooks/customers/useCustomers.ts @@ -0,0 +1,41 @@ +import { allEndUsersCall } from "@/components/networking"; +import { useQuery } from "@tanstack/react-query"; +import { createQueryKeys } from "../common/queryKeysFactory"; +import { all_admin_roles } from "@/utils/roles"; + +const customersKeys = createQueryKeys("customers"); + +export interface Customer { + user_id: string; + alias?: string | null; + spend: number; + blocked: boolean; + allowed_model_region?: string | null; + default_model?: string | null; + budget_id?: string | null; + litellm_budget_table?: { + budget_id: string; + max_budget?: number | null; + soft_budget?: number | null; + max_parallel_requests?: number | null; + tpm_limit?: number | null; + rpm_limit?: number | null; + model_max_budget?: Record | null; + budget_duration?: string | null; + budget_reset_at?: string | null; + created_at: string; + created_by: string; + updated_at: string; + updated_by: string; + } | null; +} + +export type CustomersResponse = Customer[]; + +export const useCustomers = (accessToken: string | null, userRole: string | null) => { + return useQuery({ + queryKey: customersKeys.list({}), + queryFn: async () => await allEndUsersCall(accessToken!), + enabled: Boolean(accessToken) && all_admin_roles.includes(userRole || ""), + }); +}; diff --git a/ui/litellm-dashboard/src/components/EntityUsageExport/ExportTypeSelector.tsx b/ui/litellm-dashboard/src/components/EntityUsageExport/ExportTypeSelector.tsx index 43e6f986dfb..17a833deacb 100644 --- a/ui/litellm-dashboard/src/components/EntityUsageExport/ExportTypeSelector.tsx +++ b/ui/litellm-dashboard/src/components/EntityUsageExport/ExportTypeSelector.tsx @@ -1,11 +1,11 @@ import React from "react"; import { Radio } from "antd"; -import type { ExportScope } from "./types"; +import type { ExportScope, EntityType } from "./types"; interface ExportTypeSelectorProps { value: ExportScope; onChange: (value: ExportScope) => void; - entityType: "tag" | "team" | "organization"; + entityType: EntityType; } const ExportTypeSelector: React.FC = ({ value, onChange, entityType }) => { diff --git a/ui/litellm-dashboard/src/components/EntityUsageExport/UsageExportHeader.tsx b/ui/litellm-dashboard/src/components/EntityUsageExport/UsageExportHeader.tsx index 3547d65379e..e326183d880 100644 --- a/ui/litellm-dashboard/src/components/EntityUsageExport/UsageExportHeader.tsx +++ b/ui/litellm-dashboard/src/components/EntityUsageExport/UsageExportHeader.tsx @@ -7,7 +7,7 @@ import type { EntitySpendData } from "./types"; interface UsageExportHeaderProps { dateValue: DateRangePickerValue; - entityType: "tag" | "team" | "organization"; + entityType: "tag" | "team" | "organization" | "customer"; spendData: EntitySpendData; // Optional filter props showFilters?: boolean; diff --git a/ui/litellm-dashboard/src/components/EntityUsageExport/types.ts b/ui/litellm-dashboard/src/components/EntityUsageExport/types.ts index ea11701f7ee..ded2731c945 100644 --- a/ui/litellm-dashboard/src/components/EntityUsageExport/types.ts +++ b/ui/litellm-dashboard/src/components/EntityUsageExport/types.ts @@ -2,6 +2,7 @@ import type { DateRangePickerValue } from "@tremor/react"; export type ExportFormat = "csv" | "json"; export type ExportScope = "daily" | "daily_with_models"; +export type EntityType = "tag" | "team" | "organization" | "customer"; export interface EntitySpendData { results: any[]; @@ -17,7 +18,7 @@ export interface EntitySpendData { export interface EntityUsageExportModalProps { isOpen: boolean; onClose: () => void; - entityType: "tag" | "team" | "organization"; + entityType: EntityType; spendData: EntitySpendData; dateRange: DateRangePickerValue; selectedFilters: string[]; diff --git a/ui/litellm-dashboard/src/components/EntityUsageExport/utils.ts b/ui/litellm-dashboard/src/components/EntityUsageExport/utils.ts index 1327e158a6e..c93155feb23 100644 --- a/ui/litellm-dashboard/src/components/EntityUsageExport/utils.ts +++ b/ui/litellm-dashboard/src/components/EntityUsageExport/utils.ts @@ -1,6 +1,6 @@ import { formatNumberWithCommas } from "@/utils/dataUtils"; import Papa from "papaparse"; -import type { EntitySpendData, EntityBreakdown, ExportMetadata, ExportScope } from "./types"; +import type { EntitySpendData, EntityBreakdown, ExportMetadata, ExportScope, EntityType } from "./types"; import type { DateRangePickerValue } from "@tremor/react"; export const getEntityBreakdown = (spendData: EntitySpendData): EntityBreakdown[] => { @@ -139,7 +139,7 @@ export const generateExportData = ( }; export const generateMetadata = ( - entityType: "tag" | "team" | "organization", + entityType: EntityType, dateRange: DateRangePickerValue, selectedFilters: string[], exportScope: ExportScope, @@ -166,7 +166,7 @@ export const handleExportCSV = ( spendData: EntitySpendData, exportScope: ExportScope, entityLabel: string, - entityType: "tag" | "team" | "organization", + entityType: EntityType, ): void => { const data = generateExportData(spendData, exportScope, entityLabel); const csv = Papa.unparse(data); @@ -186,7 +186,7 @@ export const handleExportJSON = ( spendData: EntitySpendData, exportScope: ExportScope, entityLabel: string, - entityType: "tag" | "team" | "organization", + entityType: EntityType, dateRange: DateRangePickerValue, selectedFilters: string[], ): void => { diff --git a/ui/litellm-dashboard/src/components/entity_usage.test.tsx b/ui/litellm-dashboard/src/components/entity_usage.test.tsx index 17016b6479d..2c070427ead 100644 --- a/ui/litellm-dashboard/src/components/entity_usage.test.tsx +++ b/ui/litellm-dashboard/src/components/entity_usage.test.tsx @@ -18,6 +18,7 @@ vi.mock("./networking", () => ({ tagDailyActivityCall: vi.fn(), teamDailyActivityCall: vi.fn(), organizationDailyActivityCall: vi.fn(), + customerDailyActivityCall: vi.fn(), })); // Mock the child components to simplify testing @@ -42,6 +43,7 @@ describe("EntityUsage", () => { const mockTagDailyActivityCall = vi.mocked(networking.tagDailyActivityCall); const mockTeamDailyActivityCall = vi.mocked(networking.teamDailyActivityCall); const mockOrganizationDailyActivityCall = vi.mocked(networking.organizationDailyActivityCall); + const mockCustomerDailyActivityCall = vi.mocked(networking.customerDailyActivityCall); const mockSpendData = { results: [ @@ -128,9 +130,11 @@ describe("EntityUsage", () => { mockTagDailyActivityCall.mockClear(); mockTeamDailyActivityCall.mockClear(); mockOrganizationDailyActivityCall.mockClear(); + mockCustomerDailyActivityCall.mockClear(); mockTagDailyActivityCall.mockResolvedValue(mockSpendData); mockTeamDailyActivityCall.mockResolvedValue(mockSpendData); mockOrganizationDailyActivityCall.mockResolvedValue(mockSpendData); + mockCustomerDailyActivityCall.mockResolvedValue(mockSpendData); }); it("should render with tag entity type and display spend metrics", async () => { @@ -182,6 +186,21 @@ describe("EntityUsage", () => { }); }); + it("should render with customer entity type and call customer API", async () => { + render(); + + await waitFor(() => { + expect(mockCustomerDailyActivityCall).toHaveBeenCalled(); + }); + + expect(screen.getByText("Customer Spend Overview")).toBeInTheDocument(); + + await waitFor(() => { + const spendElements = screen.getAllByText("$100.50"); + expect(spendElements.length).toBeGreaterThan(0); + }); + }); + it("should switch between tabs", async () => { render(); diff --git a/ui/litellm-dashboard/src/components/entity_usage.tsx b/ui/litellm-dashboard/src/components/entity_usage.tsx index 501eac7124b..ca30ded9494 100644 --- a/ui/litellm-dashboard/src/components/entity_usage.tsx +++ b/ui/litellm-dashboard/src/components/entity_usage.tsx @@ -23,12 +23,18 @@ import { } from "@tremor/react"; import { ActivityMetrics, processActivityData } from "./activity_metrics"; import { DailyData, BreakdownMetrics, KeyMetricWithMetadata, EntityMetricWithMetadata, TagUsage } from "./usage/types"; -import { organizationDailyActivityCall, tagDailyActivityCall, teamDailyActivityCall } from "./networking"; +import { + organizationDailyActivityCall, + tagDailyActivityCall, + teamDailyActivityCall, + customerDailyActivityCall, +} from "./networking"; import TopKeyView from "./top_key_view"; import { formatNumberWithCommas } from "@/utils/dataUtils"; import { valueFormatterSpend } from "./usage/utils/value_formatters"; import { getProviderLogoAndName } from "./provider_info_helpers"; import { UsageExportHeader } from "./EntityUsageExport"; +import type { EntityType } from "./EntityUsageExport/types"; import TopModelView from "./top_model_view"; interface EntityMetrics { @@ -68,7 +74,7 @@ export interface EntityList { interface EntityUsageProps { accessToken: string | null; - entityType: "tag" | "team" | "organization"; + entityType: EntityType; entityId?: string | null; userID: string | null; userRole: string | null; @@ -135,6 +141,15 @@ const EntityUsage: React.FC = ({ selectedTags.length > 0 ? selectedTags : null, ); setSpendData(data); + } else if (entityType === "customer") { + const data = await customerDailyActivityCall( + accessToken, + startTime, + endTime, + 1, + selectedTags.length > 0 ? selectedTags : null, + ); + setSpendData(data); } else { throw new Error("Invalid entity type"); } diff --git a/ui/litellm-dashboard/src/components/networking.tsx b/ui/litellm-dashboard/src/components/networking.tsx index 0e45c0f3a91..4582a8a8e1d 100644 --- a/ui/litellm-dashboard/src/components/networking.tsx +++ b/ui/litellm-dashboard/src/components/networking.tsx @@ -1736,6 +1736,25 @@ export const organizationDailyActivityCall = async ( }); }; +export const customerDailyActivityCall = async ( + accessToken: string, + startTime: Date, + endTime: Date, + page: number = 1, + customerIds: string[] | null = null, +) => { + return fetchDailyActivity({ + accessToken, + endpoint: "/customer/daily/activity", + startTime, + endTime, + page, + extraQueryParams: { + end_user_ids: customerIds, + }, + }); +}; + export const getTotalSpendCall = async (accessToken: string) => { /** * Get all models on proxy @@ -2511,7 +2530,7 @@ export const allEndUsersCall = async (accessToken: string) => { console.log(data); return data; } catch (error) { - console.error("Failed to create key:", error); + console.error("Failed to fetch end users:", error); throw error; } }; diff --git a/ui/litellm-dashboard/src/components/new_usage.test.tsx b/ui/litellm-dashboard/src/components/new_usage.test.tsx index a06045137d7..aec07765e7e 100644 --- a/ui/litellm-dashboard/src/components/new_usage.test.tsx +++ b/ui/litellm-dashboard/src/components/new_usage.test.tsx @@ -3,6 +3,7 @@ import { describe, it, expect, vi, beforeEach, beforeAll } from "vitest"; import NewUsagePage from "./new_usage"; import type { Organization } from "./networking"; import * as networking from "./networking"; +import { useCustomers } from "@/app/(dashboard)/hooks/customers/useCustomers"; // Polyfill ResizeObserver for test environment beforeAll(() => { @@ -53,9 +54,14 @@ vi.mock("./EntityUsageExport", () => ({ default: () =>
Entity Usage Export Modal
, })); +vi.mock("@/app/(dashboard)/hooks/customers/useCustomers", () => ({ + useCustomers: vi.fn(), +})); + describe("NewUsage", () => { const mockUserDailyActivityAggregatedCall = vi.mocked(networking.userDailyActivityAggregatedCall); const mockTagListCall = vi.mocked(networking.tagListCall); + const mockUseCustomers = vi.mocked(useCustomers); const mockSpendData = { results: [ @@ -174,6 +180,19 @@ describe("NewUsage", () => { }, ]; + const mockCustomers = [ + { + user_id: "customer-123", + alias: "Test Customer", + spend: 0, + blocked: false, + allowed_model_region: null, + default_model: null, + budget_id: null, + litellm_budget_table: null, + }, + ]; + const defaultProps = { accessToken: "test-token", userRole: "Admin", @@ -205,6 +224,11 @@ describe("NewUsage", () => { mockTagListCall.mockClear(); mockUserDailyActivityAggregatedCall.mockResolvedValue(mockSpendData); mockTagListCall.mockResolvedValue({}); + mockUseCustomers.mockReturnValue({ + data: [], + isLoading: false, + error: null, + } as any); }); it("should render and fetch usage data on mount", async () => { @@ -289,4 +313,26 @@ describe("NewUsage", () => { expect(entityUsageElements.length).toBeGreaterThan(0); }); }); + + it("should show customer usage tab for admins", async () => { + mockUseCustomers.mockReturnValue({ + data: mockCustomers, + isLoading: false, + error: null, + } as any); + + const { getByText, getAllByText } = render(); + + await waitFor(() => { + expect(mockUserDailyActivityAggregatedCall).toHaveBeenCalled(); + }); + + const customerTab = getByText("Customer Usage"); + fireEvent.click(customerTab); + + await waitFor(() => { + const entityUsageElements = getAllByText("Entity Usage"); + expect(entityUsageElements.length).toBeGreaterThan(0); + }); + }); }); diff --git a/ui/litellm-dashboard/src/components/new_usage.tsx b/ui/litellm-dashboard/src/components/new_usage.tsx index a8d30885493..f9280ae2bf2 100644 --- a/ui/litellm-dashboard/src/components/new_usage.tsx +++ b/ui/litellm-dashboard/src/components/new_usage.tsx @@ -27,9 +27,10 @@ import { Text, Title, } from "@tremor/react"; -import React, { useCallback, useEffect, useMemo, useState } from "react"; import { Alert } from "antd"; +import React, { useCallback, useEffect, useMemo, useState } from "react"; +import { useCustomers } from "@/app/(dashboard)/hooks/customers/useCustomers"; import { formatNumberWithCommas } from "@/utils/dataUtils"; import { Button } from "@tremor/react"; import { all_admin_roles } from "../utils/roles"; @@ -86,6 +87,7 @@ const NewUsagePage: React.FC = ({ }); const [allTags, setAllTags] = useState([]); + const { data: customers = [] } = useCustomers(accessToken, userRole); const [modelViewType, setModelViewType] = useState<"groups" | "individual">("groups"); const [isCloudZeroModalOpen, setIsCloudZeroModalOpen] = useState(false); const [isGlobalExportModalOpen, setIsGlobalExportModalOpen] = useState(false); @@ -430,6 +432,7 @@ const NewUsagePage: React.FC = ({ Your Organization Usage )} Team Usage + {all_admin_roles.includes(userRole || "") ? Customer Usage : <>} {all_admin_roles.includes(userRole || "") ? Tag Usage : <>} {all_admin_roles.includes(userRole || "") ? User Agent Activity : <>} @@ -798,6 +801,23 @@ const NewUsagePage: React.FC = ({ /> + {/* Customer Usage Panel */} + + ({ + label: customer.alias || customer.user_id, + value: customer.user_id, + })) || null + } + premiumUser={premiumUser} + dateValue={dateValue} + /> + {/* Tag Usage Panel */} Date: Thu, 4 Dec 2025 16:34:59 -0800 Subject: [PATCH 039/178] UI new build --- .../_buildManifest.js | 0 .../_ssgManifest.js | 0 .../out/_next/static/chunks/1200-72b27753cc974b47.js | 1 + .../out/_next/static/chunks/1301-739c2d4a8ce60896.js | 1 + .../{1518-4475f8385da5ac78.js => 1518-af5eabc2040f5a96.js} | 2 +- .../out/_next/static/chunks/1529-59ce29afdf8ccc9b.js | 1 - .../{1602-dda1d35341543457.js => 1602-158ea5a27f7c5d7c.js} | 0 .../out/_next/static/chunks/1623-995fddc2b5647961.js | 1 - .../out/_next/static/chunks/1674-de8248fbd0c554ba.js | 1 - .../out/_next/static/chunks/1713-ce16d8a0e658a15d.js | 1 + .../{1739-23e7361486c2cc74.js => 1739-1616f1e28b151332.js} | 2 +- .../out/_next/static/chunks/1971-00859360d0630018.js | 1 + .../out/_next/static/chunks/1973-26a414084f96c69b.js | 1 - .../{2004-294ce010a90069b4.js => 2004-1eb16c345c0044ae.js} | 2 +- .../out/_next/static/chunks/2012-c09fa25a9cbf6028.js | 1 - .../out/_next/static/chunks/2012-dcbd62e829c6106f.js | 1 + .../out/_next/static/chunks/2106-df512fb0bae97b5c.js | 1 - .../out/_next/static/chunks/2202-75f4ebfcb55c7701.js | 1 - .../out/_next/static/chunks/2202-859c1cb8c2214ee1.js | 1 + .../out/_next/static/chunks/2249-01a36f26b1cecba3.js | 1 - .../out/_next/static/chunks/2249-3be1a049d707c166.js | 1 + .../{2273-d8bd63b2792d0fd2.js => 2273-c902438b7579c117.js} | 0 .../{2377-674bd40044d10e16.js => 2377-7121736141e67af2.js} | 0 .../{2409-e94c05c6f11bb939.js => 2409-79fdc0573d81b0e4.js} | 0 .../out/_next/static/chunks/2831-780a653f6bb335ce.js | 1 + .../{2901-964a2f81e9258ad6.js => 2901-0cdd0656eb7463d6.js} | 0 .../out/_next/static/chunks/3163-8b2c3b9e10ac4f04.js | 1 + .../out/_next/static/chunks/3250-6c57da6c11f342fa.js | 1 - .../out/_next/static/chunks/3341-852c4599adcc0f2b.js | 1 - .../out/_next/static/chunks/3367-33bb84b3d3d247b2.js | 1 + .../out/_next/static/chunks/337-bb33d149e9f461b3.js | 1 + .../{3705-124a560b74decaa8.js => 3705-1dcdbda1985a6786.js} | 0 .../{3801-ff2404f6d0c38247.js => 3801-5abad9290d1ac527.js} | 2 +- .../out/_next/static/chunks/3881-fb9362275df4cfb8.js | 1 + .../out/_next/static/chunks/395-053deae1a24be648.js | 1 - .../{8541-04c822145b2301f8.js => 4073-c83ea30de699cedc.js} | 2 +- .../out/_next/static/chunks/4292-28669d6dfecbbf62.js | 1 - .../out/_next/static/chunks/4292-c551871b8fc9bf85.js | 1 + .../out/_next/static/chunks/4388-eb8fa49a76501802.js | 1 - .../out/_next/static/chunks/4623-3d995c58e378474f.js | 1 + .../out/_next/static/chunks/4679-12d9b222cdd9a545.js | 1 + .../out/_next/static/chunks/475-3985fee235e827f8.js | 1 - .../out/_next/static/chunks/4865-c1c0885a93c327fa.js | 1 + .../out/_next/static/chunks/5096-d9222b69b30b3d56.js | 1 - .../{5333-438ba079aae9630c.js => 5333-1540faf81c7d7006.js} | 2 +- .../out/_next/static/chunks/54-56a8e045d64789e2.js | 1 - .../out/_next/static/chunks/5458-16bb926d82ad4bf2.js | 1 + .../out/_next/static/chunks/5572-d4f8dc9b2bf09618.js | 1 - .../out/_next/static/chunks/5690-3bf2d6edf2ad3488.js | 1 - .../{5830-30dbbe6913297258.js => 5830-887d1be7a21571e6.js} | 2 +- .../{5869-99bf8c2997f4811f.js => 5869-1bf16ccc36c11fdf.js} | 0 .../out/_next/static/chunks/6043-4308da67f056896d.js | 1 + .../out/_next/static/chunks/611-daf8f83b94cdb4b5.js | 5 +++++ .../{630-f305780b75c36612.js => 630-84f939b9d5c498f8.js} | 2 +- .../{6600-1c55511ad9da9e4d.js => 6600-f6ef8cab1138b91c.js} | 2 +- .../{6609-d93906f43161f066.js => 6609-2ab6b0b5a3184f98.js} | 0 .../out/_next/static/chunks/667-213a9fbd82e0ada7.js | 1 - .../out/_next/static/chunks/6843-98abf1271c25c6e0.js | 1 - .../out/_next/static/chunks/7140-937050711ba264d3.js | 1 + .../out/_next/static/chunks/7155-459bc53437553b96.js | 1 - .../out/_next/static/chunks/7155-502603f8c00d5377.js | 1 + .../out/_next/static/chunks/7164-8de9ea967cd5d031.js | 1 - .../out/_next/static/chunks/7164-c65c1ea80db7bbed.js | 1 + .../out/_next/static/chunks/7187-d4c57193fb558148.js | 1 - .../{2525-a7d77bb2600c3955.js => 7318-c50027425e9c9b90.js} | 4 ++-- .../out/_next/static/chunks/7526-9d5ec51e0920ffc6.js | 1 - .../out/_next/static/chunks/7526-b11ab7441c450bb0.js | 1 + .../out/_next/static/chunks/7641-2d52ba6eada33bb5.js | 1 + .../out/_next/static/chunks/7641-fa9cc1f68c670e1c.js | 1 - .../out/_next/static/chunks/7692-bb659e8208e54b90.js | 1 + .../{773-b02e89f4d1193982.js => 773-ff02700a337e55b2.js} | 0 .../{7906-1b1cdd8da2773bb2.js => 7906-ff470037aad6df61.js} | 2 +- .../out/_next/static/chunks/7941-c02dc43abfb07ee7.js | 1 + .../{7975-d5ed9d0e73f8f3a9.js => 7975-045081d670913e3f.js} | 0 .../{7996-14bf1f249416672e.js => 7996-dc0963f1c599e551.js} | 0 .../out/_next/static/chunks/8049-26cbf3211b47269e.js | 1 - .../out/_next/static/chunks/8049-7e649ed7fd33f9a4.js | 1 + .../{8093-a70cb8468c3bacb1.js => 8093-9d2ba51fd9bdba69.js} | 2 +- .../out/_next/static/chunks/8135-269532e44b9e1cc0.js | 1 + .../out/_next/static/chunks/8135-bccf92b547029b20.js | 1 - .../out/_next/static/chunks/8143-c29004baeaecd6ab.js | 1 - .../out/_next/static/chunks/8143-e63ee1f43fb589a8.js | 1 + .../{816-e7500f06e5b83b0f.js => 816-2599f468473a536f.js} | 2 +- .../{8237-253c15ae006496fe.js => 8237-f24147b4d37757de.js} | 2 +- .../out/_next/static/chunks/8468-27ea05e25918ba32.js | 1 + .../out/_next/static/chunks/849-d1cabf66d71a8808.js | 1 + .../{8524-8f4aa1548d36fa46.js => 8524-838767236028144d.js} | 2 +- .../out/_next/static/chunks/8533-b7d5b2f50457d35a.js | 1 - .../out/_next/static/chunks/8568-8f9d2dfeed21cd24.js | 5 ----- .../{9798-a47f1a4423863a8a.js => 8650-bdc42de3748f9feb.js} | 2 +- .../out/_next/static/chunks/874-27200b3305585521.js | 1 - .../out/_next/static/chunks/874-6c05723839f68713.js | 1 + .../out/_next/static/chunks/8948-da16df3286be8c9b.js | 1 - .../out/_next/static/chunks/9028-2bfc9f09930a0d61.js | 1 + .../{9111-9b9192c9fb4809ff.js => 9111-12f794ec35b5648b.js} | 2 +- .../out/_next/static/chunks/9165-82d12d1c73da639d.js | 1 - .../out/_next/static/chunks/9265-ff87d261426cb5a5.js | 1 + .../out/_next/static/chunks/9301-905e8491f42289c0.js | 1 - .../{5170-eddf033da66a3d25.js => 9349-1fa3ff8b930b9fad.js} | 2 +- .../{9409-83062cad6bf21c62.js => 9409-1929f646c1a44e2b.js} | 0 .../{9411-3630d7fd1940320c.js => 9411-f0809661e32b97a3.js} | 0 .../out/_next/static/chunks/9566-1dfa2dbabae5c638.js | 1 + .../out/_next/static/chunks/9611-8bd2ffcee22edc34.js | 1 - .../out/_next/static/chunks/9611-a9f5d684e3034570.js | 1 + .../out/_next/static/chunks/9877-ff2a01b39a318119.js | 1 - .../out/_next/static/chunks/9878-52c3826c6d453296.js | 1 + .../app/(dashboard)/api-reference/page-e1a54745192ab0f1.js | 1 + .../app/(dashboard)/api-reference/page-efca3b67652c1db6.js | 1 - .../experimental/api-playground/page-936a5ab17aafdc68.js | 1 + .../experimental/api-playground/page-e66957ea53741305.js | 1 - .../{page-349dab403faa8586.js => page-b0d3ede3f043c0c8.js} | 2 +- .../{page-29593a3a38ff72cd.js => page-f4b21704c11c2d9d.js} | 2 +- .../{page-392368af0265ebf3.js => page-670a9deb6340686a.js} | 2 +- .../experimental/prompts/page-93572aaa30148895.js | 1 + .../experimental/prompts/page-a188489df21ffc96.js | 1 - .../{page-04b44e5847f0e275.js => page-5a0e12e4e22b19fe.js} | 2 +- .../{page-df254f7363ecac47.js => page-b19ec0d898a6b0ce.js} | 2 +- ...yout-a0258e2243643336.js => layout-2ae9b739c939bec1.js} | 2 +- .../chunks/app/(dashboard)/logs/page-24f7ccafa5658895.js | 1 - .../chunks/app/(dashboard)/logs/page-9c53033b0cf58112.js | 1 + .../app/(dashboard)/model-hub/page-1af734262ac00fb0.js | 1 + .../app/(dashboard)/model-hub/page-cb5b5c184df1920f.js | 1 - .../models-and-endpoints/page-2d0d5d2d6271bd9f.js | 1 + .../models-and-endpoints/page-7526ca663daec9bf.js | 1 - .../app/(dashboard)/organizations/page-c5c54ec599dda90a.js | 1 - .../app/(dashboard)/organizations/page-d9bd41055f261912.js | 1 + .../{page-f66c8c75efc80fa3.js => page-896105d02e58444f.js} | 2 +- .../settings/admin-settings/page-b14017f2434341b6.js | 1 - .../settings/admin-settings/page-e7b94e2b6d895dc1.js | 1 + .../settings/logging-and-alerts/page-73e2aa132fcafea5.js | 1 - .../settings/logging-and-alerts/page-9831981fcd33899f.js | 1 + .../{page-ce416427bf19a1dc.js => page-61fab4542b0b4417.js} | 2 +- .../{page-e723d4c81fc7d9a9.js => page-8b03f770c177a049.js} | 2 +- .../chunks/app/(dashboard)/teams/page-464d4ef166df7211.js | 1 - .../chunks/app/(dashboard)/teams/page-6c7d5084fd0d9f69.js | 1 + .../{page-4dd219948b528c92.js => page-fbfae949bb4fca35.js} | 2 +- .../{page-4a1119ecd30d2b39.js => page-1f13af87ed0f771a.js} | 2 +- .../tools/vector-stores/page-0d2fcb35bc6b40f5.js | 1 + .../tools/vector-stores/page-c4aed80b18ca0651.js | 1 - .../chunks/app/(dashboard)/usage/page-0c3dbc37d3f69993.js | 1 + .../chunks/app/(dashboard)/usage/page-2098a2b6e214223c.js | 1 - .../chunks/app/(dashboard)/users/page-80eaf816a6ca5c75.js | 1 - .../chunks/app/(dashboard)/users/page-eb8e2b637961037d.js | 1 + .../app/(dashboard)/virtual-keys/page-52c22b525906afcf.js | 1 - .../app/(dashboard)/virtual-keys/page-58606ceee2a35fed.js | 1 + ...yout-5681449b28aa197a.js => layout-86876c52b469bf46.js} | 2 +- .../_next/static/chunks/app/login/page-6295f0e1ae107bef.js | 1 + .../{page-e50863ece139886b.js => page-4cdcc0d632ab220d.js} | 2 +- .../static/chunks/app/model_hub/page-68bb7f322f019ac9.js | 1 + .../static/chunks/app/model_hub/page-ca976de28014d49a.js | 1 - .../chunks/app/model_hub_table/page-3c0b30cf20ca0ad3.js | 1 + .../chunks/app/model_hub_table/page-623abbf7f2315887.js | 1 - .../static/chunks/app/onboarding/page-6f2572027a406495.js | 1 - .../static/chunks/app/onboarding/page-b8a970754f478199.js | 1 + .../out/_next/static/chunks/app/page-28eb040917ca1710.js | 1 - .../out/_next/static/chunks/app/page-a2629d10a20e0fef.js | 1 + .../{main-cefebbba2af77d3d.js => main-598d78e71630173a.js} | 2 +- ...pp-ce1f29ef0860719b.js => main-app-77a6ca3c04ee9adf.js} | 2 +- litellm/proxy/_experimental/out/api-reference.html | 1 + litellm/proxy/_experimental/out/api-reference.txt | 6 +++--- litellm/proxy/_experimental/out/api-reference/index.html | 1 - .../_experimental/out/experimental/api-playground.html | 2 +- .../_experimental/out/experimental/api-playground.txt | 6 +++--- litellm/proxy/_experimental/out/experimental/budgets.html | 2 +- litellm/proxy/_experimental/out/experimental/budgets.txt | 6 +++--- litellm/proxy/_experimental/out/experimental/caching.html | 2 +- litellm/proxy/_experimental/out/experimental/caching.txt | 6 +++--- .../proxy/_experimental/out/experimental/old-usage.html | 2 +- litellm/proxy/_experimental/out/experimental/old-usage.txt | 6 +++--- litellm/proxy/_experimental/out/experimental/prompts.html | 2 +- litellm/proxy/_experimental/out/experimental/prompts.txt | 6 +++--- .../_experimental/out/experimental/tag-management.html | 2 +- .../_experimental/out/experimental/tag-management.txt | 6 +++--- litellm/proxy/_experimental/out/guardrails.html | 1 + litellm/proxy/_experimental/out/guardrails.txt | 6 +++--- litellm/proxy/_experimental/out/index.html | 2 +- litellm/proxy/_experimental/out/index.txt | 4 ++-- litellm/proxy/_experimental/out/login.html | 1 + litellm/proxy/_experimental/out/login.txt | 7 +++++++ litellm/proxy/_experimental/out/logs.html | 1 + litellm/proxy/_experimental/out/logs.txt | 6 +++--- litellm/proxy/_experimental/out/logs/index.html | 1 - litellm/proxy/_experimental/out/mcp/oauth/callback.html | 2 +- litellm/proxy/_experimental/out/mcp/oauth/callback.txt | 4 ++-- litellm/proxy/_experimental/out/model-hub.html | 1 + litellm/proxy/_experimental/out/model-hub.txt | 6 +++--- litellm/proxy/_experimental/out/model-hub/index.html | 1 - litellm/proxy/_experimental/out/model_hub.txt | 4 ++-- litellm/proxy/_experimental/out/model_hub_table.html | 1 + litellm/proxy/_experimental/out/model_hub_table.txt | 4 ++-- litellm/proxy/_experimental/out/model_hub_table/index.html | 1 - litellm/proxy/_experimental/out/models-and-endpoints.html | 1 + litellm/proxy/_experimental/out/models-and-endpoints.txt | 6 +++--- .../_experimental/out/models-and-endpoints/index.html | 1 - litellm/proxy/_experimental/out/onboarding.html | 1 + litellm/proxy/_experimental/out/onboarding.txt | 4 ++-- litellm/proxy/_experimental/out/organizations.html | 1 + litellm/proxy/_experimental/out/organizations.txt | 6 +++--- litellm/proxy/_experimental/out/organizations/index.html | 1 - litellm/proxy/_experimental/out/playground.html | 1 + litellm/proxy/_experimental/out/playground.txt | 6 +++--- litellm/proxy/_experimental/out/playground/index.html | 1 - .../proxy/_experimental/out/settings/admin-settings.html | 2 +- .../proxy/_experimental/out/settings/admin-settings.txt | 6 +++--- .../_experimental/out/settings/logging-and-alerts.html | 2 +- .../_experimental/out/settings/logging-and-alerts.txt | 6 +++--- .../proxy/_experimental/out/settings/router-settings.html | 2 +- .../proxy/_experimental/out/settings/router-settings.txt | 6 +++--- litellm/proxy/_experimental/out/settings/ui-theme.html | 2 +- litellm/proxy/_experimental/out/settings/ui-theme.txt | 6 +++--- litellm/proxy/_experimental/out/teams.html | 1 + litellm/proxy/_experimental/out/teams.txt | 6 +++--- litellm/proxy/_experimental/out/teams/index.html | 1 - litellm/proxy/_experimental/out/test-key.html | 1 + litellm/proxy/_experimental/out/test-key.txt | 6 +++--- litellm/proxy/_experimental/out/test-key/index.html | 1 - litellm/proxy/_experimental/out/tools/mcp-servers.html | 2 +- litellm/proxy/_experimental/out/tools/mcp-servers.txt | 6 +++--- litellm/proxy/_experimental/out/tools/vector-stores.html | 2 +- litellm/proxy/_experimental/out/tools/vector-stores.txt | 6 +++--- litellm/proxy/_experimental/out/usage.html | 1 + litellm/proxy/_experimental/out/usage.txt | 6 +++--- litellm/proxy/_experimental/out/usage/index.html | 1 - litellm/proxy/_experimental/out/users.html | 1 + litellm/proxy/_experimental/out/users.txt | 6 +++--- litellm/proxy/_experimental/out/users/index.html | 1 - litellm/proxy/_experimental/out/virtual-keys.html | 1 + litellm/proxy/_experimental/out/virtual-keys.txt | 6 +++--- litellm/proxy/_experimental/out/virtual-keys/index.html | 1 - 229 files changed, 212 insertions(+), 200 deletions(-) rename litellm/proxy/_experimental/out/_next/static/{6DVsIIQxhiSKdAYpN-pIf => 62Q_aEBtV1y_OBZw06lMc}/_buildManifest.js (100%) rename litellm/proxy/_experimental/out/_next/static/{6DVsIIQxhiSKdAYpN-pIf => 62Q_aEBtV1y_OBZw06lMc}/_ssgManifest.js (100%) create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/1200-72b27753cc974b47.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/1301-739c2d4a8ce60896.js rename litellm/proxy/_experimental/out/_next/static/chunks/{1518-4475f8385da5ac78.js => 1518-af5eabc2040f5a96.js} (65%) delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/1529-59ce29afdf8ccc9b.js rename litellm/proxy/_experimental/out/_next/static/chunks/{1602-dda1d35341543457.js => 1602-158ea5a27f7c5d7c.js} (100%) delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/1623-995fddc2b5647961.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/1674-de8248fbd0c554ba.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/1713-ce16d8a0e658a15d.js rename litellm/proxy/_experimental/out/_next/static/chunks/{1739-23e7361486c2cc74.js => 1739-1616f1e28b151332.js} (55%) create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/1971-00859360d0630018.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/1973-26a414084f96c69b.js rename litellm/proxy/_experimental/out/_next/static/chunks/{2004-294ce010a90069b4.js => 2004-1eb16c345c0044ae.js} (99%) delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/2012-c09fa25a9cbf6028.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/2012-dcbd62e829c6106f.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/2106-df512fb0bae97b5c.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/2202-75f4ebfcb55c7701.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/2202-859c1cb8c2214ee1.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/2249-01a36f26b1cecba3.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/2249-3be1a049d707c166.js rename litellm/proxy/_experimental/out/_next/static/chunks/{2273-d8bd63b2792d0fd2.js => 2273-c902438b7579c117.js} (100%) rename litellm/proxy/_experimental/out/_next/static/chunks/{2377-674bd40044d10e16.js => 2377-7121736141e67af2.js} (100%) rename litellm/proxy/_experimental/out/_next/static/chunks/{2409-e94c05c6f11bb939.js => 2409-79fdc0573d81b0e4.js} (100%) create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/2831-780a653f6bb335ce.js rename litellm/proxy/_experimental/out/_next/static/chunks/{2901-964a2f81e9258ad6.js => 2901-0cdd0656eb7463d6.js} (100%) create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/3163-8b2c3b9e10ac4f04.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/3250-6c57da6c11f342fa.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/3341-852c4599adcc0f2b.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/3367-33bb84b3d3d247b2.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/337-bb33d149e9f461b3.js rename litellm/proxy/_experimental/out/_next/static/chunks/{3705-124a560b74decaa8.js => 3705-1dcdbda1985a6786.js} (100%) rename litellm/proxy/_experimental/out/_next/static/chunks/{3801-ff2404f6d0c38247.js => 3801-5abad9290d1ac527.js} (99%) create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/3881-fb9362275df4cfb8.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/395-053deae1a24be648.js rename litellm/proxy/_experimental/out/_next/static/chunks/{8541-04c822145b2301f8.js => 4073-c83ea30de699cedc.js} (80%) delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/4292-28669d6dfecbbf62.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/4292-c551871b8fc9bf85.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/4388-eb8fa49a76501802.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/4623-3d995c58e378474f.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/4679-12d9b222cdd9a545.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/475-3985fee235e827f8.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/4865-c1c0885a93c327fa.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/5096-d9222b69b30b3d56.js rename litellm/proxy/_experimental/out/_next/static/chunks/{5333-438ba079aae9630c.js => 5333-1540faf81c7d7006.js} (99%) delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/54-56a8e045d64789e2.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/5458-16bb926d82ad4bf2.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/5572-d4f8dc9b2bf09618.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/5690-3bf2d6edf2ad3488.js rename litellm/proxy/_experimental/out/_next/static/chunks/{5830-30dbbe6913297258.js => 5830-887d1be7a21571e6.js} (99%) rename litellm/proxy/_experimental/out/_next/static/chunks/{5869-99bf8c2997f4811f.js => 5869-1bf16ccc36c11fdf.js} (100%) create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/6043-4308da67f056896d.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/611-daf8f83b94cdb4b5.js rename litellm/proxy/_experimental/out/_next/static/chunks/{630-f305780b75c36612.js => 630-84f939b9d5c498f8.js} (99%) rename litellm/proxy/_experimental/out/_next/static/chunks/{6600-1c55511ad9da9e4d.js => 6600-f6ef8cab1138b91c.js} (86%) rename litellm/proxy/_experimental/out/_next/static/chunks/{6609-d93906f43161f066.js => 6609-2ab6b0b5a3184f98.js} (100%) delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/667-213a9fbd82e0ada7.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/6843-98abf1271c25c6e0.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7140-937050711ba264d3.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7155-459bc53437553b96.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7155-502603f8c00d5377.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7164-8de9ea967cd5d031.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7164-c65c1ea80db7bbed.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7187-d4c57193fb558148.js rename litellm/proxy/_experimental/out/_next/static/chunks/{2525-a7d77bb2600c3955.js => 7318-c50027425e9c9b90.js} (90%) delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7526-9d5ec51e0920ffc6.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7526-b11ab7441c450bb0.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7641-2d52ba6eada33bb5.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7641-fa9cc1f68c670e1c.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7692-bb659e8208e54b90.js rename litellm/proxy/_experimental/out/_next/static/chunks/{773-b02e89f4d1193982.js => 773-ff02700a337e55b2.js} (100%) rename litellm/proxy/_experimental/out/_next/static/chunks/{7906-1b1cdd8da2773bb2.js => 7906-ff470037aad6df61.js} (99%) create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7941-c02dc43abfb07ee7.js rename litellm/proxy/_experimental/out/_next/static/chunks/{7975-d5ed9d0e73f8f3a9.js => 7975-045081d670913e3f.js} (100%) rename litellm/proxy/_experimental/out/_next/static/chunks/{7996-14bf1f249416672e.js => 7996-dc0963f1c599e551.js} (100%) delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/8049-26cbf3211b47269e.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/8049-7e649ed7fd33f9a4.js rename litellm/proxy/_experimental/out/_next/static/chunks/{8093-a70cb8468c3bacb1.js => 8093-9d2ba51fd9bdba69.js} (99%) create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/8135-269532e44b9e1cc0.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/8135-bccf92b547029b20.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/8143-c29004baeaecd6ab.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/8143-e63ee1f43fb589a8.js rename litellm/proxy/_experimental/out/_next/static/chunks/{816-e7500f06e5b83b0f.js => 816-2599f468473a536f.js} (99%) rename litellm/proxy/_experimental/out/_next/static/chunks/{8237-253c15ae006496fe.js => 8237-f24147b4d37757de.js} (99%) create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/8468-27ea05e25918ba32.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/849-d1cabf66d71a8808.js rename litellm/proxy/_experimental/out/_next/static/chunks/{8524-8f4aa1548d36fa46.js => 8524-838767236028144d.js} (99%) delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/8533-b7d5b2f50457d35a.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/8568-8f9d2dfeed21cd24.js rename litellm/proxy/_experimental/out/_next/static/chunks/{9798-a47f1a4423863a8a.js => 8650-bdc42de3748f9feb.js} (62%) delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/874-27200b3305585521.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/874-6c05723839f68713.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/8948-da16df3286be8c9b.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/9028-2bfc9f09930a0d61.js rename litellm/proxy/_experimental/out/_next/static/chunks/{9111-9b9192c9fb4809ff.js => 9111-12f794ec35b5648b.js} (99%) delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/9165-82d12d1c73da639d.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/9265-ff87d261426cb5a5.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/9301-905e8491f42289c0.js rename litellm/proxy/_experimental/out/_next/static/chunks/{5170-eddf033da66a3d25.js => 9349-1fa3ff8b930b9fad.js} (57%) rename litellm/proxy/_experimental/out/_next/static/chunks/{9409-83062cad6bf21c62.js => 9409-1929f646c1a44e2b.js} (100%) rename litellm/proxy/_experimental/out/_next/static/chunks/{9411-3630d7fd1940320c.js => 9411-f0809661e32b97a3.js} (100%) create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/9566-1dfa2dbabae5c638.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/9611-8bd2ffcee22edc34.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/9611-a9f5d684e3034570.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/9877-ff2a01b39a318119.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/9878-52c3826c6d453296.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/api-reference/page-e1a54745192ab0f1.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/api-reference/page-efca3b67652c1db6.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/experimental/api-playground/page-936a5ab17aafdc68.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/experimental/api-playground/page-e66957ea53741305.js rename litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/experimental/budgets/{page-349dab403faa8586.js => page-b0d3ede3f043c0c8.js} (98%) rename litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/experimental/caching/{page-29593a3a38ff72cd.js => page-f4b21704c11c2d9d.js} (93%) rename litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/experimental/old-usage/{page-392368af0265ebf3.js => page-670a9deb6340686a.js} (92%) create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/experimental/prompts/page-93572aaa30148895.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/experimental/prompts/page-a188489df21ffc96.js rename litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/experimental/tag-management/{page-04b44e5847f0e275.js => page-5a0e12e4e22b19fe.js} (89%) rename litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/guardrails/{page-df254f7363ecac47.js => page-b19ec0d898a6b0ce.js} (95%) rename litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/{layout-a0258e2243643336.js => layout-2ae9b739c939bec1.js} (99%) delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/logs/page-24f7ccafa5658895.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/logs/page-9c53033b0cf58112.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/model-hub/page-1af734262ac00fb0.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/model-hub/page-cb5b5c184df1920f.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/models-and-endpoints/page-2d0d5d2d6271bd9f.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/models-and-endpoints/page-7526ca663daec9bf.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/organizations/page-c5c54ec599dda90a.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/organizations/page-d9bd41055f261912.js rename litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/playground/{page-f66c8c75efc80fa3.js => page-896105d02e58444f.js} (85%) delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/settings/admin-settings/page-b14017f2434341b6.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/settings/admin-settings/page-e7b94e2b6d895dc1.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/settings/logging-and-alerts/page-73e2aa132fcafea5.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/settings/logging-and-alerts/page-9831981fcd33899f.js rename litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/settings/router-settings/{page-ce416427bf19a1dc.js => page-61fab4542b0b4417.js} (95%) rename litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/settings/ui-theme/{page-e723d4c81fc7d9a9.js => page-8b03f770c177a049.js} (98%) delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/teams/page-464d4ef166df7211.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/teams/page-6c7d5084fd0d9f69.js rename litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/test-key/{page-4dd219948b528c92.js => page-fbfae949bb4fca35.js} (90%) rename litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/tools/mcp-servers/{page-4a1119ecd30d2b39.js => page-1f13af87ed0f771a.js} (95%) create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/tools/vector-stores/page-0d2fcb35bc6b40f5.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/tools/vector-stores/page-c4aed80b18ca0651.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/usage/page-0c3dbc37d3f69993.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/usage/page-2098a2b6e214223c.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/users/page-80eaf816a6ca5c75.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/users/page-eb8e2b637961037d.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/virtual-keys/page-52c22b525906afcf.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/virtual-keys/page-58606ceee2a35fed.js rename litellm/proxy/_experimental/out/_next/static/chunks/app/{layout-5681449b28aa197a.js => layout-86876c52b469bf46.js} (73%) create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/login/page-6295f0e1ae107bef.js rename litellm/proxy/_experimental/out/_next/static/chunks/app/mcp/oauth/callback/{page-e50863ece139886b.js => page-4cdcc0d632ab220d.js} (89%) create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/model_hub/page-68bb7f322f019ac9.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/model_hub/page-ca976de28014d49a.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/model_hub_table/page-3c0b30cf20ca0ad3.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/model_hub_table/page-623abbf7f2315887.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/onboarding/page-6f2572027a406495.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/onboarding/page-b8a970754f478199.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/page-28eb040917ca1710.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/page-a2629d10a20e0fef.js rename litellm/proxy/_experimental/out/_next/static/chunks/{main-cefebbba2af77d3d.js => main-598d78e71630173a.js} (67%) rename litellm/proxy/_experimental/out/_next/static/chunks/{main-app-ce1f29ef0860719b.js => main-app-77a6ca3c04ee9adf.js} (81%) create mode 100644 litellm/proxy/_experimental/out/api-reference.html delete mode 100644 litellm/proxy/_experimental/out/api-reference/index.html create mode 100644 litellm/proxy/_experimental/out/guardrails.html create mode 100644 litellm/proxy/_experimental/out/login.html create mode 100644 litellm/proxy/_experimental/out/login.txt create mode 100644 litellm/proxy/_experimental/out/logs.html delete mode 100644 litellm/proxy/_experimental/out/logs/index.html create mode 100644 litellm/proxy/_experimental/out/model-hub.html delete mode 100644 litellm/proxy/_experimental/out/model-hub/index.html create mode 100644 litellm/proxy/_experimental/out/model_hub_table.html delete mode 100644 litellm/proxy/_experimental/out/model_hub_table/index.html create mode 100644 litellm/proxy/_experimental/out/models-and-endpoints.html delete mode 100644 litellm/proxy/_experimental/out/models-and-endpoints/index.html create mode 100644 litellm/proxy/_experimental/out/onboarding.html create mode 100644 litellm/proxy/_experimental/out/organizations.html delete mode 100644 litellm/proxy/_experimental/out/organizations/index.html create mode 100644 litellm/proxy/_experimental/out/playground.html delete mode 100644 litellm/proxy/_experimental/out/playground/index.html create mode 100644 litellm/proxy/_experimental/out/teams.html delete mode 100644 litellm/proxy/_experimental/out/teams/index.html create mode 100644 litellm/proxy/_experimental/out/test-key.html delete mode 100644 litellm/proxy/_experimental/out/test-key/index.html create mode 100644 litellm/proxy/_experimental/out/usage.html delete mode 100644 litellm/proxy/_experimental/out/usage/index.html create mode 100644 litellm/proxy/_experimental/out/users.html delete mode 100644 litellm/proxy/_experimental/out/users/index.html create mode 100644 litellm/proxy/_experimental/out/virtual-keys.html delete mode 100644 litellm/proxy/_experimental/out/virtual-keys/index.html diff --git a/litellm/proxy/_experimental/out/_next/static/6DVsIIQxhiSKdAYpN-pIf/_buildManifest.js b/litellm/proxy/_experimental/out/_next/static/62Q_aEBtV1y_OBZw06lMc/_buildManifest.js similarity index 100% rename from litellm/proxy/_experimental/out/_next/static/6DVsIIQxhiSKdAYpN-pIf/_buildManifest.js rename to litellm/proxy/_experimental/out/_next/static/62Q_aEBtV1y_OBZw06lMc/_buildManifest.js diff --git a/litellm/proxy/_experimental/out/_next/static/6DVsIIQxhiSKdAYpN-pIf/_ssgManifest.js b/litellm/proxy/_experimental/out/_next/static/62Q_aEBtV1y_OBZw06lMc/_ssgManifest.js similarity index 100% rename from litellm/proxy/_experimental/out/_next/static/6DVsIIQxhiSKdAYpN-pIf/_ssgManifest.js rename to litellm/proxy/_experimental/out/_next/static/62Q_aEBtV1y_OBZw06lMc/_ssgManifest.js diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1200-72b27753cc974b47.js b/litellm/proxy/_experimental/out/_next/static/chunks/1200-72b27753cc974b47.js new file mode 100644 index 00000000000..07e77067441 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1200-72b27753cc974b47.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1200],{90246:function(e,l,t){t.d(l,{n:function(){return s}});function s(e){let l=[e];return{all:l,lists:()=>[...l,"list"],list:e=>[...l,"list",{params:e}],details:()=>[...l,"detail"],detail:e=>[...l,"detail",e]}}},31200:function(e,l,t){t.d(l,{Z:function(){return lK}});var s=t(57437),a=t(29827),r=t(49804),i=t(67101),n=t(84264),o=t(2265),d=t(9114),c=t(19250),m=t(42673);let u=async(e,l,t)=>{try{var s,a;console.log("handling submit for formValues:",e);let l=e.model_mappings||[];if("model_mappings"in e&&delete e.model_mappings,e.model&&e.model.includes("all-wildcard")){let t=e.custom_llm_provider,a=(null!==(s=m.fK[t])&&void 0!==s?s:t.toLowerCase())+"/*";e.model_name=a,l.push({public_name:a,litellm_model:a}),e.model=a}let t=[];for(let s of l){let l={},r={},i=s.public_name;for(let[t,i]of(l.model=s.litellm_model,e.input_cost_per_token&&(e.input_cost_per_token=Number(e.input_cost_per_token)/1e6),e.output_cost_per_token&&(e.output_cost_per_token=Number(e.output_cost_per_token)/1e6),l.model=s.litellm_model,console.log("formValues add deployment:",e),Object.entries(e)))if(""!==i&&"custom_pricing"!==t&&"pricing_model"!==t&&"cache_control"!==t){if("model_name"==t)l.model=i;else if("custom_llm_provider"==t){console.log("custom_llm_provider:",i);let e=null!==(a=m.fK[i])&&void 0!==a?a:i.toLowerCase();l.custom_llm_provider=e,console.log("custom_llm_provider mappingResult:",e)}else if("model"==t)continue;else if("base_model"===t)r[t]=i;else if("team_id"===t)r.team_id=i;else if("model_access_group"===t)r.access_groups=i;else if("mode"==t)console.log("placing mode in modelInfo"),r.mode=i,delete l.mode;else if("custom_model_name"===t)l.model=i;else if("litellm_extra_params"==t){console.log("litellm_extra_params:",i);let e={};if(i&&void 0!=i){try{e=JSON.parse(i)}catch(e){throw d.Z.fromBackend("Failed to parse LiteLLM Extra Params: "+e),Error("Failed to parse litellm_extra_params: "+e)}for(let[t,s]of Object.entries(e))l[t]=s}}else if("model_info_params"==t){console.log("model_info_params:",i);let e={};if(i&&void 0!=i){try{e=JSON.parse(i)}catch(e){throw d.Z.fromBackend("Failed to parse LiteLLM Extra Params: "+e),Error("Failed to parse litellm_extra_params: "+e)}for(let[l,t]of Object.entries(e))r[l]=t}}else if("input_cost_per_token"===t||"output_cost_per_token"===t||"input_cost_per_second"===t){i&&(l[t]=Number(i));continue}else l[t]=i}t.push({litellmParamsObj:l,modelInfoObj:r,modelName:i})}return t}catch(e){d.Z.fromBackend("Failed to create model: "+e)}},h=async(e,l,t,s)=>{try{let a=await u(e,l,t);if(!a||0===a.length)return;for(let e of a){let{litellmParamsObj:t,modelInfoObj:s,modelName:a}=e,r={model_name:a,litellm_params:t,model_info:s},i=await (0,c.modelCreateCall)(l,r);console.log("response for model create call: ".concat(i.data))}s&&s(),t.resetFields()}catch(e){d.Z.fromBackend("Failed to add model: "+e)}};var x=t(11713),p=t(90246);let g=(0,p.n)("credentials"),f=e=>(0,x.a)({queryKey:g.list({}),queryFn:async()=>await (0,c.credentialListCall)(e),enabled:!!e}),j=(0,p.n)("models");(0,p.n)("modelHub");let v=(e,l,t)=>(0,x.a)({queryKey:j.list({filters:{...l&&{userID:l},...t&&{userRole:t}}}),queryFn:async()=>await (0,c.modelInfoCall)(e,l,t),enabled:!!(e&&l&&t)});var _=t(53410),y=t(74998),b=t(62490),N=t(10032),Z=t(21609),w=t(31283),C=t(57840),S=t(22116),k=t(37592),A=t(99981),E=t(5545);let M=(0,p.n)("providerFields"),I=()=>(0,x.a)({queryKey:M.list({}),queryFn:async()=>await (0,c.getProviderCreateMetadata)(),staleTime:864e5,gcTime:864e5});var F=t(3632),P=t(56522),L=t(47451),T=t(69410),R=t(65319);let{Link:O}=C.default,V=e=>{var l,t,s,a,r;let i="password"===e.field_type?"password":"select"===e.field_type?"select":"upload"===e.field_type?"upload":"text";return{key:e.key,label:e.label,placeholder:null!==(l=e.placeholder)&&void 0!==l?l:void 0,tooltip:null!==(t=e.tooltip)&&void 0!==t?t:void 0,required:null!==(s=e.required)&&void 0!==s&&s,type:i,options:null!==(a=e.options)&&void 0!==a?a:void 0,defaultValue:null!==(r=e.default_value)&&void 0!==r?r:void 0}},D={};var z=e=>{let{selectedProvider:l,uploadProps:t}=e,a=m.Cl[l],r=N.Z.useFormInstance(),{data:i,isLoading:n,error:d}=I(),c=o.useMemo(()=>{if(!i)return null;let e={};return i.forEach(l=>{let t=l.provider_display_name,s=l.credential_fields.map(V);e[t]=s,l.provider&&(e[l.provider]=s),l.litellm_provider&&(e[l.litellm_provider]=s)}),e},[i]);o.useEffect(()=>{c&&Object.assign(D,c)},[c]);let u=o.useMemo(()=>{var e;let t=null!==(e=D[a])&&void 0!==e?e:D[l];if(t)return t;if(!i)return[];let s=i.find(e=>e.provider_display_name===a||e.provider===l||e.litellm_provider===l);if(!s)return[];let r=s.credential_fields.map(V);return D[s.provider_display_name]=r,s.provider&&(D[s.provider]=r),s.litellm_provider&&(D[s.litellm_provider]=r),r},[a,l,i]),h={name:"file",accept:".json",beforeUpload:e=>{if("application/json"===e.type){let l=new FileReader;l.onload=e=>{if(e.target){let l=e.target.result;console.log("Setting field value from JSON, length: ".concat(l.length)),r.setFieldsValue({vertex_credentials:l}),console.log("Form values after setting:",r.getFieldsValue())}},l.readAsText(e)}return!1},onChange(e){console.log("Upload onChange triggered in ProviderSpecificFields"),console.log("Current form values:",r.getFieldsValue()),"uploading"!==e.file.status&&console.log(e.file,e.fileList)}};return(0,s.jsxs)(s.Fragment,{children:[n&&0===u.length&&(0,s.jsx)(L.Z,{children:(0,s.jsx)(T.Z,{span:24,children:(0,s.jsx)(P.x,{className:"mb-2",children:"Loading provider fields..."})})}),d&&0===u.length&&(0,s.jsx)(L.Z,{children:(0,s.jsx)(T.Z,{span:24,children:(0,s.jsx)(P.x,{className:"mb-2 text-red-500",children:d instanceof Error?d.message:"Failed to load provider credential fields"})})}),u.map(e=>{var l;return(0,s.jsxs)(o.Fragment,{children:[(0,s.jsx)(N.Z.Item,{label:e.label,name:e.key,rules:e.required?[{required:!0,message:"Required"}]:void 0,tooltip:e.tooltip,className:"vertex_credentials"===e.key?"mb-0":void 0,children:"select"===e.type?(0,s.jsx)(k.default,{placeholder:e.placeholder,defaultValue:e.defaultValue,children:null===(l=e.options)||void 0===l?void 0:l.map(e=>(0,s.jsx)(k.default.Option,{value:e,children:e},e))}):"upload"===e.type?(0,s.jsx)(R.default,{...h,onChange:l=>{(null==t?void 0:t.onChange)&&t.onChange(l),setTimeout(()=>{let l=r.getFieldValue(e.key);console.log("".concat(e.key," value after upload:"),JSON.stringify(l))},500)},children:(0,s.jsx)(E.ZP,{icon:(0,s.jsx)(F.Z,{}),children:"Click to Upload"})}):(0,s.jsx)(P.o,{placeholder:e.placeholder,type:"password"===e.type?"password":"text",defaultValue:e.defaultValue})}),"vertex_credentials"===e.key&&(0,s.jsx)(L.Z,{children:(0,s.jsx)(T.Z,{children:(0,s.jsx)(P.x,{className:"mb-3 mt-1",children:"Give a gcp service account(.json file)"})})}),"base_model"===e.key&&(0,s.jsxs)(L.Z,{children:[(0,s.jsx)(T.Z,{span:10}),(0,s.jsx)(T.Z,{span:10,children:(0,s.jsxs)(P.x,{className:"mb-2",children:["The actual model your azure deployment uses. Used for accurate cost tracking. Select name from"," ",(0,s.jsx)(O,{href:"https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json",target:"_blank",children:"here"})]})})]})]},e.key)})]})};let{Link:q}=C.default;var B=e=>{let{open:l,onCancel:t,onAddCredential:a,uploadProps:r}=e,[i]=N.Z.useForm(),[n,d]=(0,o.useState)(m.Cl.OpenAI);return(0,s.jsx)(S.Z,{title:"Add New Credential",open:l,onCancel:()=>{t(),i.resetFields()},footer:null,width:600,children:(0,s.jsxs)(N.Z,{form:i,onFinish:e=>{a(Object.entries(e).reduce((e,l)=>{let[t,s]=l;return""!==s&&null!=s&&(e[t]=s),e},{})),i.resetFields()},layout:"vertical",children:[(0,s.jsx)(N.Z.Item,{label:"Credential Name:",name:"credential_name",rules:[{required:!0,message:"Credential name is required"}],children:(0,s.jsx)(w.o,{placeholder:"Enter a friendly name for these credentials"})}),(0,s.jsx)(N.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Provider:",name:"custom_llm_provider",tooltip:"Helper to auto-populate provider specific fields",children:(0,s.jsx)(k.default,{showSearch:!0,onChange:e=>{d(e),i.setFieldValue("custom_llm_provider",e)},children:Object.entries(m.Cl).map(e=>{let[l,t]=e;return(0,s.jsx)(k.default.Option,{value:l,children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("img",{src:m.cd[t],alt:"".concat(l," logo"),className:"w-5 h-5",onError:e=>{let l=e.target,s=l.parentElement;if(s){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=t.charAt(0),s.replaceChild(e,l)}}}),(0,s.jsx)("span",{children:t})]})},l)})})}),(0,s.jsx)(z,{selectedProvider:n,uploadProps:r}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(A.Z,{title:"Get help on our github",children:(0,s.jsx)(q,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)(E.ZP,{onClick:()=>{t(),i.resetFields()},style:{marginRight:10},children:"Cancel"}),(0,s.jsx)(E.ZP,{htmlType:"submit",children:"Add Credential"})]})]})]})})};let{Link:U}=C.default;function G(e){let{open:l,onCancel:t,onUpdateCredential:a,uploadProps:r,existingCredential:i}=e,[n]=N.Z.useForm(),[d,c]=(0,o.useState)(m.Cl.Anthropic);return(0,o.useEffect)(()=>{if(i){let e=Object.entries(i.credential_values||{}).reduce((e,l)=>{let[t,s]=l;return e[t]=null!=s?s:null,e},{});n.setFieldsValue({credential_name:i.credential_name,custom_llm_provider:i.credential_info.custom_llm_provider,...e}),c(i.credential_info.custom_llm_provider)}},[i]),(0,s.jsx)(S.Z,{title:"Edit Credential",open:l,onCancel:()=>{t(),n.resetFields()},footer:null,width:600,destroyOnHidden:!0,children:(0,s.jsxs)(N.Z,{form:n,onFinish:e=>{a(Object.entries(e).reduce((e,l)=>{let[t,s]=l;return""!==s&&null!=s&&(e[t]=s),e},{})),n.resetFields()},layout:"vertical",children:[(0,s.jsx)(N.Z.Item,{label:"Credential Name:",name:"credential_name",rules:[{required:!0,message:"Credential name is required"}],initialValue:null==i?void 0:i.credential_name,children:(0,s.jsx)(w.o,{placeholder:"Enter a friendly name for these credentials",disabled:null!=i&&!!i.credential_name})}),(0,s.jsx)(N.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Provider:",name:"custom_llm_provider",tooltip:"Helper to auto-populate provider specific fields",children:(0,s.jsx)(k.default,{showSearch:!0,onChange:e=>{c(e),n.setFieldValue("custom_llm_provider",e)},children:Object.entries(m.Cl).map(e=>{let[l,t]=e;return(0,s.jsx)(k.default.Option,{value:l,children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("img",{src:m.cd[t],alt:"".concat(l," logo"),className:"w-5 h-5",onError:e=>{let l=e.target,s=l.parentElement;if(s){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=t.charAt(0),s.replaceChild(e,l)}}}),(0,s.jsx)("span",{children:t})]})},l)})})}),(0,s.jsx)(z,{selectedProvider:d,uploadProps:r}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(A.Z,{title:"Get help on our github",children:(0,s.jsx)(U,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)(E.ZP,{onClick:()=>{t(),n.resetFields()},style:{marginRight:10},children:"Cancel"}),(0,s.jsx)(E.ZP,{htmlType:"submit",children:"Update Credential"})]})]})]})})}var H=t(39760),K=e=>{var l;let{uploadProps:t}=e,{accessToken:a}=(0,H.Z)(),{data:r,refetch:i}=f(a),n=(null==r?void 0:r.credentials)||[],[m,u]=(0,o.useState)(!1),[h,x]=(0,o.useState)(!1),[p,g]=(0,o.useState)(null),[j,v]=(0,o.useState)(null),[w,C]=(0,o.useState)(!1),[S,k]=(0,o.useState)(!1),[A]=N.Z.useForm(),E=["credential_name","custom_llm_provider"],M=async e=>{if(!a)return;let l=Object.entries(e).filter(e=>{let[l]=e;return!E.includes(l)}).reduce((e,l)=>{let[t,s]=l;return{...e,[t]:s}},{}),t={credential_name:e.credential_name,credential_values:l,credential_info:{custom_llm_provider:e.custom_llm_provider}};await (0,c.credentialUpdateCall)(a,e.credential_name,t),d.Z.success("Credential updated successfully"),x(!1),await i()},I=async e=>{if(!a)return;let l=Object.entries(e).filter(e=>{let[l]=e;return!E.includes(l)}).reduce((e,l)=>{let[t,s]=l;return{...e,[t]:s}},{}),t={credential_name:e.credential_name,credential_values:l,credential_info:{custom_llm_provider:e.custom_llm_provider}};await (0,c.credentialCreateCall)(a,t),d.Z.success("Credential added successfully"),u(!1),await i()},F=e=>{let l={openai:"blue",azure:"indigo",anthropic:"purple",default:"gray"},t=l[e.toLowerCase()]||l.default;return(0,s.jsx)(b.Ct,{color:t,size:"xs",children:e})},P=async()=>{if(a&&j){k(!0);try{await (0,c.credentialDeleteCall)(a,j.credential_name),d.Z.success("Credential deleted successfully"),await i()}catch(e){d.Z.error("Failed to delete credential")}finally{v(null),C(!1),k(!1)}}},L=e=>{v(e),C(!0)};return(0,s.jsxs)("div",{className:"w-full mx-auto flex-auto overflow-y-auto p-2",children:[(0,s.jsx)(b.zx,{onClick:()=>u(!0),children:"Add Credential"}),(0,s.jsx)("div",{className:"flex justify-between items-center mt-4 mb-4",children:(0,s.jsx)(b.xv,{children:"Configured credentials for different AI providers. Add and manage your API credentials."})}),(0,s.jsx)(b.Zb,{children:(0,s.jsxs)(b.iA,{children:[(0,s.jsx)(b.ss,{children:(0,s.jsxs)(b.SC,{children:[(0,s.jsx)(b.xs,{children:"Credential Name"}),(0,s.jsx)(b.xs,{children:"Provider"}),(0,s.jsx)(b.xs,{children:"Actions"})]})}),(0,s.jsx)(b.RM,{children:n&&0!==n.length?n.map((e,l)=>{var t;return(0,s.jsxs)(b.SC,{children:[(0,s.jsx)(b.pj,{children:e.credential_name}),(0,s.jsx)(b.pj,{children:F((null===(t=e.credential_info)||void 0===t?void 0:t.custom_llm_provider)||"-")}),(0,s.jsxs)(b.pj,{children:[(0,s.jsx)(b.zx,{icon:_.Z,variant:"light",size:"sm",onClick:()=>{g(e),x(!0)}}),(0,s.jsx)(b.zx,{icon:y.Z,variant:"light",size:"sm",onClick:()=>L(e),className:"ml-2"})]})]},l)}):(0,s.jsx)(b.SC,{children:(0,s.jsx)(b.pj,{colSpan:4,className:"text-center py-4 text-gray-500",children:"No credentials configured"})})})]})}),m&&(0,s.jsx)(B,{onAddCredential:I,open:m,onCancel:()=>u(!1),uploadProps:t}),h&&(0,s.jsx)(G,{open:h,existingCredential:p,onUpdateCredential:M,uploadProps:t,onCancel:()=>x(!1)}),(0,s.jsx)(Z.Z,{isOpen:w,onCancel:()=>{v(null),C(!1)},onOk:P,title:"Delete Credential?",message:"Are you sure you want to delete this credential? This action cannot be undone and may break existing integrations.",resourceInformationTitle:"Credential Information",resourceInformation:[{label:"Credential Name",value:null==j?void 0:j.credential_name},{label:"Provider",value:(null==j?void 0:null===(l=j.credential_info)||void 0===l?void 0:l.custom_llm_provider)||"-"}],confirmLoading:S,requiredConfirmation:null==j?void 0:j.credential_name})]})};let J=e=>{var l;return(null==e?void 0:null===(l=e.model_info)||void 0===l?void 0:l.team_public_model_name)?e.model_info.team_public_model_name:(null==e?void 0:e.model_name)||"-"};var W=t(23628),Y=t(47323),$=t(12485),Q=t(18135),X=t(35242),ee=t(29706),el=t(77991),et=t(20347),es=t(59341),ea=t(5945),er=t(84376),ei=t(29),en=t.n(ei),eo=t(23496),ed=t(35291),ec=t(23639),em=t(15424);let{Text:eu}=C.default;var eh=e=>{let{formValues:l,accessToken:t,testMode:a,modelName:r="this model",onClose:i,onTestComplete:n}=e,[m,h]=o.useState(null),[x,p]=o.useState(null),[g,f]=o.useState(null),[j,v]=o.useState(!0),[_,y]=o.useState(!1),[b,N]=o.useState(!1),Z=async()=>{v(!0),N(!1),h(null),p(null),f(null),y(!1),await new Promise(e=>setTimeout(e,100));try{console.log("Testing connection with form values:",l);let a=await u(l,t,null);if(!a){console.log("No result from prepareModelAddRequest"),h("Failed to prepare model data. Please check your form inputs."),y(!1),v(!1);return}console.log("Result from prepareModelAddRequest:",a);let{litellmParamsObj:r,modelInfoObj:i,modelName:n}=a[0],o=await (0,c.testConnectionRequest)(t,r,i,null==i?void 0:i.mode);if("success"===o.status)d.Z.success("Connection test successful!"),h(null),y(!0);else{var e,s;let l=(null===(e=o.result)||void 0===e?void 0:e.error)||o.message||"Unknown error";h(l),p(r),f(null===(s=o.result)||void 0===s?void 0:s.raw_request_typed_dict),y(!1)}}catch(e){console.error("Test connection error:",e),h(e instanceof Error?e.message:String(e)),y(!1)}finally{v(!1),n&&n()}};o.useEffect(()=>{let e=setTimeout(()=>{Z()},200);return()=>clearTimeout(e)},[]);let w=e=>e?e.split("stack trace:")[0].trim().replace(/^litellm\.(.*?)Error: /,""):"Unknown error",C="string"==typeof m?w(m):(null==m?void 0:m.message)?w(m.message):"Unknown error",S=g?((e,l,t)=>{let s=JSON.stringify(l,null,2).split("\n").map(e=>" ".concat(e)).join("\n"),a=Object.entries(t).map(e=>{let[l,t]=e;return"-H '".concat(l,": ").concat(t,"'")}).join(" \\\n ");return"curl -X POST \\\n ".concat(e," \\\n ").concat(a?"".concat(a," \\\n "):"","-H 'Content-Type: application/json' \\\n -d '{\n").concat(s,"\n }'")})(g.raw_request_api_base,g.raw_request_body,g.raw_request_headers||{}):"";return(0,s.jsxs)("div",{style:{padding:"24px",borderRadius:"8px",backgroundColor:"#fff"},children:[j?(0,s.jsxs)("div",{style:{textAlign:"center",padding:"32px 20px"},className:"jsx-dc9a0e2d897fe63b",children:[(0,s.jsx)("div",{style:{marginBottom:"16px"},className:"jsx-dc9a0e2d897fe63b loading-spinner",children:(0,s.jsx)("div",{style:{border:"3px solid #f3f3f3",borderTop:"3px solid #1890ff",borderRadius:"50%",width:"30px",height:"30px",animation:"spin 1s linear infinite",margin:"0 auto"},className:"jsx-dc9a0e2d897fe63b"})}),(0,s.jsxs)(eu,{style:{fontSize:"16px"},children:["Testing connection to ",r,"..."]}),(0,s.jsx)(en(),{id:"dc9a0e2d897fe63b",children:"@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-moz-keyframes spin{0%{-moz-transform:rotate(0deg);transform:rotate(0deg)}100%{-moz-transform:rotate(360deg);transform:rotate(360deg)}}@-o-keyframes spin{0%{-o-transform:rotate(0deg);transform:rotate(0deg)}100%{-o-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes spin{0%{-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-o-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);-moz-transform:rotate(360deg);-o-transform:rotate(360deg);transform:rotate(360deg)}}"})]}):_?(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"32px 20px"},children:[(0,s.jsx)("div",{style:{color:"#52c41a",fontSize:"24px",display:"flex",alignItems:"center"},children:(0,s.jsx)("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"check-circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:(0,s.jsx)("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"})})}),(0,s.jsxs)(eu,{type:"success",style:{fontSize:"18px",fontWeight:500,marginLeft:"10px"},children:["Connection to ",r," successful!"]})]}):(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",marginBottom:"20px"},children:[(0,s.jsx)(ed.Z,{style:{color:"#ff4d4f",fontSize:"24px",marginRight:"12px"}}),(0,s.jsxs)(eu,{type:"danger",style:{fontSize:"18px",fontWeight:500},children:["Connection to ",r," failed"]})]}),(0,s.jsxs)("div",{style:{backgroundColor:"#fff2f0",border:"1px solid #ffccc7",borderRadius:"8px",padding:"16px",marginBottom:"20px",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.03)"},children:[(0,s.jsxs)(eu,{strong:!0,style:{display:"block",marginBottom:"8px"},children:["Error:"," "]}),(0,s.jsx)(eu,{type:"danger",style:{fontSize:"14px",lineHeight:"1.5"},children:C}),m&&(0,s.jsx)("div",{style:{marginTop:"12px"},children:(0,s.jsx)(E.ZP,{type:"link",onClick:()=>N(!b),style:{paddingLeft:0,height:"auto"},children:b?"Hide Details":"Show Details"})})]}),b&&(0,s.jsxs)("div",{style:{marginBottom:"20px"},children:[(0,s.jsx)(eu,{strong:!0,style:{display:"block",marginBottom:"8px",fontSize:"15px"},children:"Troubleshooting Details"}),(0,s.jsx)("pre",{style:{backgroundColor:"#f5f5f5",padding:"16px",borderRadius:"8px",fontSize:"13px",maxHeight:"200px",overflow:"auto",border:"1px solid #e8e8e8",lineHeight:"1.5"},children:"string"==typeof m?m:JSON.stringify(m,null,2)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(eu,{strong:!0,style:{display:"block",marginBottom:"8px",fontSize:"15px"},children:"API Request"}),(0,s.jsx)("pre",{style:{backgroundColor:"#f5f5f5",padding:"16px",borderRadius:"8px",fontSize:"13px",maxHeight:"250px",overflow:"auto",border:"1px solid #e8e8e8",lineHeight:"1.5"},children:S||"No request data available"}),(0,s.jsx)(E.ZP,{style:{marginTop:"8px"},icon:(0,s.jsx)(ec.Z,{}),onClick:()=>{navigator.clipboard.writeText(S||""),d.Z.success("Copied to clipboard")},children:"Copy to Clipboard"})]})]})}),(0,s.jsx)(eo.Z,{style:{margin:"24px 0 16px"}}),(0,s.jsx)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:(0,s.jsx)(E.ZP,{type:"link",href:"https://docs.litellm.ai/docs/providers",target:"_blank",icon:(0,s.jsx)(em.Z,{}),children:"View Documentation"})})]})};let ex=async(e,l,t,s)=>{try{console.log("=== AUTO ROUTER SUBMIT HANDLER CALLED ==="),console.log("handling auto router submit for formValues:",e),console.log("Access token:",l?"Present":"Missing"),console.log("Form:",t?"Present":"Missing"),console.log("Callback:",s?"Present":"Missing");let a={model_name:e.auto_router_name,litellm_params:{model:"auto_router/".concat(e.auto_router_name),auto_router_config:JSON.stringify(e.auto_router_config),auto_router_default_model:e.auto_router_default_model},model_info:{}};e.auto_router_embedding_model&&"custom"!==e.auto_router_embedding_model?a.litellm_params.auto_router_embedding_model=e.auto_router_embedding_model:e.custom_embedding_model&&(a.litellm_params.auto_router_embedding_model=e.custom_embedding_model),e.team_id&&(a.model_info.team_id=e.team_id),e.model_access_group&&e.model_access_group.length>0&&(a.model_info.access_groups=e.model_access_group),console.log("Auto router configuration to be created:",a),console.log("Auto router config (stringified):",a.litellm_params.auto_router_config),console.log("Calling modelCreateCall with:",{accessToken:l?"Present":"Missing",config:a});let r=await (0,c.modelCreateCall)(l,a);console.log("response for auto router create call:",r),t.resetFields()}catch(e){console.error("Failed to add auto router:",e),d.Z.fromBackend("Failed to add auto router: "+e)}};var ep=t(10703),eg=t(4260),ef=t(44851),ej=t(19015),ev=t(96473),e_=t(70464),ey=t(26349),eb=t(92280);let{TextArea:eN}=eg.default,{Panel:eZ}=ef.default;var ew=e=>{let{modelInfo:l,value:t,onChange:a}=e,[r,i]=(0,o.useState)([]),[n,d]=(0,o.useState)(!1),[c,m]=(0,o.useState)([]);(0,o.useEffect)(()=>{if(null==t?void 0:t.routes){let e=t.routes.map((e,l)=>({id:e.id||"route-".concat(l,"-").concat(Date.now()),model:e.name||e.model||"",utterances:e.utterances||[],description:e.description||"",score_threshold:e.score_threshold||.5}));i(e),m(e.map(e=>e.id))}else i([]),m([])},[t]);let u=e=>{let l=r.filter(l=>l.id!==e);i(l),x(l),m(l=>l.filter(l=>l!==e))},h=(e,l,t)=>{let s=r.map(s=>s.id===e?{...s,[l]:t}:s);i(s),x(s)},x=e=>{let l={routes:e.map(e=>({name:e.model,utterances:e.utterances,description:e.description,score_threshold:e.score_threshold}))};null==a||a(l)},p=l.map(e=>({value:e.model_group,label:e.model_group}));return(0,s.jsxs)("div",{className:"w-full max-w-none",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-6 w-full",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(eb.x,{className:"text-lg font-semibold",children:"Routes Configuration"}),(0,s.jsx)(A.Z,{title:"Configure routing logic to automatically select the best model based on user input patterns",children:(0,s.jsx)(em.Z,{className:"text-gray-400"})})]}),(0,s.jsx)(E.ZP,{type:"primary",icon:(0,s.jsx)(ev.Z,{}),onClick:()=>{let e="route-".concat(Date.now()),l=[...r,{id:e,model:"",utterances:[],description:"",score_threshold:.5}];i(l),x(l),m(l=>[...l,e])},className:"bg-blue-600 hover:bg-blue-700",children:"Add Route"})]}),0===r.length?(0,s.jsx)("div",{className:"text-center py-12 text-gray-500 bg-gray-50 rounded-lg border-2 border-dashed border-gray-200 mb-6",children:(0,s.jsx)(eb.x,{children:"No routes configured. Click ā€œAdd Routeā€ to get started."})}):(0,s.jsx)("div",{className:"space-y-3 mb-6 w-full",children:r.map((e,l)=>(0,s.jsx)(ea.Z,{className:"border border-gray-200 shadow-sm w-full",bodyStyle:{padding:0},children:(0,s.jsx)(ef.default,{ghost:!0,expandIcon:e=>{let{isActive:l}=e;return(0,s.jsx)(e_.Z,{rotate:l?180:0})},activeKey:c,onChange:e=>m(Array.isArray(e)?e:[e].filter(Boolean)),items:[{key:e.id,label:(0,s.jsxs)("div",{className:"flex justify-between items-center py-2",children:[(0,s.jsxs)(eb.x,{className:"font-medium text-base",children:["Route ",l+1,": ",e.model||"Unnamed"]}),(0,s.jsx)(E.ZP,{type:"text",danger:!0,icon:(0,s.jsx)(ey.Z,{}),onClick:l=>{l.stopPropagation(),u(e.id)},className:"mr-2"})]}),children:(0,s.jsxs)("div",{className:"px-6 pb-6 w-full",children:[(0,s.jsxs)("div",{className:"mb-4 w-full",children:[(0,s.jsx)(eb.x,{className:"text-sm font-medium mb-2 block",children:"Model"}),(0,s.jsx)(k.default,{value:e.model,onChange:l=>h(e.id,"model",l),placeholder:"Select model",showSearch:!0,style:{width:"100%"},options:p})]}),(0,s.jsxs)("div",{className:"mb-4 w-full",children:[(0,s.jsx)(eb.x,{className:"text-sm font-medium mb-2 block",children:"Description"}),(0,s.jsx)(eN,{value:e.description,onChange:l=>h(e.id,"description",l.target.value),placeholder:"Describe when this route should be used...",rows:2,style:{width:"100%"}})]}),(0,s.jsxs)("div",{className:"mb-4 w-full",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,s.jsx)(eb.x,{className:"text-sm font-medium",children:"Score Threshold"}),(0,s.jsx)(A.Z,{title:"Minimum similarity score to route to this model (0-1)",children:(0,s.jsx)(em.Z,{className:"text-gray-400"})})]}),(0,s.jsx)(ej.Z,{value:e.score_threshold,onChange:l=>h(e.id,"score_threshold",l||0),min:0,max:1,step:.1,style:{width:"100%"},placeholder:"0.5"})]}),(0,s.jsxs)("div",{className:"w-full",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,s.jsx)(eb.x,{className:"text-sm font-medium",children:"Example Utterances"}),(0,s.jsx)(A.Z,{title:"Training examples for this route. Type an utterance and press Enter to add it.",children:(0,s.jsx)(em.Z,{className:"text-gray-400"})})]}),(0,s.jsx)(eb.x,{className:"text-xs text-gray-500 mb-2",children:"Type an utterance and press Enter to add it. You can also paste multiple lines."}),(0,s.jsx)(k.default,{mode:"tags",value:e.utterances,onChange:l=>h(e.id,"utterances",l),placeholder:"Type an utterance and press Enter...",style:{width:"100%"},tokenSeparators:["\n"],maxTagCount:"responsive",allowClear:!0})]})]})}]})},e.id))}),(0,s.jsxs)("div",{className:"border-t pt-6 w-full",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4 w-full",children:[(0,s.jsx)(eb.x,{className:"text-lg font-semibold",children:"JSON Preview"}),(0,s.jsx)(E.ZP,{type:"link",onClick:()=>d(!n),className:"text-blue-600 p-0",children:n?"Hide":"Show"})]}),n&&(0,s.jsx)(ea.Z,{className:"bg-gray-50 w-full",children:(0,s.jsx)("pre",{className:"text-sm overflow-auto max-h-64 w-full",children:JSON.stringify({routes:r.map(e=>({name:e.model,utterances:e.utterances,description:e.description,score_threshold:e.score_threshold}))},null,2)})})]})]})};let{Title:eC,Link:eS}=C.default;var ek=e=>{let{form:l,handleOk:t,accessToken:a,userRole:r}=e,[i,n]=(0,o.useState)(!1),[m,u]=(0,o.useState)(!1),[h,x]=(0,o.useState)(""),[p,g]=(0,o.useState)([]),[f,j]=(0,o.useState)([]),[v,_]=(0,o.useState)(!1),[y,b]=(0,o.useState)(!1),[Z,w]=(0,o.useState)(null);(0,o.useEffect)(()=>{(async()=>{g((await (0,c.modelAvailableCall)(a,"","",!1,null,!0,!0)).data.map(e=>e.id))})()},[a]),(0,o.useEffect)(()=>{(async()=>{try{let e=await (0,ep.p)(a);console.log("Fetched models for auto router:",e),j(e)}catch(e){console.error("Error fetching model info for auto router:",e)}})()},[a]);let M=et.ZL.includes(r),I=async()=>{u(!0),x("test-".concat(Date.now())),n(!0)},F=()=>{console.log("Auto router submit triggered!"),console.log("Router config:",Z);let e=l.getFieldsValue();if(console.log("Form values:",e),!e.auto_router_name){d.Z.fromBackend("Please enter an Auto Router Name");return}if(!e.auto_router_default_model){d.Z.fromBackend("Please select a Default Model");return}if(l.setFieldsValue({custom_llm_provider:"auto_router",model:e.auto_router_name,api_key:"not_required_for_auto_router"}),!Z||!Z.routes||0===Z.routes.length){d.Z.fromBackend("Please configure at least one route for the auto router");return}if(Z.routes.filter(e=>!e.name||!e.description||0===e.utterances.length).length>0){d.Z.fromBackend("Please ensure all routes have a target model, description, and at least one utterance");return}l.validateFields().then(e=>{console.log("Form validation passed, submitting with values:",e);let s={...e,auto_router_config:Z};console.log("Final submit values:",s),ex(s,a,l,t)}).catch(e=>{console.error("Validation failed:",e);let l=e.errorFields||[];if(l.length>0){let e=l.map(e=>{let l=e.name[0];return({auto_router_name:"Auto Router Name",auto_router_default_model:"Default Model",auto_router_embedding_model:"Embedding Model"})[l]||l});d.Z.fromBackend("Please fill in the following required fields: ".concat(e.join(", ")))}else d.Z.fromBackend("Please fill in all required fields")})};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eC,{level:2,children:"Add Auto Router"}),(0,s.jsx)(P.x,{className:"text-gray-600 mb-6",children:"Create an auto router with intelligent routing logic that automatically selects the best model based on user input patterns and semantic matching."}),(0,s.jsx)(ea.Z,{children:(0,s.jsxs)(N.Z,{form:l,onFinish:F,labelCol:{span:10},wrapperCol:{span:16},labelAlign:"left",children:[(0,s.jsx)(N.Z.Item,{rules:[{required:!0,message:"Auto router name is required"}],label:"Auto Router Name",name:"auto_router_name",tooltip:"Unique name for this auto router configuration",labelCol:{span:10},labelAlign:"left",children:(0,s.jsx)(P.o,{placeholder:"e.g., auto_router_1, smart_routing"})}),(0,s.jsx)("div",{className:"w-full mb-4",children:(0,s.jsx)(ew,{modelInfo:f,value:Z,onChange:e=>{w(e),l.setFieldValue("auto_router_config",e)}})}),(0,s.jsx)(N.Z.Item,{rules:[{required:!0,message:"Default model is required"}],label:"Default Model",name:"auto_router_default_model",tooltip:"Fallback model to use when auto routing logic cannot determine the best model",labelCol:{span:10},labelAlign:"left",children:(0,s.jsx)(k.default,{placeholder:"Select a default model",onChange:e=>{_("custom"===e)},options:[...Array.from(new Set(f.map(e=>e.model_group))).map(e=>({value:e,label:e})),{value:"custom",label:"Enter custom model name"}],style:{width:"100%"},showSearch:!0})}),(0,s.jsx)(N.Z.Item,{label:"Embedding Model",name:"auto_router_embedding_model",tooltip:"Optional: Embedding model to use for semantic routing decisions",labelCol:{span:10},labelAlign:"left",children:(0,s.jsx)(k.default,{value:l.getFieldValue("auto_router_embedding_model"),placeholder:"Select an embedding model (optional)",onChange:e=>{b("custom"===e),l.setFieldValue("auto_router_embedding_model",e)},options:[...Array.from(new Set(f.map(e=>e.model_group))).map(e=>({value:e,label:e})),{value:"custom",label:"Enter custom model name"}],style:{width:"100%"},showSearch:!0,allowClear:!0})}),(0,s.jsxs)("div",{className:"flex items-center my-4",children:[(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"}),(0,s.jsx)("span",{className:"px-4 text-gray-500 text-sm",children:"Additional Settings"}),(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"})]}),M&&(0,s.jsx)(N.Z.Item,{label:"Model Access Group",name:"model_access_group",className:"mb-4",tooltip:"Use model access groups to control who can access this auto router",children:(0,s.jsx)(k.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],options:p.map(e=>({value:e,label:e})),maxTagCount:"responsive",allowClear:!0})}),(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(A.Z,{title:"Get help on our github",children:(0,s.jsx)(C.default.Link,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{className:"space-x-2",children:[(0,s.jsx)(E.ZP,{onClick:I,loading:m,children:"Test Connect"}),(0,s.jsx)(E.ZP,{onClick:()=>{console.log("Add Auto Router button clicked!"),console.log("Current router config:",Z),console.log("Current form values:",l.getFieldsValue()),F()},children:"Add Auto Router"})]})]})]})}),(0,s.jsx)(S.Z,{title:"Connection Test Results",open:i,onCancel:()=>{n(!1),u(!1)},footer:[(0,s.jsx)(E.ZP,{onClick:()=>{n(!1),u(!1)},children:"Close"},"close")],width:700,children:i&&(0,s.jsx)(eh,{formValues:l.getFieldsValue(),accessToken:a,testMode:"chat",modelName:l.getFieldValue("auto_router_name"),onClose:()=>{n(!1),u(!1)},onTestComplete:()=>u(!1)},h)})]})};let eA=[{value:"chat",label:"Chat - /chat/completions"},{value:"completion",label:"Completion - /completions"},{value:"embedding",label:"Embedding - /embeddings"},{value:"audio_speech",label:"Audio Speech - /audio/speech"},{value:"audio_transcription",label:"Audio Transcription - /audio/transcriptions"},{value:"image_generation",label:"Image Generation - /images/generations"},{value:"video_generation",label:"Video Generation - /videos"},{value:"rerank",label:"Rerank - /rerank"},{value:"realtime",label:"Realtime - /realtime"},{value:"batch",label:"Batch - /batch"},{value:"ocr",label:"OCR - /ocr"}];var eE=t(63709),eM=t(26210),eI=t(34766),eF=t(45246),eP=t(24199);let{Text:eL}=C.default;var eT=e=>{let{form:l,showCacheControl:t,onCacheControlChange:a}=e,r=e=>{let t=l.getFieldValue("litellm_extra_params");try{let s=t?JSON.parse(t):{};e.length>0?s.cache_control_injection_points=e:delete s.cache_control_injection_points,Object.keys(s).length>0?l.setFieldValue("litellm_extra_params",JSON.stringify(s,null,2)):l.setFieldValue("litellm_extra_params","")}catch(e){console.error("Error updating cache control points:",e)}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(N.Z.Item,{label:"Cache Control Injection Points",name:"cache_control",valuePropName:"checked",className:"mb-4",tooltip:"Tell litellm where to inject cache control checkpoints. You can specify either by role (to apply to all messages of that role) or by specific message index.",children:(0,s.jsx)(eE.Z,{onChange:a,className:"bg-gray-600"})}),t&&(0,s.jsxs)("div",{className:"ml-6 pl-4 border-l-2 border-gray-200",children:[(0,s.jsx)(eL,{className:"text-sm text-gray-500 block mb-4",children:"Providers like Anthropic, Bedrock API require users to specify where to inject cache control checkpoints, litellm can automatically add them for you as a cost saving feature."}),(0,s.jsx)(N.Z.List,{name:"cache_control_injection_points",initialValue:[{location:"message"}],children:(e,t)=>{let{add:a,remove:i}=t;return(0,s.jsxs)(s.Fragment,{children:[e.map((t,a)=>(0,s.jsxs)("div",{className:"flex items-center mb-4 gap-4",children:[(0,s.jsx)(N.Z.Item,{...t,label:"Type",name:[t.name,"location"],initialValue:"message",className:"mb-0",style:{width:"180px"},children:(0,s.jsx)(k.default,{disabled:!0,options:[{value:"message",label:"Message"}]})}),(0,s.jsx)(N.Z.Item,{...t,label:"Role",name:[t.name,"role"],className:"mb-0",style:{width:"180px"},tooltip:"LiteLLM will mark all messages of this role as cacheable",children:(0,s.jsx)(k.default,{placeholder:"Select a role",allowClear:!0,options:[{value:"user",label:"User"},{value:"system",label:"System"},{value:"assistant",label:"Assistant"}],onChange:()=>{r(l.getFieldValue("cache_control_points"))}})}),(0,s.jsx)(N.Z.Item,{...t,label:"Index",name:[t.name,"index"],className:"mb-0",style:{width:"180px"},tooltip:"(Optional) If set litellm will mark the message at this index as cacheable",children:(0,s.jsx)(eP.Z,{type:"number",placeholder:"Optional",step:1,onChange:()=>{r(l.getFieldValue("cache_control_points"))}})}),e.length>1&&(0,s.jsx)(eF.Z,{className:"text-red-500 cursor-pointer text-lg ml-12",onClick:()=>{i(t.name),setTimeout(()=>{r(l.getFieldValue("cache_control_points"))},0)}})]},t.key)),(0,s.jsx)(N.Z.Item,{children:(0,s.jsxs)("button",{type:"button",className:"flex items-center justify-center w-full border border-dashed border-gray-300 py-2 px-4 text-gray-600 hover:text-blue-600 hover:border-blue-300 transition-all rounded",onClick:()=>a(),children:[(0,s.jsx)(ev.Z,{className:"mr-2"}),"Add Injection Point"]})})]})}})]})]})},eR=t(9309);let{Link:eO}=C.default;var eV=e=>{let{showAdvancedSettings:l,setShowAdvancedSettings:t,teams:a,guardrailsList:r,tagsList:i}=e,[n]=N.Z.useForm(),[d,c]=o.useState(!1),[m,u]=o.useState("per_token"),[h,x]=o.useState(!1),p=(e,l)=>l&&(isNaN(Number(l))||0>Number(l))?Promise.reject("Please enter a valid positive number"):Promise.resolve();return(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)(eM.UQ,{className:"mt-2 mb-4",children:[(0,s.jsx)(eM._m,{children:(0,s.jsx)("b",{children:"Advanced Settings"})}),(0,s.jsx)(eM.X1,{children:(0,s.jsxs)("div",{className:"bg-white rounded-lg",children:[(0,s.jsx)(N.Z.Item,{label:"Custom Pricing",name:"custom_pricing",valuePropName:"checked",className:"mb-4",children:(0,s.jsx)(eE.Z,{onChange:e=>{c(e),e||n.setFieldsValue({input_cost_per_token:void 0,output_cost_per_token:void 0,input_cost_per_second:void 0})},className:"bg-gray-600"})}),(0,s.jsx)(N.Z.Item,{label:(0,s.jsxs)("span",{children:["Guardrails"," ",(0,s.jsx)(A.Z,{title:"Apply safety guardrails to this key to filter content or enforce policies",children:(0,s.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,s.jsx)(em.Z,{style:{marginLeft:"4px"}})})})]}),name:"guardrails",className:"mt-4",help:"Select existing guardrails. Go to 'Guardrails' tab to create new guardrails.",children:(0,s.jsx)(k.default,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter guardrails",options:r.map(e=>({value:e,label:e}))})}),(0,s.jsx)(N.Z.Item,{label:"Tags",name:"tags",className:"mb-4",children:(0,s.jsx)(k.default,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter tags",options:Object.values(i).map(e=>({value:e.name,label:e.name,title:e.description||e.name}))})}),d&&(0,s.jsxs)("div",{className:"ml-6 pl-4 border-l-2 border-gray-200",children:[(0,s.jsx)(N.Z.Item,{label:"Pricing Model",name:"pricing_model",className:"mb-4",children:(0,s.jsx)(k.default,{defaultValue:"per_token",onChange:e=>u(e),options:[{value:"per_token",label:"Per Million Tokens"},{value:"per_second",label:"Per Second"}]})}),"per_token"===m?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(N.Z.Item,{label:"Input Cost (per 1M tokens)",name:"input_cost_per_token",rules:[{validator:p}],className:"mb-4",children:(0,s.jsx)(eM.oi,{})}),(0,s.jsx)(N.Z.Item,{label:"Output Cost (per 1M tokens)",name:"output_cost_per_token",rules:[{validator:p}],className:"mb-4",children:(0,s.jsx)(eM.oi,{})})]}):(0,s.jsx)(N.Z.Item,{label:"Cost Per Second",name:"input_cost_per_second",rules:[{validator:p}],className:"mb-4",children:(0,s.jsx)(eM.oi,{})})]}),(0,s.jsx)(N.Z.Item,{label:"Use in pass through routes",name:"use_in_pass_through",valuePropName:"checked",className:"mb-4 mt-4",tooltip:(0,s.jsxs)("span",{children:["Allow using these credentials in pass through routes."," ",(0,s.jsx)(eO,{href:"https://docs.litellm.ai/docs/pass_through/vertex_ai",target:"_blank",children:"Learn more"})]}),children:(0,s.jsx)(eE.Z,{onChange:e=>{let l=n.getFieldValue("litellm_extra_params");try{let t=l?JSON.parse(l):{};e?t.use_in_pass_through=!0:delete t.use_in_pass_through,Object.keys(t).length>0?n.setFieldValue("litellm_extra_params",JSON.stringify(t,null,2)):n.setFieldValue("litellm_extra_params","")}catch(l){e?n.setFieldValue("litellm_extra_params",JSON.stringify({use_in_pass_through:!0},null,2)):n.setFieldValue("litellm_extra_params","")}},className:"bg-gray-600"})}),(0,s.jsx)(eT,{form:n,showCacheControl:h,onCacheControlChange:e=>{if(x(e),!e){let e=n.getFieldValue("litellm_extra_params");try{let l=e?JSON.parse(e):{};delete l.cache_control_injection_points,Object.keys(l).length>0?n.setFieldValue("litellm_extra_params",JSON.stringify(l,null,2)):n.setFieldValue("litellm_extra_params","")}catch(e){n.setFieldValue("litellm_extra_params","")}}}}),(0,s.jsx)(N.Z.Item,{label:"LiteLLM Params",name:"litellm_extra_params",tooltip:"Optional litellm params used for making a litellm.completion() call.",className:"mb-4 mt-4",rules:[{validator:eR.Ac}],children:(0,s.jsx)(eI.Z,{rows:4,placeholder:'{ "rpm": 100, "timeout": 0, "stream_timeout": 0 }'})}),(0,s.jsxs)(L.Z,{className:"mb-4",children:[(0,s.jsx)(T.Z,{span:10}),(0,s.jsx)(T.Z,{span:10,children:(0,s.jsxs)(eM.xv,{className:"text-gray-600 text-sm",children:["Pass JSON of litellm supported params"," ",(0,s.jsx)(eO,{href:"https://docs.litellm.ai/docs/completion/input",target:"_blank",children:"litellm.completion() call"})]})})]}),(0,s.jsx)(N.Z.Item,{label:"Model Info",name:"model_info_params",tooltip:"Optional model info params. Returned when calling `/model/info` endpoint.",className:"mb-0",rules:[{validator:eR.Ac}],children:(0,s.jsx)(eI.Z,{rows:4,placeholder:'{ "mode": "chat" }'})})]})})]})})},eD=t(56609),ez=t(67187);let eq=e=>{let{content:l,children:t,width:a="auto",className:r=""}=e,[i,n]=(0,o.useState)(!1),[d,c]=(0,o.useState)("top"),m=(0,o.useRef)(null),u=()=>{if(m.current){let e=m.current.getBoundingClientRect(),l=e.top,t=window.innerHeight-e.bottom;l<300&&t>300?c("bottom"):c("top")}};return(0,s.jsxs)("div",{className:"relative inline-block",ref:m,children:[t||(0,s.jsx)(ez.Z,{className:"ml-1 text-gray-500 cursor-help",onMouseEnter:()=>{u(),n(!0)},onMouseLeave:()=>n(!1)}),i&&(0,s.jsxs)("div",{className:"absolute left-1/2 -translate-x-1/2 z-50 bg-black/90 text-white p-2 rounded-md text-sm font-normal shadow-lg ".concat(r),style:{["top"===d?"bottom":"top"]:"100%",width:a,marginBottom:"top"===d?"8px":"0",marginTop:"bottom"===d?"8px":"0"},children:[l,(0,s.jsx)("div",{className:"absolute left-1/2 -translate-x-1/2 w-0 h-0",style:{top:"top"===d?"100%":"auto",bottom:"bottom"===d?"100%":"auto",borderTop:"top"===d?"6px solid rgba(0, 0, 0, 0.9)":"6px solid transparent",borderBottom:"bottom"===d?"6px solid rgba(0, 0, 0, 0.9)":"6px solid transparent",borderLeft:"6px solid transparent",borderRight:"6px solid transparent"}})]})]})};var eB=()=>{let e=N.Z.useFormInstance(),[l,t]=(0,o.useState)(0),a=N.Z.useWatch("model",e)||[],r=Array.isArray(a)?a:[a],i=N.Z.useWatch("custom_model_name",e),n=!r.includes("all-wildcard"),d=N.Z.useWatch("custom_llm_provider",e);if((0,o.useEffect)(()=>{if(i&&r.includes("custom")){let l=(e.getFieldValue("model_mappings")||[]).map(e=>"custom"===e.public_name||"custom"===e.litellm_model?d===m.Cl.Azure?{public_name:i,litellm_model:"azure/".concat(i)}:{public_name:i,litellm_model:i}:e);e.setFieldValue("model_mappings",l),t(e=>e+1)}},[i,r,d,e]),(0,o.useEffect)(()=>{if(r.length>0&&!r.includes("all-wildcard")){let l=e.getFieldValue("model_mappings")||[];if(l.length!==r.length||!r.every(e=>l.some(l=>"custom"===e?"custom"===l.litellm_model||l.litellm_model===i:d===m.Cl.Azure?l.litellm_model==="azure/".concat(e):l.litellm_model===e))){let l=r.map(e=>"custom"===e&&i?d===m.Cl.Azure?{public_name:i,litellm_model:"azure/".concat(i)}:{public_name:i,litellm_model:i}:d===m.Cl.Azure?{public_name:e,litellm_model:"azure/".concat(e)}:{public_name:e,litellm_model:e});e.setFieldValue("model_mappings",l),t(e=>e+1)}}},[r,i,d,e]),!n)return null;let c=(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"mb-2 font-normal",children:"The name you specify in your API calls to LiteLLM Proxy"}),(0,s.jsxs)("div",{className:"mb-2 font-normal",children:[(0,s.jsx)("strong",{children:"Example:"})," If you name your public model"," ",(0,s.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:"example-name"}),", and choose"," ",(0,s.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:"openai/qwen-plus-latest"})," as the LiteLLM model"]}),(0,s.jsxs)("div",{className:"mb-2 font-normal",children:[(0,s.jsx)("strong",{children:"Usage:"})," You make an API call to the LiteLLM proxy with"," ",(0,s.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:'model = "example-name"'})]}),(0,s.jsxs)("div",{className:"font-normal",children:[(0,s.jsx)("strong",{children:"Result:"})," LiteLLM sends"," ",(0,s.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:"qwen-plus-latest"})," to the provider"]})]}),u=(0,s.jsx)("div",{children:"The model name LiteLLM will send to the LLM API"}),h=[{title:(0,s.jsxs)("span",{className:"flex items-center",children:["Public Model Name",(0,s.jsx)(eq,{content:c,width:"500px"})]}),dataIndex:"public_name",key:"public_name",render:(l,t,a)=>(0,s.jsx)(w.o,{value:l,onChange:l=>{let t=[...e.getFieldValue("model_mappings")];t[a].public_name=l.target.value,e.setFieldValue("model_mappings",t)}})},{title:(0,s.jsxs)("span",{className:"flex items-center",children:["LiteLLM Model Name",(0,s.jsx)(eq,{content:u,width:"360px"})]}),dataIndex:"litellm_model",key:"litellm_model"}];return(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(N.Z.Item,{label:"Model Mappings",name:"model_mappings",tooltip:"Map public model names to LiteLLM model names for load balancing",labelCol:{span:10},wrapperCol:{span:16},labelAlign:"left",rules:[{required:!0,validator:async(e,l)=>{if(!l||0===l.length)throw Error("At least one model mapping is required");if(l.filter(e=>!e.public_name||""===e.public_name.trim()).length>0)throw Error("All model mappings must have valid public names")}}],children:(0,s.jsx)(eD.Z,{dataSource:e.getFieldValue("model_mappings"),columns:h,pagination:!1,size:"small"},l)})})},eU=e=>{let{selectedProvider:l,providerModels:t,getPlaceholder:a}=e,r=N.Z.useFormInstance(),i=e=>{let t=e.target.value,s=(r.getFieldValue("model_mappings")||[]).map(e=>"custom"===e.public_name||"custom"===e.litellm_model?l===m.Cl.Azure?{public_name:t,litellm_model:"azure/".concat(t)}:{public_name:t,litellm_model:t}:e);r.setFieldsValue({model_mappings:s})};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(N.Z.Item,{label:"LiteLLM Model Name(s)",tooltip:"The model name LiteLLM will send to the LLM API",className:"mb-0",children:[(0,s.jsx)(N.Z.Item,{name:"model",rules:[{required:!0,message:"Please enter ".concat(l===m.Cl.Azure?"a deployment name":"at least one model",".")}],noStyle:!0,children:l===m.Cl.Azure||l===m.Cl.OpenAI_Compatible||l===m.Cl.Ollama?(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(P.o,{placeholder:a(l),onChange:l===m.Cl.Azure?e=>{let l=e.target.value,t=l?[{public_name:l,litellm_model:"azure/".concat(l)}]:[];r.setFieldsValue({model:l,model_mappings:t})}:void 0})}):t.length>0?(0,s.jsx)(k.default,{mode:"multiple",allowClear:!0,showSearch:!0,placeholder:"Select models",onChange:e=>{let t=Array.isArray(e)?e:[e];if(t.includes("all-wildcard"))r.setFieldsValue({model_name:void 0,model_mappings:[]});else if(JSON.stringify(r.getFieldValue("model"))!==JSON.stringify(t)){let e=t.map(e=>l===m.Cl.Azure?{public_name:e,litellm_model:"azure/".concat(e)}:{public_name:e,litellm_model:e});r.setFieldsValue({model:t,model_mappings:e})}},optionFilterProp:"children",filterOption:(e,l)=>{var t;return(null!==(t=null==l?void 0:l.label)&&void 0!==t?t:"").toLowerCase().includes(e.toLowerCase())},options:[{label:"Custom Model Name (Enter below)",value:"custom"},{label:"All ".concat(l," Models (Wildcard)"),value:"all-wildcard"},...t.map(e=>({label:e,value:e}))],style:{width:"100%"}}):(0,s.jsx)(P.o,{placeholder:a(l)})}),(0,s.jsx)(N.Z.Item,{noStyle:!0,shouldUpdate:(e,l)=>e.model!==l.model,children:e=>{let{getFieldValue:t}=e,a=t("model")||[];return(Array.isArray(a)?a:[a]).includes("custom")&&(0,s.jsx)(N.Z.Item,{name:"custom_model_name",rules:[{required:!0,message:"Please enter a custom model name."}],className:"mt-2",children:(0,s.jsx)(P.o,{placeholder:l===m.Cl.Azure?"Enter Azure deployment name":"Enter custom model name",onChange:i})})}})]}),(0,s.jsxs)(L.Z,{children:[(0,s.jsx)(T.Z,{span:10}),(0,s.jsx)(T.Z,{span:14,children:(0,s.jsx)(P.x,{className:"mb-3 mt-1",children:l===m.Cl.Azure?"Your deployment name will be saved as the public model name, and LiteLLM will use 'azure/deployment-name' internally":"The model name LiteLLM will send to the LLM API"})})]})]})};let{Title:eG,Link:eH}=C.default;var eK=e=>{let{form:l,handleOk:t,selectedProvider:a,setSelectedProvider:r,providerModels:i,setProviderModelsFn:d,getPlaceholder:u,uploadProps:h,showAdvancedSettings:x,setShowAdvancedSettings:p,teams:g,credentials:f,accessToken:j,userRole:v,premiumUser:_}=e,[y]=N.Z.useForm(),[b,Z]=(0,o.useState)("chat"),[w,M]=(0,o.useState)(!1),[F,P]=(0,o.useState)(!1),[R,O]=(0,o.useState)([]),[V,D]=(0,o.useState)({}),[q,B]=(0,o.useState)(""),{data:U,isLoading:G,error:H}=I();(0,o.useEffect)(()=>{(async()=>{try{let e=(await (0,c.getGuardrailsList)(j)).guardrails.map(e=>e.guardrail_name);O(e)}catch(e){console.error("Failed to fetch guardrails:",e)}})()},[j]),(0,o.useEffect)(()=>{(async()=>{try{let e=await (0,c.tagListCall)(j);D(e)}catch(e){console.error("Failed to fetch tags:",e)}})()},[j]);let K=async()=>{P(!0),B("test-".concat(Date.now())),M(!0)},[J,W]=(0,o.useState)(!1),[Y,ei]=(0,o.useState)([]);(0,o.useEffect)(()=>{(async()=>{ei((await (0,c.modelAvailableCall)(j,"","",!1,null,!0,!0)).data.map(e=>e.id))})()},[j]);let en=(0,o.useMemo)(()=>U?[...U].sort((e,l)=>e.provider_display_name.localeCompare(l.provider_display_name)):[],[U]),eo=H?H instanceof Error?H.message:"Failed to load providers":null,ed=et.ZL.includes(v);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(Q.Z,{className:"w-full",children:[(0,s.jsxs)(X.Z,{className:"mb-4",children:[(0,s.jsx)($.Z,{children:"Add Model"}),(0,s.jsx)($.Z,{children:"Add Auto Router"})]}),(0,s.jsxs)(el.Z,{children:[(0,s.jsxs)(ee.Z,{children:[(0,s.jsx)(eG,{level:2,children:"Add Model"}),(0,s.jsx)(ea.Z,{children:(0,s.jsx)(N.Z,{form:l,onFinish:e=>{console.log("\uD83D\uDD25 Form onFinish triggered with values:",e),t()},onFinishFailed:e=>{console.log("\uD83D\uDCA5 Form onFinishFailed triggered:",e)},labelCol:{span:10},wrapperCol:{span:16},labelAlign:"left",children:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(N.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Provider:",name:"custom_llm_provider",tooltip:"E.g. OpenAI, Azure OpenAI, Anthropic, Bedrock, etc.",labelCol:{span:10},labelAlign:"left",children:(0,s.jsxs)(k.default,{showSearch:!0,loading:G,placeholder:G?"Loading providers...":"Select a provider",optionFilterProp:"data-label",onChange:e=>{r(e),d(e),l.setFieldsValue({custom_llm_provider:e}),l.setFieldsValue({model:[],model_name:void 0})},children:[eo&&0===en.length&&(0,s.jsx)(k.default.Option,{value:"",children:eo},"__error"),en.map(e=>{var l;let t=e.provider_display_name,a=e.provider,r=null!==(l=m.cd[t])&&void 0!==l?l:"";return(0,s.jsx)(k.default.Option,{value:a,"data-label":t,children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[r?(0,s.jsx)("img",{src:r,alt:"".concat(t," logo"),className:"w-5 h-5",onError:e=>{let l=e.currentTarget,s=l.parentElement;if(s&&s.contains(l))try{let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=t.charAt(0),s.replaceChild(e,l)}catch(e){console.error("Failed to replace provider logo fallback:",e)}}}):(0,s.jsx)("div",{className:"w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",children:t.charAt(0)}),(0,s.jsx)("span",{children:t})]})},a)})]})}),(0,s.jsx)(eU,{selectedProvider:a,providerModels:i,getPlaceholder:u}),(0,s.jsx)(eB,{}),(0,s.jsx)(N.Z.Item,{label:"Mode",name:"mode",className:"mb-1",children:(0,s.jsx)(k.default,{style:{width:"100%"},value:b,onChange:e=>Z(e),options:eA})}),(0,s.jsxs)(L.Z,{children:[(0,s.jsx)(T.Z,{span:10}),(0,s.jsx)(T.Z,{span:10,children:(0,s.jsxs)(n.Z,{className:"mb-5 mt-1",children:[(0,s.jsx)("strong",{children:"Optional"})," - LiteLLM endpoint to use when health checking this model"," ",(0,s.jsx)(eH,{href:"https://docs.litellm.ai/docs/proxy/health#health",target:"_blank",children:"Learn more"})]})})]}),(0,s.jsx)("div",{className:"mb-4",children:(0,s.jsx)(C.default.Text,{className:"text-sm text-gray-500 mb-2",children:"Either select existing credentials OR enter new provider credentials below"})}),(0,s.jsx)(N.Z.Item,{label:"Existing Credentials",name:"litellm_credential_name",initialValue:null,children:(0,s.jsx)(k.default,{showSearch:!0,placeholder:"Select or search for existing credentials",optionFilterProp:"children",filterOption:(e,l)=>{var t;return(null!==(t=null==l?void 0:l.label)&&void 0!==t?t:"").toLowerCase().includes(e.toLowerCase())},options:[{value:null,label:"None"},...f.map(e=>({value:e.credential_name,label:e.credential_name}))],allowClear:!0})}),(0,s.jsx)(N.Z.Item,{noStyle:!0,shouldUpdate:(e,l)=>e.litellm_credential_name!==l.litellm_credential_name||e.provider!==l.provider,children:e=>{let{getFieldValue:l}=e,t=l("litellm_credential_name");return(console.log("\uD83D\uDD11 Credential Name Changed:",t),t)?null:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex items-center my-4",children:[(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"}),(0,s.jsx)("span",{className:"px-4 text-gray-500 text-sm",children:"OR"}),(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"})]}),(0,s.jsx)(z,{selectedProvider:a,uploadProps:h})]})}}),(0,s.jsxs)("div",{className:"flex items-center my-4",children:[(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"}),(0,s.jsx)("span",{className:"px-4 text-gray-500 text-sm",children:"Additional Model Info Settings"}),(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"})]}),(0,s.jsx)(N.Z.Item,{label:"Team-BYOK Model",tooltip:"Only use this model + credential combination for this team. Useful when teams want to onboard their own OpenAI keys.",className:"mb-4",children:(0,s.jsx)(A.Z,{title:_?"":"This is an enterprise-only feature. Upgrade to premium to restrict model+credential combinations to a specific team.",placement:"top",children:(0,s.jsx)(es.Z,{checked:J,onChange:e=>{W(e),e||l.setFieldValue("team_id",void 0)},disabled:!_})})}),J&&(0,s.jsx)(N.Z.Item,{label:"Select Team",name:"team_id",className:"mb-4",tooltip:"Only keys for this team will be able to call this model.",rules:[{required:J&&!ed,message:"Please select a team."}],children:(0,s.jsx)(er.Z,{teams:g,disabled:!_})}),ed&&(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(N.Z.Item,{label:"Model Access Group",name:"model_access_group",className:"mb-4",tooltip:"Use model access groups to give users access to select models, and add new ones to the group over time.",children:(0,s.jsx)(k.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],options:Y.map(e=>({value:e,label:e})),maxTagCount:"responsive",allowClear:!0})})}),(0,s.jsx)(eV,{showAdvancedSettings:x,setShowAdvancedSettings:p,teams:g,guardrailsList:R,tagsList:V}),(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(A.Z,{title:"Get help on our github",children:(0,s.jsx)(C.default.Link,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{className:"space-x-2",children:[(0,s.jsx)(E.ZP,{onClick:K,loading:F,children:"Test Connect"}),(0,s.jsx)(E.ZP,{htmlType:"submit",children:"Add Model"})]})]})]})})})]}),(0,s.jsx)(ee.Z,{children:(0,s.jsx)(ek,{form:y,handleOk:()=>{y.validateFields().then(e=>{ex(e,j,y,t)}).catch(e=>{console.error("Validation failed:",e)})},accessToken:j,userRole:v})})]})]}),(0,s.jsx)(S.Z,{title:"Connection Test Results",open:w,onCancel:()=>{M(!1),P(!1)},footer:[(0,s.jsx)(E.ZP,{onClick:()=>{M(!1),P(!1)},children:"Close"},"close")],width:700,children:w&&(0,s.jsx)(eh,{formValues:l.getFieldsValue(),accessToken:j,testMode:b,modelName:l.getFieldValue("model_name")||l.getFieldValue("model"),onClose:()=>{M(!1),P(!1)},onTestComplete:()=>P(!1)},q)})]})},eJ=t(77331),eW=t(45589),eY=t(78489),e$=t(12514),eQ=t(49566),eX=t(96761),e0=t(30401),e1=t(78867),e2=t(59872),e4=e=>{let{isVisible:l,onCancel:t,onSuccess:a,modelData:r,accessToken:i,userRole:n}=e,[m]=N.Z.useForm(),[u,h]=(0,o.useState)(!1),[x,p]=(0,o.useState)([]),[g,f]=(0,o.useState)([]),[j,v]=(0,o.useState)(!1),[_,y]=(0,o.useState)(!1),[b,Z]=(0,o.useState)(null);(0,o.useEffect)(()=>{l&&r&&w()},[l,r]),(0,o.useEffect)(()=>{let e=async()=>{if(i)try{let e=await (0,c.modelAvailableCall)(i,"","",!1,null,!0,!0);p(e.data.map(e=>e.id))}catch(e){console.error("Error fetching model access groups:",e)}},t=async()=>{if(i)try{let e=await (0,ep.p)(i);f(e)}catch(e){console.error("Error fetching model info:",e)}};l&&(e(),t())},[l,i]);let w=()=>{try{var e,l,t,s,a,i;let n=null;(null===(e=r.litellm_params)||void 0===e?void 0:e.auto_router_config)&&(n="string"==typeof r.litellm_params.auto_router_config?JSON.parse(r.litellm_params.auto_router_config):r.litellm_params.auto_router_config),Z(n),m.setFieldsValue({auto_router_name:r.model_name,auto_router_default_model:(null===(l=r.litellm_params)||void 0===l?void 0:l.auto_router_default_model)||"",auto_router_embedding_model:(null===(t=r.litellm_params)||void 0===t?void 0:t.auto_router_embedding_model)||"",model_access_group:(null===(s=r.model_info)||void 0===s?void 0:s.access_groups)||[]});let o=new Set(g.map(e=>e.model_group));v(!o.has(null===(a=r.litellm_params)||void 0===a?void 0:a.auto_router_default_model)),y(!o.has(null===(i=r.litellm_params)||void 0===i?void 0:i.auto_router_embedding_model))}catch(e){console.error("Error parsing auto router config:",e),d.Z.fromBackend("Error loading auto router configuration")}},C=async()=>{try{h(!0);let e=await m.validateFields(),l={...r.litellm_params,auto_router_config:JSON.stringify(b),auto_router_default_model:e.auto_router_default_model,auto_router_embedding_model:e.auto_router_embedding_model||void 0},s={...r.model_info,access_groups:e.model_access_group||[]},n={model_name:e.auto_router_name,litellm_params:l,model_info:s};await (0,c.modelPatchUpdateCall)(i,n,r.model_info.id);let o={...r,model_name:e.auto_router_name,litellm_params:l,model_info:s};d.Z.success("Auto router configuration updated successfully"),a(o),t()}catch(e){console.error("Error updating auto router:",e),d.Z.fromBackend("Failed to update auto router configuration")}finally{h(!1)}},A=g.map(e=>({value:e.model_group,label:e.model_group}));return(0,s.jsx)(S.Z,{title:"Edit Auto Router Configuration",open:l,onCancel:t,footer:[(0,s.jsx)(E.ZP,{onClick:t,children:"Cancel"},"cancel"),(0,s.jsx)(E.ZP,{loading:u,onClick:C,children:"Save Changes"},"submit")],width:1e3,destroyOnClose:!0,children:(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsx)(P.x,{className:"text-gray-600",children:"Edit the auto router configuration including routing logic, default models, and access settings."}),(0,s.jsxs)(N.Z,{form:m,layout:"vertical",className:"space-y-4",children:[(0,s.jsx)(N.Z.Item,{label:"Auto Router Name",name:"auto_router_name",rules:[{required:!0,message:"Auto router name is required"}],children:(0,s.jsx)(P.o,{placeholder:"e.g., auto_router_1, smart_routing"})}),(0,s.jsx)("div",{className:"w-full",children:(0,s.jsx)(ew,{modelInfo:g,value:b,onChange:e=>{Z(e)}})}),(0,s.jsx)(N.Z.Item,{label:"Default Model",name:"auto_router_default_model",rules:[{required:!0,message:"Default model is required"}],children:(0,s.jsx)(k.default,{placeholder:"Select a default model",onChange:e=>{v("custom"===e)},options:[...A,{value:"custom",label:"Enter custom model name"}],showSearch:!0})}),(0,s.jsx)(N.Z.Item,{label:"Embedding Model",name:"auto_router_embedding_model",children:(0,s.jsx)(k.default,{placeholder:"Select an embedding model (optional)",onChange:e=>{y("custom"===e)},options:[...A,{value:"custom",label:"Enter custom model name"}],showSearch:!0,allowClear:!0})}),"Admin"===n&&(0,s.jsx)(N.Z.Item,{label:"Model Access Groups",name:"model_access_group",tooltip:"Control who can access this auto router",children:(0,s.jsx)(k.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],options:x.map(e=>({value:e,label:e})),maxTagCount:"responsive",allowClear:!0})})]})]})})};let{Title:e5,Link:e6}=C.default;var e3=e=>{let{isVisible:l,onCancel:t,onAddCredential:a,existingCredential:r,setIsCredentialModalOpen:i}=e,[n]=N.Z.useForm();return console.log("existingCredential in add credentials tab: ".concat(JSON.stringify(r))),(0,s.jsx)(S.Z,{title:"Reuse Credentials",visible:l,onCancel:()=>{t(),n.resetFields()},footer:null,width:600,children:(0,s.jsxs)(N.Z,{form:n,onFinish:e=>{a(e),n.resetFields(),i(!1)},layout:"vertical",children:[(0,s.jsx)(N.Z.Item,{label:"Credential Name:",name:"credential_name",rules:[{required:!0,message:"Credential name is required"}],initialValue:null==r?void 0:r.credential_name,children:(0,s.jsx)(w.o,{placeholder:"Enter a friendly name for these credentials"})}),Object.entries((null==r?void 0:r.credential_values)||{}).map(e=>{let[l,t]=e;return(0,s.jsx)(N.Z.Item,{label:l,name:l,initialValue:t,children:(0,s.jsx)(w.o,{placeholder:"Enter ".concat(l),disabled:!0})},l)}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(A.Z,{title:"Get help on our github",children:(0,s.jsx)(e6,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)(E.ZP,{onClick:()=>{t(),n.resetFields()},style:{marginRight:10},children:"Cancel"}),(0,s.jsx)(E.ZP,{htmlType:"submit",children:"Reuse Credentials"})]})]})]})})};function e8(e){var l,t,a,r,u,h,x,p,g,f,j,v,_,b,Z,w,C,M,I,F,P,L,T,R,O,V,D,z,q,B,U,G;let{modelId:H,onClose:K,modelData:Y,accessToken:et,userID:es,userRole:ea,editModel:er,setEditModalVisible:ei,setSelectedModel:en,onModelUpdate:eo,modelAccessGroups:ed}=e,[ec]=N.Z.useForm(),[eu,eh]=(0,o.useState)(null),[ex,ep]=(0,o.useState)(!1),[ef,ej]=(0,o.useState)(!1),[ev,e_]=(0,o.useState)(!1),[ey,eb]=(0,o.useState)(!1),[eN,eZ]=(0,o.useState)(!1),[ew,eC]=(0,o.useState)(null),[eS,ek]=(0,o.useState)(!1),[eA,eE]=(0,o.useState)({}),[eM,eI]=(0,o.useState)(!1),[eF,eL]=(0,o.useState)([]),[eO,eV]=(0,o.useState)({}),eD=("Admin"===ea||(null==Y?void 0:null===(l=Y.model_info)||void 0===l?void 0:l.created_by)===es)&&(null==Y?void 0:null===(t=Y.model_info)||void 0===t?void 0:t.db_model),ez="Admin"===ea,eq=(null==Y?void 0:null===(a=Y.litellm_params)||void 0===a?void 0:a.auto_router_config)!=null,eB=(null==Y?void 0:null===(r=Y.litellm_params)||void 0===r?void 0:r.litellm_credential_name)!=null&&(null==Y?void 0:null===(u=Y.litellm_params)||void 0===u?void 0:u.litellm_credential_name)!=void 0;console.log("usingExistingCredential, ",eB),console.log("modelData.litellm_params.litellm_credential_name, ",null==Y?void 0:null===(h=Y.litellm_params)||void 0===h?void 0:h.litellm_credential_name),console.log("tagsList, ",null===(x=Y.litellm_params)||void 0===x?void 0:x.tags),(0,o.useEffect)(()=>{let e=async()=>{var e,l,t,s,a,r,i;if(!et)return;let n=await (0,c.modelInfoV1Call)(et,H);console.log("modelInfoResponse, ",n);let o=n.data[0];o&&!o.litellm_model_name&&(o={...o,litellm_model_name:null!==(i=null!==(r=null!==(a=null==o?void 0:null===(l=o.litellm_params)||void 0===l?void 0:l.litellm_model_name)&&void 0!==a?a:null==o?void 0:null===(t=o.litellm_params)||void 0===t?void 0:t.model)&&void 0!==r?r:null==o?void 0:null===(s=o.model_info)||void 0===s?void 0:s.key)&&void 0!==i?i:null}),eh(o),(null==o?void 0:null===(e=o.litellm_params)||void 0===e?void 0:e.cache_control_injection_points)&&ek(!0)},l=async()=>{if(et)try{let e=(await (0,c.getGuardrailsList)(et)).guardrails.map(e=>e.guardrail_name);eL(e)}catch(e){console.error("Failed to fetch guardrails:",e)}},t=async()=>{if(et)try{let e=await (0,c.tagListCall)(et);eV(e)}catch(e){console.error("Failed to fetch tags:",e)}};(async()=>{if(console.log("accessToken, ",et),!et||eB)return;let e=await (0,c.credentialGetCall)(et,null,H);console.log("existingCredentialResponse, ",e),eC({credential_name:e.credential_name,credential_values:e.credential_values,credential_info:e.credential_info})})(),e(),l(),t()},[et,H]);let eU=async e=>{var l;if(console.log("values, ",e),!et)return;let t={credential_name:e.credential_name,model_id:H,credential_info:{custom_llm_provider:null===(l=eu.litellm_params)||void 0===l?void 0:l.custom_llm_provider}};d.Z.info("Storing credential.."),console.log("credentialResponse, ",await (0,c.credentialCreateCall)(et,t)),d.Z.success("Credential stored successfully")},eG=async e=>{try{var l;let t;if(!et)return;eb(!0),console.log("values.model_name, ",e.model_name);let s={};try{s=e.litellm_extra_params?JSON.parse(e.litellm_extra_params):{}}catch(e){d.Z.fromBackend("Invalid JSON in LiteLLM Params"),eb(!1);return}let a={...e.litellm_params,...s,model:e.litellm_model_name,api_base:e.api_base,custom_llm_provider:e.custom_llm_provider,organization:e.organization,tpm:e.tpm,rpm:e.rpm,max_retries:e.max_retries,timeout:e.timeout,stream_timeout:e.stream_timeout,input_cost_per_token:e.input_cost/1e6,output_cost_per_token:e.output_cost/1e6,tags:e.tags};e.guardrails&&(a.guardrails=e.guardrails),e.cache_control&&(null===(l=e.cache_control_injection_points)||void 0===l?void 0:l.length)>0?a.cache_control_injection_points=e.cache_control_injection_points:delete a.cache_control_injection_points;try{t=e.model_info?JSON.parse(e.model_info):Y.model_info,e.model_access_group&&(t={...t,access_groups:e.model_access_group})}catch(e){d.Z.fromBackend("Invalid JSON in Model Info");return}let r={model_name:e.model_name,litellm_params:a,model_info:t};await (0,c.modelPatchUpdateCall)(et,r,H);let i={...eu,model_name:e.model_name,litellm_model_name:e.litellm_model_name,litellm_params:a,model_info:t};eh(i),eo&&eo(i),d.Z.success("Model settings updated successfully"),e_(!1),eZ(!1)}catch(e){console.error("Error updating model:",e),d.Z.fromBackend("Failed to update model settings")}finally{eb(!1)}};if(!Y)return(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)(eY.Z,{icon:eJ.Z,variant:"light",onClick:K,className:"mb-4",children:"Back to Models"}),(0,s.jsx)(n.Z,{children:"Model not found"})]});let eH=async()=>{if(et)try{var e,l,t;d.Z.info("Testing connection...");let s=await (0,c.testConnectionRequest)(et,{custom_llm_provider:eu.litellm_params.custom_llm_provider,litellm_credential_name:eu.litellm_params.litellm_credential_name,model:eu.litellm_model_name},{mode:null===(e=eu.model_info)||void 0===e?void 0:e.mode},null===(l=eu.model_info)||void 0===l?void 0:l.mode);if("success"===s.status)d.Z.success("Connection test successful!");else throw Error((null==s?void 0:null===(t=s.result)||void 0===t?void 0:t.error)||(null==s?void 0:s.message)||"Unknown error")}catch(e){e instanceof Error?d.Z.error("Error testing connection: "+(0,eR.aS)(e.message,100)):d.Z.error("Error testing connection: "+String(e))}},eK=async()=>{try{if(!et)return;await (0,c.modelDeleteCall)(et,H),d.Z.success("Model deleted successfully"),eo&&eo({deleted:!0,model_info:{id:H}}),K()}catch(e){console.error("Error deleting the model:",e),d.Z.fromBackend("Failed to delete model")}},e5=async(e,l)=>{await (0,e2.vQ)(e)&&(eE(e=>({...e,[l]:!0})),setTimeout(()=>{eE(e=>({...e,[l]:!1}))},2e3))};return(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(eY.Z,{icon:eJ.Z,variant:"light",onClick:K,className:"mb-4",children:"Back to Models"}),(0,s.jsxs)(eX.Z,{children:["Public Model Name: ",J(Y)]}),(0,s.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,s.jsx)(n.Z,{className:"text-gray-500 font-mono",children:Y.model_info.id}),(0,s.jsx)(E.ZP,{type:"text",size:"small",icon:eA["model-id"]?(0,s.jsx)(e0.Z,{size:12}):(0,s.jsx)(e1.Z,{size:12}),onClick:()=>e5(Y.model_info.id,"model-id"),className:"left-2 z-10 transition-all duration-200 ".concat(eA["model-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(eY.Z,{variant:"secondary",icon:W.Z,onClick:eH,className:"flex items-center gap-2","data-testid":"test-connection-button",children:"Test Connection"}),(0,s.jsx)(eY.Z,{icon:eW.Z,variant:"secondary",onClick:()=>ej(!0),className:"flex items-center",disabled:!ez,"data-testid":"reuse-credentials-button",children:"Re-use Credentials"}),(0,s.jsx)(eY.Z,{icon:y.Z,variant:"secondary",onClick:()=>ep(!0),className:"flex items-center text-red-500 border-red-500 hover:text-red-700",disabled:!eD,"data-testid":"delete-model-button",children:"Delete Model"})]})]}),(0,s.jsxs)(Q.Z,{children:[(0,s.jsxs)(X.Z,{className:"mb-6",children:[(0,s.jsx)($.Z,{children:"Overview"}),(0,s.jsx)($.Z,{children:"Raw JSON"})]}),(0,s.jsxs)(el.Z,{children:[(0,s.jsxs)(ee.Z,{children:[(0,s.jsxs)(i.Z,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6 mb-6",children:[(0,s.jsxs)(e$.Z,{children:[(0,s.jsx)(n.Z,{children:"Provider"}),(0,s.jsxs)("div",{className:"mt-2 flex items-center space-x-2",children:[Y.provider&&(0,s.jsx)("img",{src:(0,m.dr)(Y.provider).logo,alt:"".concat(Y.provider," logo"),className:"w-4 h-4",onError:e=>{let l=e.currentTarget,t=l.parentElement;if(t&&t.contains(l))try{var s;let e=document.createElement("div");e.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=(null===(s=Y.provider)||void 0===s?void 0:s.charAt(0))||"-",t.replaceChild(e,l)}catch(e){console.error("Failed to replace provider logo fallback:",e)}}}),(0,s.jsx)(eX.Z,{children:Y.provider||"Not Set"})]})]}),(0,s.jsxs)(e$.Z,{children:[(0,s.jsx)(n.Z,{children:"LiteLLM Model"}),(0,s.jsx)("div",{className:"mt-2 overflow-hidden",children:(0,s.jsx)(A.Z,{title:Y.litellm_model_name||"Not Set",children:(0,s.jsx)("div",{className:"break-all text-sm font-medium leading-relaxed cursor-pointer",children:Y.litellm_model_name||"Not Set"})})})]}),(0,s.jsxs)(e$.Z,{children:[(0,s.jsx)(n.Z,{children:"Pricing"}),(0,s.jsxs)("div",{className:"mt-2",children:[(0,s.jsxs)(n.Z,{children:["Input: $",Y.input_cost,"/1M tokens"]}),(0,s.jsxs)(n.Z,{children:["Output: $",Y.output_cost,"/1M tokens"]})]})]})]}),(0,s.jsxs)("div",{className:"mb-6 text-sm text-gray-500 flex items-center gap-x-6",children:[(0,s.jsxs)("div",{className:"flex items-center gap-x-2",children:[(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Created At"," ",Y.model_info.created_at?new Date(Y.model_info.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"Not Set"]}),(0,s.jsxs)("div",{className:"flex items-center gap-x-2",children:[(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})}),"Created By ",Y.model_info.created_by||"Not Set"]})]}),(0,s.jsxs)(e$.Z,{children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(eX.Z,{children:"Model Settings"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[eq&&eD&&!eN&&(0,s.jsx)(eY.Z,{onClick:()=>eI(!0),className:"flex items-center",children:"Edit Auto Router"}),eD?!eN&&(0,s.jsx)(eY.Z,{onClick:()=>eZ(!0),className:"flex items-center",children:"Edit Settings"}):(0,s.jsx)(A.Z,{title:"Only DB models can be edited. You must be an admin or the creator of the model to edit it.",children:(0,s.jsx)(em.Z,{})})]})]}),eu?(0,s.jsx)(N.Z,{form:ec,onFinish:eG,initialValues:{model_name:eu.model_name,litellm_model_name:eu.litellm_model_name,api_base:eu.litellm_params.api_base,custom_llm_provider:eu.litellm_params.custom_llm_provider,organization:eu.litellm_params.organization,tpm:eu.litellm_params.tpm,rpm:eu.litellm_params.rpm,max_retries:eu.litellm_params.max_retries,timeout:eu.litellm_params.timeout,stream_timeout:eu.litellm_params.stream_timeout,input_cost:eu.litellm_params.input_cost_per_token?1e6*eu.litellm_params.input_cost_per_token:(null===(p=eu.model_info)||void 0===p?void 0:p.input_cost_per_token)*1e6||null,output_cost:(null===(g=eu.litellm_params)||void 0===g?void 0:g.output_cost_per_token)?1e6*eu.litellm_params.output_cost_per_token:(null===(f=eu.model_info)||void 0===f?void 0:f.output_cost_per_token)*1e6||null,cache_control:null!==(j=eu.litellm_params)&&void 0!==j&&!!j.cache_control_injection_points,cache_control_injection_points:(null===(v=eu.litellm_params)||void 0===v?void 0:v.cache_control_injection_points)||[],model_access_group:Array.isArray(null===(_=eu.model_info)||void 0===_?void 0:_.access_groups)?eu.model_info.access_groups:[],guardrails:Array.isArray(null===(b=eu.litellm_params)||void 0===b?void 0:b.guardrails)?eu.litellm_params.guardrails:[],tags:Array.isArray(null===(Z=eu.litellm_params)||void 0===Z?void 0:Z.tags)?eu.litellm_params.tags:[],litellm_extra_params:JSON.stringify(eu.litellm_params||{},null,2)},layout:"vertical",onValuesChange:()=>e_(!0),children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Model Name"}),eN?(0,s.jsx)(N.Z.Item,{name:"model_name",className:"mb-0",children:(0,s.jsx)(eQ.Z,{placeholder:"Enter model name"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:eu.model_name})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"LiteLLM Model Name"}),eN?(0,s.jsx)(N.Z.Item,{name:"litellm_model_name",className:"mb-0",children:(0,s.jsx)(eQ.Z,{placeholder:"Enter LiteLLM model name"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:eu.litellm_model_name})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Input Cost (per 1M tokens)"}),eN?(0,s.jsx)(N.Z.Item,{name:"input_cost",className:"mb-0",children:(0,s.jsx)(eP.Z,{placeholder:"Enter input cost"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null==eu?void 0:null===(w=eu.litellm_params)||void 0===w?void 0:w.input_cost_per_token)?((null===(C=eu.litellm_params)||void 0===C?void 0:C.input_cost_per_token)*1e6).toFixed(4):(null==eu?void 0:null===(M=eu.model_info)||void 0===M?void 0:M.input_cost_per_token)?(1e6*eu.model_info.input_cost_per_token).toFixed(4):null})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Output Cost (per 1M tokens)"}),eN?(0,s.jsx)(N.Z.Item,{name:"output_cost",className:"mb-0",children:(0,s.jsx)(eP.Z,{placeholder:"Enter output cost"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null==eu?void 0:null===(I=eu.litellm_params)||void 0===I?void 0:I.output_cost_per_token)?(1e6*eu.litellm_params.output_cost_per_token).toFixed(4):(null==eu?void 0:null===(F=eu.model_info)||void 0===F?void 0:F.output_cost_per_token)?(1e6*eu.model_info.output_cost_per_token).toFixed(4):null})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"API Base"}),eN?(0,s.jsx)(N.Z.Item,{name:"api_base",className:"mb-0",children:(0,s.jsx)(eQ.Z,{placeholder:"Enter API base"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(P=eu.litellm_params)||void 0===P?void 0:P.api_base)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Custom LLM Provider"}),eN?(0,s.jsx)(N.Z.Item,{name:"custom_llm_provider",className:"mb-0",children:(0,s.jsx)(eQ.Z,{placeholder:"Enter custom LLM provider"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(L=eu.litellm_params)||void 0===L?void 0:L.custom_llm_provider)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Organization"}),eN?(0,s.jsx)(N.Z.Item,{name:"organization",className:"mb-0",children:(0,s.jsx)(eQ.Z,{placeholder:"Enter organization"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(T=eu.litellm_params)||void 0===T?void 0:T.organization)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"TPM (Tokens per Minute)"}),eN?(0,s.jsx)(N.Z.Item,{name:"tpm",className:"mb-0",children:(0,s.jsx)(eP.Z,{placeholder:"Enter TPM"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(R=eu.litellm_params)||void 0===R?void 0:R.tpm)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"RPM (Requests per Minute)"}),eN?(0,s.jsx)(N.Z.Item,{name:"rpm",className:"mb-0",children:(0,s.jsx)(eP.Z,{placeholder:"Enter RPM"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(O=eu.litellm_params)||void 0===O?void 0:O.rpm)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Max Retries"}),eN?(0,s.jsx)(N.Z.Item,{name:"max_retries",className:"mb-0",children:(0,s.jsx)(eP.Z,{placeholder:"Enter max retries"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(V=eu.litellm_params)||void 0===V?void 0:V.max_retries)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Timeout (seconds)"}),eN?(0,s.jsx)(N.Z.Item,{name:"timeout",className:"mb-0",children:(0,s.jsx)(eP.Z,{placeholder:"Enter timeout"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(D=eu.litellm_params)||void 0===D?void 0:D.timeout)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Stream Timeout (seconds)"}),eN?(0,s.jsx)(N.Z.Item,{name:"stream_timeout",className:"mb-0",children:(0,s.jsx)(eP.Z,{placeholder:"Enter stream timeout"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(z=eu.litellm_params)||void 0===z?void 0:z.stream_timeout)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Model Access Groups"}),eN?(0,s.jsx)(N.Z.Item,{name:"model_access_group",className:"mb-0",children:(0,s.jsx)(k.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],maxTagCount:"responsive",allowClear:!0,style:{width:"100%"},options:null==ed?void 0:ed.map(e=>({value:e,label:e}))})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(q=eu.model_info)||void 0===q?void 0:q.access_groups)?Array.isArray(eu.model_info.access_groups)?eu.model_info.access_groups.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:eu.model_info.access_groups.map((e,l)=>(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-blue-100 text-blue-800",children:e},l))}):"No groups assigned":eu.model_info.access_groups:"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)(n.Z,{className:"font-medium",children:["Guardrails",(0,s.jsx)(A.Z,{title:"Apply safety guardrails to this model to filter content or enforce policies",children:(0,s.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,s.jsx)(em.Z,{style:{marginLeft:"4px"}})})})]}),eN?(0,s.jsx)(N.Z.Item,{name:"guardrails",className:"mb-0",children:(0,s.jsx)(k.default,{mode:"tags",showSearch:!0,placeholder:"Select existing guardrails or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],maxTagCount:"responsive",allowClear:!0,style:{width:"100%"},options:eF.map(e=>({value:e,label:e}))})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(B=eu.litellm_params)||void 0===B?void 0:B.guardrails)?Array.isArray(eu.litellm_params.guardrails)?eu.litellm_params.guardrails.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:eu.litellm_params.guardrails.map((e,l)=>(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-green-100 text-green-800",children:e},l))}):"No guardrails assigned":eu.litellm_params.guardrails:"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Tags"}),eN?(0,s.jsx)(N.Z.Item,{name:"tags",className:"mb-0",children:(0,s.jsx)(k.default,{mode:"tags",showSearch:!0,placeholder:"Select existing tags or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],maxTagCount:"responsive",allowClear:!0,style:{width:"100%"},options:Object.values(eO).map(e=>({value:e.name,label:e.name,title:e.description||e.name}))})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(U=eu.litellm_params)||void 0===U?void 0:U.tags)?Array.isArray(eu.litellm_params.tags)?eu.litellm_params.tags.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:eu.litellm_params.tags.map((e,l)=>(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-purple-100 text-purple-800",children:e},l))}):"No tags assigned":eu.litellm_params.tags:"Not Set"})]}),eN?(0,s.jsx)(eT,{form:ec,showCacheControl:eS,onCacheControlChange:e=>ek(e)}):(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Cache Control"}),(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(G=eu.litellm_params)||void 0===G?void 0:G.cache_control_injection_points)?(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{children:"Enabled"}),(0,s.jsx)("div",{className:"mt-2",children:eu.litellm_params.cache_control_injection_points.map((e,l)=>(0,s.jsxs)("div",{className:"text-sm text-gray-600 mb-1",children:["Location: ",e.location,",",e.role&&(0,s.jsxs)("span",{children:[" Role: ",e.role]}),void 0!==e.index&&(0,s.jsxs)("span",{children:[" Index: ",e.index]})]},l))})]}):"Disabled"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Model Info"}),eN?(0,s.jsx)(N.Z.Item,{name:"model_info",className:"mb-0",children:(0,s.jsx)(eg.default.TextArea,{rows:4,placeholder:'{"gpt-4": 100, "claude-v1": 200}',defaultValue:JSON.stringify(Y.model_info,null,2)})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(0,s.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify(eu.model_info,null,2)})})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)(n.Z,{className:"font-medium",children:["LiteLLM Params",(0,s.jsx)(A.Z,{title:"Optional litellm params used for making a litellm.completion() call. Some params are automatically added by LiteLLM.",children:(0,s.jsx)("a",{href:"https://docs.litellm.ai/docs/completion/input",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,s.jsx)(em.Z,{style:{marginLeft:"4px"}})})})]}),eN?(0,s.jsx)(N.Z.Item,{name:"litellm_extra_params",rules:[{validator:eR.Ac}],children:(0,s.jsx)(eg.default.TextArea,{rows:4,placeholder:'{ "rpm": 100, "timeout": 0, "stream_timeout": 0 }'})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(0,s.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify(eu.litellm_params,null,2)})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Team ID"}),(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:Y.model_info.team_id||"Not Set"})]})]}),eN&&(0,s.jsxs)("div",{className:"mt-6 flex justify-end gap-2",children:[(0,s.jsx)(eY.Z,{variant:"secondary",onClick:()=>{ec.resetFields(),e_(!1),eZ(!1)},disabled:ey,children:"Cancel"}),(0,s.jsx)(eY.Z,{variant:"primary",onClick:()=>ec.submit(),loading:ey,children:"Save Changes"})]})]})}):(0,s.jsx)(n.Z,{children:"Loading..."})]})]}),(0,s.jsx)(ee.Z,{children:(0,s.jsx)(e$.Z,{children:(0,s.jsx)("pre",{className:"bg-gray-100 p-4 rounded text-xs overflow-auto",children:JSON.stringify(Y,null,2)})})})]})]}),ex&&(0,s.jsx)("div",{className:"fixed z-10 inset-0 overflow-y-auto",children:(0,s.jsxs)("div",{className:"flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0",children:[(0,s.jsx)("div",{className:"fixed inset-0 transition-opacity","aria-hidden":"true",children:(0,s.jsx)("div",{className:"absolute inset-0 bg-gray-500 opacity-75"})}),(0,s.jsx)("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true",children:"​"}),(0,s.jsxs)("div",{className:"inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full",children:[(0,s.jsx)("div",{className:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4",children:(0,s.jsx)("div",{className:"sm:flex sm:items-start",children:(0,s.jsxs)("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[(0,s.jsx)("h3",{className:"text-lg leading-6 font-medium text-gray-900",children:"Delete Model"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)("p",{className:"text-sm text-gray-500",children:"Are you sure you want to delete this model?"})})]})})}),(0,s.jsxs)("div",{className:"bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse",children:[(0,s.jsx)(E.ZP,{onClick:eK,className:"ml-2",danger:!0,children:"Delete"}),(0,s.jsx)(E.ZP,{onClick:()=>ep(!1),children:"Cancel"})]})]})]})}),ef&&!eB?(0,s.jsx)(e3,{isVisible:ef,onCancel:()=>ej(!1),onAddCredential:eU,existingCredential:ew,setIsCredentialModalOpen:ej}):(0,s.jsx)(S.Z,{open:ef,onCancel:()=>ej(!1),title:"Using Existing Credential",children:(0,s.jsx)(n.Z,{children:Y.litellm_params.litellm_credential_name})}),(0,s.jsx)(e4,{isVisible:eM,onCancel:()=>eI(!1),onSuccess:e=>{eh(e),eo&&eo(e)},modelData:eu||Y,accessToken:et||"",userRole:ea||""})]})}var e7=t(33293),e9=t(11318),le=t(8048),ll=t(41649);let lt=e=>{let{provider:l,className:t="w-4 h-4"}=e,[a,r]=(0,o.useState)(!1),{logo:i}=(0,m.dr)(l);return a||!i?(0,s.jsx)("div",{className:"".concat(t," rounded-full bg-gray-200 flex items-center justify-center text-xs"),children:(null==l?void 0:l.charAt(0))||"-"}):(0,s.jsx)("img",{src:i,alt:"".concat(l," logo"),className:t,onError:()=>r(!0)})},ls=(e,l,t,a,r,i,n,o,d,c,m)=>[{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Model ID"}),accessorKey:"model_info.id",cell:e=>{let{row:l}=e,t=l.original;return(0,s.jsx)(A.Z,{title:t.model_info.id,children:(0,s.jsx)("div",{className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",onClick:()=>a(t.model_info.id),children:t.model_info.id})})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Model Information"}),accessorKey:"model_name",size:250,cell:e=>{let{row:l}=e,t=l.original,a=i(l.original)||"-",r=(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:"Provider:"})," ",t.provider||"-"]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:"Public Model Name:"})," ",a]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:"LiteLLM Model Name:"})," ",t.litellm_model_name||"-"]})]});return(0,s.jsx)(A.Z,{title:r,children:(0,s.jsxs)("div",{className:"flex items-start space-x-2 min-w-0 w-full max-w-[250px]",children:[(0,s.jsx)("div",{className:"flex-shrink-0 mt-0.5",children:t.provider?(0,s.jsx)(lt,{provider:t.provider}):(0,s.jsx)("div",{className:"w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",children:"-"})}),(0,s.jsxs)("div",{className:"flex flex-col min-w-0 flex-1",children:[(0,s.jsx)("div",{className:"text-xs font-medium text-gray-900 truncate max-w-[210px]",children:a}),(0,s.jsx)("div",{className:"text-xs text-gray-500 truncate mt-0.5 max-w-[210px]",children:t.litellm_model_name||"-"})]})]})})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Credentials"}),accessorKey:"litellm_credential_name",size:180,cell:e=>{var l;let{row:t}=e,a=null===(l=t.original.litellm_params)||void 0===l?void 0:l.litellm_credential_name;return a?(0,s.jsx)(A.Z,{title:"Credential: ".concat(a),children:(0,s.jsxs)("div",{className:"flex items-center space-x-2 max-w-[180px]",children:[(0,s.jsx)(eW.Z,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}),(0,s.jsx)("span",{className:"text-xs truncate",title:a,children:a})]})}):(0,s.jsxs)("div",{className:"flex items-center space-x-2 max-w-[180px]",children:[(0,s.jsx)(eW.Z,{className:"w-4 h-4 text-gray-300 flex-shrink-0"}),(0,s.jsx)("span",{className:"text-xs text-gray-400",children:"No credentials"})]})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Created By"}),accessorKey:"model_info.created_by",sortingFn:"datetime",size:160,cell:e=>{var l;let{row:t}=e,a=t.original,r=!(null===(l=a.model_info)||void 0===l?void 0:l.db_model),i=a.model_info.created_by,n=a.model_info.created_at?new Date(a.model_info.created_at).toLocaleDateString():null;return(0,s.jsxs)("div",{className:"flex flex-col min-w-0 max-w-[160px]",children:[(0,s.jsx)("div",{className:"text-xs font-medium text-gray-900 truncate",title:r?"Defined in config":i||"Unknown",children:r?"Defined in config":i||"Unknown"}),(0,s.jsx)("div",{className:"text-xs text-gray-500 truncate mt-0.5",title:r?"Config file":n||"Unknown date",children:r?"-":n||"Unknown date"})]})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Updated At"}),accessorKey:"model_info.updated_at",sortingFn:"datetime",cell:e=>{let{row:l}=e,t=l.original;return(0,s.jsx)("span",{className:"text-xs",children:t.model_info.updated_at?new Date(t.model_info.updated_at).toLocaleDateString():"-"})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Costs"}),accessorKey:"input_cost",size:120,cell:e=>{let{row:l}=e,t=l.original,a=t.input_cost,r=t.output_cost;return a||r?(0,s.jsx)(A.Z,{title:"Cost per 1M tokens",children:(0,s.jsxs)("div",{className:"flex flex-col min-w-0 max-w-[120px]",children:[a&&(0,s.jsxs)("div",{className:"text-xs font-medium text-gray-900 truncate",children:["In: $",a]}),r&&(0,s.jsxs)("div",{className:"text-xs text-gray-500 truncate mt-0.5",children:["Out: $",r]})]})}):(0,s.jsx)("div",{className:"max-w-[120px]",children:(0,s.jsx)("span",{className:"text-xs text-gray-400",children:"-"})})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Team ID"}),accessorKey:"model_info.team_id",cell:e=>{let{row:l}=e,t=l.original;return t.model_info.team_id?(0,s.jsx)("div",{className:"overflow-hidden",children:(0,s.jsx)(A.Z,{title:t.model_info.team_id,children:(0,s.jsxs)(eY.Z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate max-w-[200px]",onClick:()=>r(t.model_info.team_id),children:[t.model_info.team_id.slice(0,7),"..."]})})}):"-"}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Model Access Group"}),accessorKey:"model_info.model_access_group",enableSorting:!1,cell:e=>{let{row:l}=e,t=l.original,a=t.model_info.access_groups;if(!a||0===a.length)return"-";let r=t.model_info.id,i=c.has(r),n=a.length>1,o=()=>{let e=new Set(c);i?e.delete(r):e.add(r),m(e)};return(0,s.jsxs)("div",{className:"flex items-center gap-1 overflow-hidden",children:[(0,s.jsx)(ll.Z,{size:"xs",color:"blue",className:"text-xs px-1.5 py-0.5 h-5 leading-tight flex-shrink-0",children:a[0]}),(i||!n&&2===a.length)&&a.slice(1).map((e,l)=>(0,s.jsx)(ll.Z,{size:"xs",color:"blue",className:"text-xs px-1.5 py-0.5 h-5 leading-tight flex-shrink-0",children:e},l+1)),n&&(0,s.jsx)("button",{onClick:e=>{e.stopPropagation(),o()},className:"text-xs text-blue-600 hover:text-blue-800 px-1 py-0.5 rounded hover:bg-blue-50 h-5 leading-tight flex-shrink-0 whitespace-nowrap",children:i?"āˆ’":"+".concat(a.length-1)})]})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Status"}),accessorKey:"model_info.db_model",cell:e=>{let{row:l}=e,t=l.original;return(0,s.jsx)("div",{className:"\n inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium\n ".concat(t.model_info.db_model?"bg-blue-50 text-blue-600":"bg-gray-100 text-gray-600","\n "),children:t.model_info.db_model?"DB Model":"Config Model"})}},{id:"actions",header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Actions"}),cell:t=>{var r,i;let{row:n}=t,o=n.original,c="Admin"===e||(null===(r=o.model_info)||void 0===r?void 0:r.created_by)===l,m=!(null===(i=o.model_info)||void 0===i?void 0:i.db_model);return(0,s.jsx)("div",{className:"flex items-center justify-end gap-2 pr-4",children:m?(0,s.jsx)(A.Z,{title:"Config model cannot be deleted on the dashboard. Please delete it from the config file.",children:(0,s.jsx)(Y.Z,{icon:y.Z,size:"sm",className:"opacity-50 cursor-not-allowed"})}):(0,s.jsx)(A.Z,{title:"Delete model",children:(0,s.jsx)(Y.Z,{icon:y.Z,size:"sm",onClick:()=>{c&&(a(o.model_info.id),d(!1))},className:c?"cursor-pointer hover:text-red-600":"opacity-50 cursor-not-allowed"})})})}}];var la=t(27281),lr=t(43227),li=e=>{let{selectedModelGroup:l,setSelectedModelGroup:t,availableModelGroups:a,availableModelAccessGroups:r,setSelectedModelId:d,setSelectedTeamId:c,setEditModel:m,modelData:u}=e,{userId:h,userRole:x,premiumUser:p}=(0,H.Z)(),{teams:g}=(0,e9.Z)(),[f,j]=(0,o.useState)(""),[v,_]=(0,o.useState)("current_team"),[y,b]=(0,o.useState)("personal"),[N,Z]=(0,o.useState)(!1),[w,C]=(0,o.useState)(null),[S,k]=(0,o.useState)(new Set),[A,E]=(0,o.useState)({pageIndex:0,pageSize:50}),M=(0,o.useRef)(null),I=(0,o.useMemo)(()=>u&&u.data&&0!==u.data.length?u.data.filter(e=>{var t,s,a,r,i,n;let o=""===f||e.model_name.toLowerCase().includes(f.toLowerCase()),d="all"===l||e.model_name===l||!l||"wildcard"===l&&(null===(t=e.model_name)||void 0===t?void 0:t.includes("*")),c="all"===w||(null===(s=e.model_info.access_groups)||void 0===s?void 0:s.includes(w))||!w,m=!0;if("current_team"===v){if("personal"===y)m=(null===(a=e.model_info)||void 0===a?void 0:a.direct_access)===!0;else{let l=(null===(i=e.model_info)||void 0===i?void 0:null===(r=i.access_via_team_ids)||void 0===r?void 0:r.includes(y.team_id))===!0,t=(null===(n=y.models)||void 0===n?void 0:n.some(l=>{var t,s;return null===(s=e.model_info)||void 0===s?void 0:null===(t=s.access_groups)||void 0===t?void 0:t.includes(l)}))===!0;m=l||t}}return o&&d&&c&&m}):[],[u,f,l,w,y,v]),F=(0,o.useMemo)(()=>{let e=A.pageIndex*A.pageSize,l=e+A.pageSize;return I.slice(e,l)},[I,A.pageIndex,A.pageSize]);return(0,o.useEffect)(()=>{E(e=>({...e,pageIndex:0}))},[f,l,w,y,v]),(0,s.jsx)(ee.Z,{children:(0,s.jsx)(i.Z,{children:(0,s.jsx)("div",{className:"flex flex-col space-y-4",children:(0,s.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,s.jsxs)("div",{className:"border-b px-6 py-4 bg-gray-50",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsx)(n.Z,{className:"text-lg font-semibold text-gray-900",children:"Current Team:"}),(0,s.jsxs)(la.Z,{className:"w-80",defaultValue:"personal",value:"personal"===y?"personal":y.team_id,onValueChange:e=>{if("personal"===e)b("personal");else{let l=null==g?void 0:g.find(l=>l.team_id===e);l&&b(l)}},children:[(0,s.jsx)(lr.Z,{value:"personal",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,s.jsx)("span",{className:"font-medium",children:"Personal"})]})}),null==g?void 0:g.filter(e=>e.team_id).map(e=>(0,s.jsx)(lr.Z,{value:e.team_id,children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,s.jsx)("span",{className:"font-medium",children:e.team_alias?"".concat(e.team_alias.slice(0,30),"..."):"Team ".concat(e.team_id.slice(0,30),"...")})]})},e.team_id))]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsx)(n.Z,{className:"text-lg font-semibold text-gray-900",children:"View:"}),(0,s.jsxs)(la.Z,{className:"w-64",defaultValue:"current_team",value:v,onValueChange:e=>_(e),children:[(0,s.jsx)(lr.Z,{value:"current_team",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-purple-500 rounded-full"}),(0,s.jsx)("span",{className:"font-medium",children:"Current Team Models"})]})}),(0,s.jsx)(lr.Z,{value:"all",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-gray-500 rounded-full"}),(0,s.jsx)("span",{className:"font-medium",children:"All Available Models"})]})})]})]})]}),"current_team"===v&&(0,s.jsxs)("div",{className:"flex items-start gap-2 mt-3",children:[(0,s.jsx)(em.Z,{className:"text-gray-400 mt-0.5 flex-shrink-0 text-xs"}),(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"personal"===y?(0,s.jsxs)("span",{children:["To access these models: Create a Virtual Key without selecting a team on the"," ",(0,s.jsx)("a",{href:"/public?login=success&page=api-keys",className:"text-gray-600 hover:text-gray-800 underline",children:"Virtual Keys page"})]}):(0,s.jsxs)("span",{children:['To access these models: Create a Virtual Key and select Team as "',"string"!=typeof y?y.team_alias||y.team_id:"",'" on the'," ",(0,s.jsx)("a",{href:"/public?login=success&page=api-keys",className:"text-gray-600 hover:text-gray-800 underline",children:"Virtual Keys page"})]})})]})]}),(0,s.jsx)("div",{className:"border-b px-6 py-4",children:(0,s.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,s.jsxs)("div",{className:"relative w-64",children:[(0,s.jsx)("input",{type:"text",placeholder:"Search model names...",className:"w-full px-3 py-2 pl-8 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",value:f,onChange:e=>j(e.target.value)}),(0,s.jsx)("svg",{className:"absolute left-2.5 top-2.5 h-4 w-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})]}),(0,s.jsxs)("button",{className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2 ".concat(N?"bg-gray-100":""),onClick:()=>Z(!N),children:[(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"})}),"Filters"]}),(0,s.jsxs)("button",{className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",onClick:()=>{j(""),t("all"),C(null),b("personal"),_("current_team"),E({pageIndex:0,pageSize:50})},children:[(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Reset Filters"]})]}),N&&(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mt-3",children:[(0,s.jsx)("div",{className:"w-64",children:(0,s.jsxs)(la.Z,{value:null!=l?l:"all",onValueChange:e=>t("all"===e?"all":e),placeholder:"Filter by Public Model Name",children:[(0,s.jsx)(lr.Z,{value:"all",children:"All Models"}),(0,s.jsx)(lr.Z,{value:"wildcard",children:"Wildcard Models (*)"}),a.map((e,l)=>(0,s.jsx)(lr.Z,{value:e,children:e},l))]})}),(0,s.jsx)("div",{className:"w-64",children:(0,s.jsxs)(la.Z,{value:null!=w?w:"all",onValueChange:e=>C("all"===e?null:e),placeholder:"Filter by Model Access Group",children:[(0,s.jsx)(lr.Z,{value:"all",children:"All Model Access Groups"}),r.map((e,l)=>(0,s.jsx)(lr.Z,{value:e,children:e},l))]})})]}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)("span",{className:"text-sm text-gray-700",children:I.length>0?"Showing ".concat(A.pageIndex*A.pageSize+1," - ").concat(Math.min((A.pageIndex+1)*A.pageSize,I.length)," of ").concat(I.length," results"):"Showing 0 results"}),I.length>A.pageSize&&(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("button",{onClick:()=>E(e=>({...e,pageIndex:e.pageIndex-1})),disabled:0===A.pageIndex,className:"px-3 py-1 text-sm border rounded-md ".concat(0===A.pageIndex?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"),children:"Previous"}),(0,s.jsx)("button",{onClick:()=>E(e=>({...e,pageIndex:e.pageIndex+1})),disabled:A.pageIndex>=Math.ceil(I.length/A.pageSize)-1,className:"px-3 py-1 text-sm border rounded-md ".concat(A.pageIndex>=Math.ceil(I.length/A.pageSize)-1?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"),children:"Next"})]})]})]})}),(0,s.jsx)(le.C,{columns:ls(x,h,p,d,c,J,()=>{},()=>{},m,S,k),data:F,isLoading:!1,table:M})]})})})})},ln=t(75105),lo=t(40278),ld=t(97765),lc=t(21626),lm=t(97214),lu=t(28241),lh=t(58834),lx=t(69552),lp=t(71876),lg=t(39789),lf=t(79326),lj=t(2356),lv=t(59664),l_=e=>{let{modelMetrics:l,modelMetricsCategories:t,customTooltip:a,premiumUser:r}=e;return(0,s.jsx)(lv.Z,{title:"Time to First token (s)",className:"h-72",data:l,index:"date",showLegend:!1,categories:t,colors:["indigo","rose"],connectNulls:!0,customTooltip:a})},ly=e=>{let{setSelectedAPIKey:l,keys:t,teams:a,setSelectedCustomer:r,allEndUsers:i}=e,{premiumUser:d}=(0,H.Z)(),[c,m]=(0,o.useState)(null);return(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"mb-1",children:"Select API Key Name"}),d?(0,s.jsxs)("div",{children:[(0,s.jsxs)(la.Z,{defaultValue:"all-keys",children:[(0,s.jsx)(lr.Z,{value:"all-keys",onClick:()=>{l(null)},children:"All Keys"},"all-keys"),null==t?void 0:t.map((e,t)=>e&&null!==e.key_alias&&e.key_alias.length>0?(0,s.jsx)(lr.Z,{value:String(t),onClick:()=>{l(e)},children:e.key_alias},t):null)]}),(0,s.jsx)(n.Z,{className:"mt-1",children:"Select Customer Name"}),(0,s.jsxs)(la.Z,{defaultValue:"all-customers",children:[(0,s.jsx)(lr.Z,{value:"all-customers",onClick:()=>{r(null)},children:"All Customers"},"all-customers"),null==i?void 0:i.map((e,l)=>(0,s.jsx)(lr.Z,{value:e,onClick:()=>{r(e)},children:e},l))]}),(0,s.jsx)(n.Z,{className:"mt-1",children:"Select Team"}),(0,s.jsxs)(la.Z,{className:"w-64 relative z-50",defaultValue:"all",value:null!=c?c:"all",onValueChange:e=>m("all"===e?null:e),children:[(0,s.jsx)(lr.Z,{value:"all",children:"All Teams"}),null==a?void 0:a.filter(e=>e.team_id).map(e=>(0,s.jsx)(lr.Z,{value:e.team_id,children:e.team_alias?"".concat(e.team_alias," (").concat(e.team_id.slice(0,8),"...)"):"Team ".concat(e.team_id.slice(0,8),"...")},e.team_id))]})]}):(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"mt-1",children:"Select Team"}),(0,s.jsxs)(la.Z,{className:"w-64 relative z-50",defaultValue:"all",value:null!=c?c:"all",onValueChange:e=>m("all"===e?null:e),children:[(0,s.jsx)(lr.Z,{value:"all",children:"All Teams"}),null==a?void 0:a.filter(e=>e.team_id).map(e=>(0,s.jsx)(lr.Z,{value:e.team_id,children:e.team_alias?"".concat(e.team_alias," (").concat(e.team_id.slice(0,8),"...)"):"Team ".concat(e.team_id.slice(0,8),"...")},e.team_id))]})]})]})},lb=e=>{let{dateValue:l,setDateValue:t,selectedModelGroup:a,availableModelGroups:d,setShowAdvancedFilters:m,modelMetrics:u,modelMetricsCategories:h,streamingModelMetrics:x,streamingModelMetricsCategories:p,customTooltip:g,slowResponsesData:f,modelExceptions:j,globalExceptionData:v,allExceptions:_,globalExceptionPerDeployment:y,setSelectedAPIKey:b,keys:N,setSelectedCustomer:Z,teams:w,allEndUsers:C,selectedAPIKey:S,selectedCustomer:k,selectedTeam:A,setSelectedModelGroup:E,setModelMetrics:M,setModelMetricsCategories:I,setStreamingModelMetrics:F,setStreamingModelMetricsCategories:P,setSlowResponsesData:L,setModelExceptions:T,setAllExceptions:R,setGlobalExceptionData:O,setGlobalExceptionPerDeployment:V}=e,{accessToken:D,userId:z,userRole:q,premiumUser:B}=(0,H.Z)();(0,o.useEffect)(()=>{U(a,l.from,l.to)},[S,k,A]);let U=async(e,l,t)=>{if(console.log("Updating model metrics for group:",e),!D||!z||!q||!l||!t)return;console.log("inside updateModelMetrics - startTime:",l,"endTime:",t),E(e);let s=null==S?void 0:S.token;void 0===s&&(s=null);let a=k;void 0===a&&(a=null);try{let r=await (0,c.modelMetricsCall)(D,z,q,e,l.toISOString(),t.toISOString(),s,a);console.log("Model metrics response:",r),M(r.data),I(r.all_api_bases);let i=await (0,c.streamingModelMetricsCall)(D,e,l.toISOString(),t.toISOString());F(i.data),P(i.all_api_bases);let n=await (0,c.modelExceptionsCall)(D,z,q,e,l.toISOString(),t.toISOString(),s,a);console.log("Model exceptions response:",n),T(n.data),R(n.exception_types);let o=await (0,c.modelMetricsSlowResponsesCall)(D,z,q,e,l.toISOString(),t.toISOString(),s,a);if(console.log("slowResponses:",o),L(o),e){let s=await (0,c.adminGlobalActivityExceptions)(D,null==l?void 0:l.toISOString().split("T")[0],null==t?void 0:t.toISOString().split("T")[0],e);O(s);let a=await (0,c.adminGlobalActivityExceptionsPerDeployment)(D,null==l?void 0:l.toISOString().split("T")[0],null==t?void 0:t.toISOString().split("T")[0],e);V(a)}}catch(e){console.error("Failed to fetch model metrics",e)}};return(0,s.jsxs)(ee.Z,{children:[(0,s.jsx)("div",{className:"mb-4 rounded-md border border-red-500 bg-red-50 p-4",children:(0,s.jsx)(n.Z,{className:"font-semibold text-red-700",children:"This page is deprecated and will be removed in the future. Some functionality may not work as expected."})}),(0,s.jsxs)(i.Z,{numItems:4,className:"mt-2 mb-2",children:[(0,s.jsx)(r.Z,{children:(0,s.jsx)(lg.Z,{value:l,className:"mr-2",onValueChange:e=>{t(e),U(a,e.from,e.to)}})}),(0,s.jsxs)(r.Z,{className:"ml-2",children:[(0,s.jsx)(n.Z,{children:"Select Model Group"}),(0,s.jsx)(la.Z,{defaultValue:a||d[0],value:a||d[0],children:d.map((e,t)=>(0,s.jsx)(lr.Z,{value:e,onClick:()=>U(e,l.from,l.to),children:e},t))})]}),(0,s.jsx)(r.Z,{children:(0,s.jsx)(lf.Z,{trigger:"click",content:(0,s.jsx)(ly,{allEndUsers:C,keys:N,setSelectedAPIKey:b,setSelectedCustomer:Z,teams:w}),overlayStyle:{width:"20vw"},children:(0,s.jsx)(eY.Z,{icon:lj.Z,size:"md",variant:"secondary",className:"mt-4 ml-2",style:{border:"none"},onClick:()=>m(!0)})})})]}),(0,s.jsxs)(i.Z,{numItems:2,children:[(0,s.jsx)(r.Z,{children:(0,s.jsx)(e$.Z,{className:"mr-2 max-h-[400px] min-h-[400px]",children:(0,s.jsxs)(Q.Z,{children:[(0,s.jsxs)(X.Z,{variant:"line",defaultValue:"1",children:[(0,s.jsx)($.Z,{value:"1",children:"Avg. Latency per Token"}),(0,s.jsx)($.Z,{value:"2",children:"Time to first token"})]}),(0,s.jsxs)(el.Z,{children:[(0,s.jsxs)(ee.Z,{children:[(0,s.jsx)("p",{className:"text-gray-500 italic",children:" (seconds/token)"}),(0,s.jsx)(n.Z,{className:"text-gray-500 italic mt-1 mb-1",children:"average Latency for successfull requests divided by the total tokens"}),u&&h&&(0,s.jsx)(ln.Z,{title:"Model Latency",className:"h-72",data:u,showLegend:!1,index:"date",categories:h,connectNulls:!0,customTooltip:g})]}),(0,s.jsx)(ee.Z,{children:(0,s.jsx)(l_,{modelMetrics:x,modelMetricsCategories:p,customTooltip:g,premiumUser:B})})]})]})})}),(0,s.jsx)(r.Z,{children:(0,s.jsx)(e$.Z,{className:"ml-2 max-h-[400px] min-h-[400px] overflow-y-auto",children:(0,s.jsxs)(lc.Z,{children:[(0,s.jsx)(lh.Z,{children:(0,s.jsxs)(lp.Z,{children:[(0,s.jsx)(lx.Z,{children:"Deployment"}),(0,s.jsx)(lx.Z,{children:"Success Responses"}),(0,s.jsxs)(lx.Z,{children:["Slow Responses ",(0,s.jsx)("p",{children:"Success Responses taking 600+s"})]})]})}),(0,s.jsx)(lm.Z,{children:f.map((e,l)=>(0,s.jsxs)(lp.Z,{children:[(0,s.jsx)(lu.Z,{children:e.api_base}),(0,s.jsx)(lu.Z,{children:e.total_count}),(0,s.jsx)(lu.Z,{children:e.slow_count})]},l))})]})})})]}),(0,s.jsx)(i.Z,{numItems:1,className:"gap-2 w-full mt-2",children:(0,s.jsxs)(e$.Z,{children:[(0,s.jsxs)(eX.Z,{children:["All Exceptions for ",a]}),(0,s.jsx)(lo.Z,{className:"h-60",data:j,index:"model",categories:_,stack:!0,yAxisWidth:30})]})}),(0,s.jsxs)(i.Z,{numItems:1,className:"gap-2 w-full mt-2",children:[(0,s.jsxs)(e$.Z,{children:[(0,s.jsxs)(eX.Z,{children:["All Up Rate Limit Errors (429) for ",a]}),(0,s.jsxs)(i.Z,{numItems:1,children:[(0,s.jsxs)(r.Z,{children:[(0,s.jsxs)(ld.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Num Rate Limit Errors ",v.sum_num_rate_limit_exceptions]}),(0,s.jsx)(lo.Z,{className:"h-40",data:v.daily_data,index:"date",colors:["rose"],categories:["num_rate_limit_exceptions"],onValueChange:e=>console.log(e)})]}),(0,s.jsx)(r.Z,{})]})]}),B?(0,s.jsx)(s.Fragment,{children:y.map((e,l)=>(0,s.jsxs)(e$.Z,{children:[(0,s.jsx)(eX.Z,{children:e.api_base?e.api_base:"Unknown API Base"}),(0,s.jsx)(i.Z,{numItems:1,children:(0,s.jsxs)(r.Z,{children:[(0,s.jsxs)(ld.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Num Rate Limit Errors (429) ",e.sum_num_rate_limit_exceptions]}),(0,s.jsx)(lo.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["rose"],categories:["num_rate_limit_exceptions"],onValueChange:e=>console.log(e)})]})})]},l))}):(0,s.jsx)(s.Fragment,{children:y&&y.length>0&&y.slice(0,1).map((e,l)=>(0,s.jsxs)(e$.Z,{children:[(0,s.jsx)(eX.Z,{children:"✨ Rate Limit Errors by Deployment"}),(0,s.jsx)("p",{className:"mb-2 text-gray-500 italic text-[12px]",children:"Upgrade to see exceptions for all deployments"}),(0,s.jsx)(eY.Z,{variant:"primary",className:"mb-2",children:(0,s.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get Free Trial"})}),(0,s.jsxs)(e$.Z,{children:[(0,s.jsx)(eX.Z,{children:e.api_base}),(0,s.jsx)(i.Z,{numItems:1,children:(0,s.jsxs)(r.Z,{children:[(0,s.jsxs)(ld.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Num Rate Limit Errors ",e.sum_num_rate_limit_exceptions]}),(0,s.jsx)(lo.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["rose"],categories:["num_rate_limit_exceptions"],onValueChange:e=>console.log(e)})]})})]})]},l))})]})]})};let lN={"BadRequestError (400)":"BadRequestErrorRetries","AuthenticationError (401)":"AuthenticationErrorRetries","TimeoutError (408)":"TimeoutErrorRetries","RateLimitError (429)":"RateLimitErrorRetries","ContentPolicyViolationError (400)":"ContentPolicyViolationErrorRetries","InternalServerError (500)":"InternalServerErrorRetries"};var lZ=e=>{let{selectedModelGroup:l,setSelectedModelGroup:t,availableModelGroups:a,globalRetryPolicy:r,setGlobalRetryPolicy:i,defaultRetry:o,modelGroupRetryPolicy:d,setModelGroupRetryPolicy:c,handleSaveRetrySettings:m}=e;return(0,s.jsxs)(ee.Z,{children:[(0,s.jsx)("div",{className:"flex items-center gap-4 mb-6",children:(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(n.Z,{children:"Retry Policy Scope:"}),(0,s.jsxs)(la.Z,{className:"ml-2 w-48",defaultValue:"global",value:"global"===l?"global":l||a[0],onValueChange:e=>t(e),children:[(0,s.jsx)(lr.Z,{value:"global",children:"Global Default"}),a.map((e,l)=>(0,s.jsx)(lr.Z,{value:e,onClick:()=>t(e),children:e},l))]})]})}),"global"===l?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eX.Z,{children:"Global Retry Policy"}),(0,s.jsx)(n.Z,{className:"mb-6",children:"Default retry settings applied to all model groups unless overridden"})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(eX.Z,{children:["Retry Policy for ",l]}),(0,s.jsx)(n.Z,{className:"mb-6",children:"Model-specific retry settings. Falls back to global defaults if not set."})]}),lN&&(0,s.jsx)("table",{children:(0,s.jsx)("tbody",{children:Object.entries(lN).map((e,t)=>{var a,m,u,h;let x,[p,g]=e;if("global"===l)x=null!==(a=null==r?void 0:r[g])&&void 0!==a?a:o;else{let e=null==d?void 0:null===(m=d[l])||void 0===m?void 0:m[g];x=null!=e?e:null!==(u=null==r?void 0:r[g])&&void 0!==u?u:o}return(0,s.jsxs)("tr",{className:"flex justify-between items-center mt-2",children:[(0,s.jsxs)("td",{children:[(0,s.jsx)(n.Z,{children:p}),"global"!==l&&(0,s.jsxs)(n.Z,{className:"text-xs text-gray-500 ml-2",children:["(Global: ",null!==(h=null==r?void 0:r[g])&&void 0!==h?h:o,")"]})]}),(0,s.jsx)("td",{children:(0,s.jsx)(ej.Z,{className:"ml-5",value:x,min:0,step:1,onChange:e=>{"global"===l?i(l=>null==e?l:{...null!=l?l:{},[g]:e}):c(t=>{var s;let a=null!==(s=null==t?void 0:t[l])&&void 0!==s?s:{};return{...null!=t?t:{},[l]:{...a,[g]:e}}})}})})]},t)})})}),(0,s.jsx)(eY.Z,{className:"mt-6 mr-8",onClick:m,children:"Save"})]})},lw=t(58760),lC=t(867),lS=t(3810),lk=t(89245),lA=t(5540),lE=t(8881);let{Text:lM}=C.default;var lI=e=>{let{accessToken:l,onReloadSuccess:t,buttonText:a="Reload Price Data",showIcon:r=!0,size:i="middle",type:n="primary",className:m=""}=e,[u,h]=(0,o.useState)(!1),[x,p]=(0,o.useState)(!1),[g,f]=(0,o.useState)(!1),[j,v]=(0,o.useState)(!1),[_,y]=(0,o.useState)(6),[b,N]=(0,o.useState)(null),[Z,w]=(0,o.useState)(!1);(0,o.useEffect)(()=>{C();let e=setInterval(()=>{C()},3e4);return()=>clearInterval(e)},[l]);let C=async()=>{if(l){w(!0);try{console.log("Fetching reload status...");let e=await (0,c.getModelCostMapReloadStatus)(l);console.log("Received status:",e),N(e)}catch(e){console.error("Failed to fetch reload status:",e),N({scheduled:!1,interval_hours:null,last_run:null,next_run:null})}finally{w(!1)}}},k=async()=>{if(!l){d.Z.fromBackend("No access token available");return}h(!0);try{let e=await (0,c.reloadModelCostMap)(l);"success"===e.status?(d.Z.success("Price data reloaded successfully! ".concat(e.models_count||0," models updated.")),null==t||t(),await C()):d.Z.fromBackend("Failed to reload price data")}catch(e){console.error("Error reloading price data:",e),d.Z.fromBackend("Failed to reload price data. Please try again.")}finally{h(!1)}},A=async()=>{if(!l){d.Z.fromBackend("No access token available");return}if(_<=0){d.Z.fromBackend("Hours must be greater than 0");return}p(!0);try{let e=await (0,c.scheduleModelCostMapReload)(l,_);"success"===e.status?(d.Z.success("Periodic reload scheduled for every ".concat(_," hours")),v(!1),await C()):d.Z.fromBackend("Failed to schedule periodic reload")}catch(e){console.error("Error scheduling reload:",e),d.Z.fromBackend("Failed to schedule periodic reload. Please try again.")}finally{p(!1)}},M=async()=>{if(!l){d.Z.fromBackend("No access token available");return}f(!0);try{let e=await (0,c.cancelModelCostMapReload)(l);"success"===e.status?(d.Z.success("Periodic reload cancelled successfully"),await C()):d.Z.fromBackend("Failed to cancel periodic reload")}catch(e){console.error("Error cancelling reload:",e),d.Z.fromBackend("Failed to cancel periodic reload. Please try again.")}finally{f(!1)}},I=e=>{if(!e)return"Never";try{return new Date(e).toLocaleString()}catch(l){return e}};return(0,s.jsxs)("div",{className:m,children:[(0,s.jsxs)(lw.Z,{direction:"horizontal",size:"middle",style:{marginBottom:16},children:[(0,s.jsx)(lC.Z,{title:"Hard Refresh Price Data",description:"This will immediately fetch the latest pricing information from the remote source. Continue?",onConfirm:k,okText:"Yes",cancelText:"No",okButtonProps:{style:{backgroundColor:"#6366f1",borderColor:"#6366f1",color:"white",fontWeight:"500",borderRadius:"0.375rem",padding:"0.375rem 0.75rem",height:"auto",fontSize:"0.875rem",lineHeight:"1.25rem",transition:"all 0.2s ease-in-out"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#4f46e5"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#6366f1"}},children:(0,s.jsx)(E.ZP,{type:n,size:i,loading:u,icon:r?(0,s.jsx)(lk.Z,{}):void 0,style:{backgroundColor:"#6366f1",borderColor:"#6366f1",color:"white",fontWeight:"500",borderRadius:"0.375rem",padding:"0.375rem 0.75rem",height:"auto",fontSize:"0.875rem",lineHeight:"1.25rem",transition:"all 0.2s ease-in-out"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#4f46e5"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#6366f1"},children:a})}),(null==b?void 0:b.scheduled)?(0,s.jsx)(E.ZP,{type:"default",size:i,danger:!0,icon:(0,s.jsx)(lE.Z,{}),loading:g,onClick:M,style:{borderColor:"#ff4d4f",color:"#ff4d4f",fontWeight:"500",borderRadius:"0.375rem",padding:"0.375rem 0.75rem",height:"auto",fontSize:"0.875rem",lineHeight:"1.25rem"},children:"Cancel Periodic Reload"}):(0,s.jsx)(E.ZP,{type:"default",size:i,icon:(0,s.jsx)(lA.Z,{}),onClick:()=>v(!0),style:{borderColor:"#d9d9d9",color:"#6366f1",fontWeight:"500",borderRadius:"0.375rem",padding:"0.375rem 0.75rem",height:"auto",fontSize:"0.875rem",lineHeight:"1.25rem"},children:"Set Up Periodic Reload"})]}),b&&(0,s.jsx)(ea.Z,{size:"small",style:{backgroundColor:"#f8f9fa",border:"1px solid #e9ecef",borderRadius:8},children:(0,s.jsxs)(lw.Z,{direction:"vertical",size:"small",style:{width:"100%"},children:[b.scheduled?(0,s.jsx)("div",{children:(0,s.jsxs)(lS.Z,{color:"green",icon:(0,s.jsx)(lA.Z,{}),children:["Scheduled every ",b.interval_hours," hours"]})}):(0,s.jsx)(lM,{type:"secondary",children:"No periodic reload scheduled"}),(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsx)(lM,{type:"secondary",style:{fontSize:"12px"},children:"Last run:"}),(0,s.jsx)(lM,{style:{fontSize:"12px"},children:I(b.last_run)})]}),b.scheduled&&(0,s.jsxs)(s.Fragment,{children:[b.next_run&&(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsx)(lM,{type:"secondary",style:{fontSize:"12px"},children:"Next run:"}),(0,s.jsx)(lM,{style:{fontSize:"12px"},children:I(b.next_run)})]}),(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsx)(lM,{type:"secondary",style:{fontSize:"12px"},children:"Status:"}),(0,s.jsx)(lS.Z,{color:(null==b?void 0:b.scheduled)?b.last_run?"success":"processing":"default",children:(null==b?void 0:b.scheduled)?b.last_run?"Active":"Ready":"Not scheduled"})]})]})]})}),(0,s.jsxs)(S.Z,{title:"Set Up Periodic Reload",open:j,onOk:A,onCancel:()=>v(!1),confirmLoading:x,okText:"Schedule",cancelText:"Cancel",okButtonProps:{style:{backgroundColor:"#6366f1",borderColor:"#6366f1",color:"white"}},children:[(0,s.jsx)("div",{style:{marginBottom:16},children:(0,s.jsx)(lM,{children:"Set up automatic reload of price data every:"})}),(0,s.jsx)("div",{style:{marginBottom:16},children:(0,s.jsx)(ej.Z,{min:1,max:168,value:_,onChange:e=>y(e||6),addonAfter:"hours",style:{width:"100%"}})}),(0,s.jsx)("div",{children:(0,s.jsxs)(lM,{type:"secondary",children:["This will automatically fetch the latest pricing data from the remote source every ",_," hours."]})})]})]})},lF=e=>{let{setModelMap:l}=e,{accessToken:t}=(0,H.Z)();return(0,s.jsx)(ee.Z,{children:(0,s.jsxs)("div",{className:"p-6",children:[(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)(eX.Z,{children:"Price Data Management"}),(0,s.jsx)(n.Z,{className:"text-tremor-content",children:"Manage model pricing data and configure automatic reload schedules"})]}),(0,s.jsx)(lI,{accessToken:t,onReloadSuccess:()=>{(async()=>{l(await (0,c.modelCostMap)(t))})()},buttonText:"Reload Price Data",size:"middle",type:"primary",className:"w-full"})]})})},lP=t(61994),lL=t(15731),lT=t(91126);let lR=(e,l,t,a,r,i,n,o,d,c,m)=>[{header:()=>(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(lP.Z,{checked:t,indeterminate:l.length>0&&!t,onChange:e=>r(e.target.checked),onClick:e=>e.stopPropagation()}),(0,s.jsx)("span",{children:"Model ID"})]}),accessorKey:"model_info.id",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:t}=e,r=t.original,i=r.model_name,n=l.includes(i);return(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(lP.Z,{checked:n,onChange:e=>a(i,e.target.checked),onClick:e=>e.stopPropagation()}),(0,s.jsx)(A.Z,{title:r.model_info.id,children:(0,s.jsx)("div",{className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",onClick:()=>m&&m(r.model_info.id),children:r.model_info.id})})]})}},{header:"Model Name",accessorKey:"model_name",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,t=l.original,a=o(t)||t.model_name;return(0,s.jsx)("div",{className:"font-medium text-sm",children:(0,s.jsx)(A.Z,{title:a,children:(0,s.jsx)("div",{className:"truncate max-w-[200px]",children:a})})})}},{header:"Health Status",accessorKey:"health_status",enableSorting:!0,sortingFn:(e,l,t)=>{var s,a;let r=e.getValue("health_status")||"unknown",i=l.getValue("health_status")||"unknown",n={healthy:0,checking:1,unknown:2,unhealthy:3};return(null!==(s=n[r])&&void 0!==s?s:4)-(null!==(a=n[i])&&void 0!==a?a:4)},cell:l=>{var t;let{row:a}=l,r=a.original,i={status:r.health_status,loading:r.health_loading,error:r.health_error};if(i.loading)return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsxs)("div",{className:"flex space-x-1",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-indigo-500 rounded-full animate-pulse"}),(0,s.jsx)("div",{className:"w-2 h-2 bg-indigo-500 rounded-full animate-pulse",style:{animationDelay:"0.2s"}}),(0,s.jsx)("div",{className:"w-2 h-2 bg-indigo-500 rounded-full animate-pulse",style:{animationDelay:"0.4s"}})]}),(0,s.jsx)(eb.x,{className:"text-gray-600 text-sm",children:"Checking..."})]});let o=r.model_name,d="healthy"===i.status&&(null===(t=e[o])||void 0===t?void 0:t.successResponse);return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[n(i.status),d&&c&&(0,s.jsx)(A.Z,{title:"View response details",placement:"top",children:(0,s.jsx)("button",{onClick:()=>{var l;return c(o,null===(l=e[o])||void 0===l?void 0:l.successResponse)},className:"p-1 text-green-600 hover:text-green-800 hover:bg-green-50 rounded cursor-pointer transition-colors",children:(0,s.jsx)(lL.Z,{className:"h-4 w-4"})})})]})}},{header:"Error Details",accessorKey:"health_error",enableSorting:!1,cell:l=>{let{row:t}=l,a=t.original.model_name,r=e[a];if(!(null==r?void 0:r.error))return(0,s.jsx)(eb.x,{className:"text-gray-400 text-sm",children:"No errors"});let i=r.error,n=r.fullError||r.error;return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"max-w-[200px]",children:(0,s.jsx)(A.Z,{title:i,placement:"top",children:(0,s.jsx)(eb.x,{className:"text-red-600 text-sm truncate",children:i})})}),d&&n!==i&&(0,s.jsx)(A.Z,{title:"View full error details",placement:"top",children:(0,s.jsx)("button",{onClick:()=>d(a,i,n),className:"p-1 text-red-600 hover:text-red-800 hover:bg-red-50 rounded cursor-pointer transition-colors",children:(0,s.jsx)(lL.Z,{className:"h-4 w-4"})})})]})}},{header:"Last Check",accessorKey:"last_check",enableSorting:!0,sortingFn:(e,l,t)=>{let s=e.getValue("last_check")||"Never checked",a=l.getValue("last_check")||"Never checked";if("Never checked"===s&&"Never checked"===a)return 0;if("Never checked"===s)return 1;if("Never checked"===a)return -1;if("Check in progress..."===s&&"Check in progress..."===a)return 0;if("Check in progress..."===s)return -1;if("Check in progress..."===a)return 1;let r=new Date(s),i=new Date(a);return isNaN(r.getTime())&&isNaN(i.getTime())?0:isNaN(r.getTime())?1:isNaN(i.getTime())?-1:i.getTime()-r.getTime()},cell:e=>{let{row:l}=e,t=l.original;return(0,s.jsx)(eb.x,{className:"text-gray-600 text-sm",children:t.health_loading?"Check in progress...":t.last_check})}},{header:"Last Success",accessorKey:"last_success",enableSorting:!0,sortingFn:(e,l,t)=>{let s=e.getValue("last_success")||"Never succeeded",a=l.getValue("last_success")||"Never succeeded";if("Never succeeded"===s&&"Never succeeded"===a)return 0;if("Never succeeded"===s)return 1;if("Never succeeded"===a)return -1;if("None"===s&&"None"===a)return 0;if("None"===s)return 1;if("None"===a)return -1;let r=new Date(s),i=new Date(a);return isNaN(r.getTime())&&isNaN(i.getTime())?0:isNaN(r.getTime())?1:isNaN(i.getTime())?-1:i.getTime()-r.getTime()},cell:l=>{let{row:t}=l,a=e[t.original.model_name],r=(null==a?void 0:a.lastSuccess)||"None";return(0,s.jsx)(eb.x,{className:"text-gray-600 text-sm",children:r})}},{header:"Actions",id:"actions",cell:e=>{let{row:l}=e,t=l.original,a=t.model_name,r=t.health_status&&"none"!==t.health_status,n=t.health_loading?"Checking...":r?"Re-run Health Check":"Run Health Check";return(0,s.jsx)(A.Z,{title:n,placement:"top",children:(0,s.jsx)("button",{className:"p-2 rounded-md transition-colors ".concat(t.health_loading?"text-gray-400 cursor-not-allowed bg-gray-100":"text-indigo-600 hover:text-indigo-700 hover:bg-indigo-50"),onClick:()=>{t.health_loading||i(a)},disabled:t.health_loading,children:t.health_loading?(0,s.jsxs)("div",{className:"flex space-x-1",children:[(0,s.jsx)("div",{className:"w-1 h-1 bg-gray-400 rounded-full animate-pulse"}),(0,s.jsx)("div",{className:"w-1 h-1 bg-gray-400 rounded-full animate-pulse",style:{animationDelay:"0.2s"}}),(0,s.jsx)("div",{className:"w-1 h-1 bg-gray-400 rounded-full animate-pulse",style:{animationDelay:"0.4s"}})]}):r?(0,s.jsx)(W.Z,{className:"h-4 w-4"}):(0,s.jsx)(lT.Z,{className:"h-4 w-4"})})})},enableSorting:!1}],lO=[{pattern:/Missing .* API Key/i,replacement:"Missing API Key"},{pattern:/Connection timeout/i,replacement:"Connection timeout"},{pattern:/Network.*not.*ok/i,replacement:"Network connection failed"},{pattern:/403.*Forbidden/i,replacement:"Access forbidden - check API key permissions"},{pattern:/401.*Unauthorized/i,replacement:"Unauthorized - invalid API key"},{pattern:/429.*rate limit/i,replacement:"Rate limit exceeded"},{pattern:/500.*Internal Server Error/i,replacement:"Provider internal server error"},{pattern:/litellm\.AuthenticationError/i,replacement:"Authentication failed"},{pattern:/litellm\.RateLimitError/i,replacement:"Rate limit exceeded"},{pattern:/litellm\.APIError/i,replacement:"API error"}];var lV=e=>{let{accessToken:l,modelData:t,all_models_on_proxy:a,getDisplayModelName:r,setSelectedModelId:i}=e,[d,m]=(0,o.useState)({}),[u,h]=(0,o.useState)([]),[x,p]=(0,o.useState)(!1),[g,f]=(0,o.useState)(!1),[j,v]=(0,o.useState)(null),[_,y]=(0,o.useState)(!1),[b,N]=(0,o.useState)(null),Z=(0,o.useRef)(null);(0,o.useEffect)(()=>{l&&(null==t?void 0:t.data)&&(async()=>{let e={};t.data.forEach(l=>{e[l.model_name]={status:"none",lastCheck:"None",lastSuccess:"None",loading:!1,error:void 0,fullError:void 0,successResponse:void 0}});try{let s=await (0,c.latestHealthChecksCall)(l);s&&s.latest_health_checks&&"object"==typeof s.latest_health_checks&&Object.entries(s.latest_health_checks).forEach(l=>{let[s,a]=l;if(!a)return;let r=null,i=t.data.find(e=>e.model_name===s);if(i)r=i.model_name;else{let e=t.data.find(e=>e.model_info&&e.model_info.id===s);if(e)r=e.model_name;else if(a.model_name){let e=t.data.find(e=>e.model_name===a.model_name);e&&(r=e.model_name)}}if(r){let l=a.error_message||void 0;e[r]={status:a.status||"unknown",lastCheck:a.checked_at?new Date(a.checked_at).toLocaleString():"None",lastSuccess:"healthy"===a.status&&a.checked_at?new Date(a.checked_at).toLocaleString():"None",loading:!1,error:l?w(l):void 0,fullError:l,successResponse:"healthy"===a.status?a:void 0}}})}catch(e){console.warn("Failed to load health check history (using default states):",e)}m(e)})()},[l,t]);let w=e=>{var l;if(!e)return"Health check failed";let t="string"==typeof e?e:JSON.stringify(e),s=t.match(/(\w+Error):\s*(\d{3})/i);if(s)return"".concat(s[1],": ").concat(s[2]);let a=t.match(/(AuthenticationError|RateLimitError|BadRequestError|InternalServerError|TimeoutError|NotFoundError|ForbiddenError|ServiceUnavailableError|BadGatewayError|ContentPolicyViolationError|\w+Error)/i),r=t.match(/\b(400|401|403|404|408|429|500|502|503|504)\b/);if(a&&r)return"".concat(a[1],": ").concat(r[1]);if(r){let e=r[1];return"".concat({400:"BadRequestError",401:"AuthenticationError",403:"ForbiddenError",404:"NotFoundError",408:"TimeoutError",429:"RateLimitError",500:"InternalServerError",502:"BadGatewayError",503:"ServiceUnavailableError",504:"GatewayTimeoutError"}[e],": ").concat(e)}if(a){let e=a[1],l={AuthenticationError:"401",RateLimitError:"429",BadRequestError:"400",InternalServerError:"500",TimeoutError:"408",NotFoundError:"404",ForbiddenError:"403",ServiceUnavailableError:"503",BadGatewayError:"502",GatewayTimeoutError:"504",ContentPolicyViolationError:"400"}[e];return l?"".concat(e,": ").concat(l):e}for(let{pattern:e,replacement:l}of lO)if(e.test(t))return l;if(/missing.*api.*key|invalid.*key|unauthorized/i.test(t))return"AuthenticationError: 401";if(/rate.*limit|too.*many.*requests/i.test(t))return"RateLimitError: 429";if(/timeout|timed.*out/i.test(t))return"TimeoutError: 408";if(/not.*found/i.test(t))return"NotFoundError: 404";if(/forbidden|access.*denied/i.test(t))return"ForbiddenError: 403";if(/internal.*server.*error/i.test(t))return"InternalServerError: 500";let i=t.replace(/[\n\r]+/g," ").replace(/\s+/g," ").trim(),n=null===(l=i.split(/[.!?]/)[0])||void 0===l?void 0:l.trim();return n&&n.length>0?n.length>100?n.substring(0,97)+"...":n:i.length>100?i.substring(0,97)+"...":i},C=async e=>{if(l){m(l=>({...l,[e]:{...l[e],loading:!0,status:"checking"}}));try{var s,a;let r=await (0,c.individualModelHealthCheckCall)(l,e),i=new Date().toLocaleString();if(r.unhealthy_count>0&&r.unhealthy_endpoints&&r.unhealthy_endpoints.length>0){let l=(null===(s=r.unhealthy_endpoints[0])||void 0===s?void 0:s.error)||"Health check failed",t=w(l);m(s=>{var a;return{...s,[e]:{status:"unhealthy",lastCheck:i,lastSuccess:(null===(a=s[e])||void 0===a?void 0:a.lastSuccess)||"None",loading:!1,error:t,fullError:l}}})}else m(l=>({...l,[e]:{status:"healthy",lastCheck:i,lastSuccess:i,loading:!1,successResponse:r}}));try{let s=await (0,c.latestHealthChecksCall)(l),r=t.data.find(l=>l.model_name===e);if(r){let l=r.model_info.id,t=null===(a=s.latest_health_checks)||void 0===a?void 0:a[l];if(t){let l=t.error_message||void 0;m(s=>{var a,r,i,n,o,d,c;return{...s,[e]:{status:t.status||(null===(a=s[e])||void 0===a?void 0:a.status)||"unknown",lastCheck:t.checked_at?new Date(t.checked_at).toLocaleString():(null===(r=s[e])||void 0===r?void 0:r.lastCheck)||"None",lastSuccess:"healthy"===t.status?t.checked_at?new Date(t.checked_at).toLocaleString():(null===(i=s[e])||void 0===i?void 0:i.lastSuccess)||"None":(null===(n=s[e])||void 0===n?void 0:n.lastSuccess)||"None",loading:!1,error:l?w(l):null===(o=s[e])||void 0===o?void 0:o.error,fullError:l||(null===(d=s[e])||void 0===d?void 0:d.fullError),successResponse:"healthy"===t.status?t:null===(c=s[e])||void 0===c?void 0:c.successResponse}}})}}}catch(e){console.debug("Could not fetch updated status from database (non-critical):",e)}}catch(a){let l=new Date().toLocaleString(),t=a instanceof Error?a.message:String(a),s=w(t);m(a=>{var r;return{...a,[e]:{status:"unhealthy",lastCheck:l,lastSuccess:(null===(r=a[e])||void 0===r?void 0:r.lastSuccess)||"None",loading:!1,error:s,fullError:t}}})}}},k=async()=>{let e=u.length>0?u:a,s=e.reduce((e,l)=>(e[l]={...d[l],loading:!0,status:"checking"},e),{});m(e=>({...e,...s}));let r={},i=e.map(async e=>{if(l)try{let s=await (0,c.individualModelHealthCheckCall)(l,e);r[e]=s;let a=new Date().toLocaleString();if(s.unhealthy_count>0&&s.unhealthy_endpoints&&s.unhealthy_endpoints.length>0){var t;let l=(null===(t=s.unhealthy_endpoints[0])||void 0===t?void 0:t.error)||"Health check failed",r=w(l);m(t=>{var s;return{...t,[e]:{status:"unhealthy",lastCheck:a,lastSuccess:(null===(s=t[e])||void 0===s?void 0:s.lastSuccess)||"None",loading:!1,error:r,fullError:l}}})}else m(l=>({...l,[e]:{status:"healthy",lastCheck:a,lastSuccess:a,loading:!1,successResponse:s}}))}catch(a){console.error("Health check failed for ".concat(e,":"),a);let l=new Date().toLocaleString(),t=a instanceof Error?a.message:String(a),s=w(t);m(a=>{var r;return{...a,[e]:{status:"unhealthy",lastCheck:l,lastSuccess:(null===(r=a[e])||void 0===r?void 0:r.lastSuccess)||"None",loading:!1,error:s,fullError:t}}})}});await Promise.allSettled(i);try{if(!l)return;let s=await (0,c.latestHealthChecksCall)(l);s.latest_health_checks&&Object.entries(s.latest_health_checks).forEach(l=>{let[s,a]=l,r=t.data.find(e=>e.model_info.id===s);if(r&&e.includes(r.model_name)&&a){let e=r.model_name,l=a.error_message||void 0;m(t=>{let s=t[e];return{...t,[e]:{status:a.status||(null==s?void 0:s.status)||"unknown",lastCheck:a.checked_at?new Date(a.checked_at).toLocaleString():(null==s?void 0:s.lastCheck)||"None",lastSuccess:"healthy"===a.status&&a.checked_at?new Date(a.checked_at).toLocaleString():(null==s?void 0:s.lastSuccess)||"None",loading:!1,error:l?w(l):null==s?void 0:s.error,fullError:l||(null==s?void 0:s.fullError),successResponse:"healthy"===a.status?a:null==s?void 0:s.successResponse}}})}})}catch(e){console.warn("Failed to fetch updated health statuses from database (non-critical):",e)}},A=e=>{p(e),e?h(a):h([])},M=()=>{f(!1),v(null)},I=()=>{y(!1),N(null)};return(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"mb-6",children:(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(eX.Z,{children:"Model Health Status"}),(0,s.jsx)(n.Z,{className:"text-gray-600 mt-1",children:"Run health checks on individual models to verify they are working correctly"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[u.length>0&&(0,s.jsx)(eY.Z,{size:"sm",variant:"light",onClick:()=>A(!1),className:"px-3 py-1 text-sm",children:"Clear Selection"}),(0,s.jsx)(eY.Z,{size:"sm",variant:"secondary",onClick:k,disabled:Object.values(d).some(e=>e.loading),className:"px-3 py-1 text-sm",children:u.length>0&&u.length{l?h(l=>[...l,e]):(h(l=>l.filter(l=>l!==e)),p(!1))},A,C,e=>{switch(e){case"healthy":return(0,s.jsx)(ll.Z,{color:"emerald",children:"healthy"});case"unhealthy":return(0,s.jsx)(ll.Z,{color:"red",children:"unhealthy"});case"checking":return(0,s.jsx)(ll.Z,{color:"blue",children:"checking"});case"none":return(0,s.jsx)(ll.Z,{color:"gray",children:"none"});default:return(0,s.jsx)(ll.Z,{color:"gray",children:"unknown"})}},r,(e,l,t)=>{v({modelName:e,cleanedError:l,fullError:t}),f(!0)},(e,l)=>{N({modelName:e,response:l}),y(!0)},i),data:t.data.map(e=>{let l=d[e.model_name]||{status:"none",lastCheck:"None",loading:!1};return{model_name:e.model_name,model_info:e.model_info,provider:e.provider,litellm_model_name:e.litellm_model_name,health_status:l.status,last_check:l.lastCheck,last_success:l.lastSuccess||"None",health_loading:l.loading,health_error:l.error,health_full_error:l.fullError}}),isLoading:!1,table:Z})}),(0,s.jsx)(S.Z,{title:j?"Health Check Error - ".concat(j.modelName):"Error Details",open:g,onCancel:M,footer:[(0,s.jsx)(E.ZP,{onClick:M,children:"Close"},"close")],width:800,children:j&&(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Error:"}),(0,s.jsx)("div",{className:"mt-2 p-3 bg-red-50 border border-red-200 rounded-md",children:(0,s.jsx)(n.Z,{className:"text-red-800",children:j.cleanedError})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Full Error Details:"}),(0,s.jsx)("div",{className:"mt-2 p-3 bg-gray-50 border border-gray-200 rounded-md max-h-96 overflow-y-auto",children:(0,s.jsx)("pre",{className:"text-sm text-gray-800 whitespace-pre-wrap",children:j.fullError})})]})]})}),(0,s.jsx)(S.Z,{title:b?"Health Check Response - ".concat(b.modelName):"Response Details",open:_,onCancel:I,footer:[(0,s.jsx)(E.ZP,{onClick:I,children:"Close"},"close")],width:800,children:b&&(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Status:"}),(0,s.jsx)("div",{className:"mt-2 p-3 bg-green-50 border border-green-200 rounded-md",children:(0,s.jsx)(n.Z,{className:"text-green-800",children:"Health check passed successfully"})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Response Details:"}),(0,s.jsx)("div",{className:"mt-2 p-3 bg-gray-50 border border-gray-200 rounded-md max-h-96 overflow-y-auto",children:(0,s.jsx)("pre",{className:"text-sm text-gray-800 whitespace-pre-wrap",children:JSON.stringify(b.response,null,2)})})]})]})})]})},lD=t(86462),lz=t(47686),lq=t(77355),lB=t(93416),lU=t(95704),lG=e=>{let{accessToken:l,initialModelGroupAlias:t={},onAliasUpdate:a}=e,[r,i]=(0,o.useState)([]),[n,m]=(0,o.useState)({aliasName:"",targetModelGroup:""}),[u,h]=(0,o.useState)(null),[x,p]=(0,o.useState)(!0);(0,o.useEffect)(()=>{i(Object.entries(t).map((e,l)=>{var t;let[s,a]=e;return{id:"".concat(l,"-").concat(s),aliasName:s,targetModelGroup:"string"==typeof a?a:null!==(t=null==a?void 0:a.model)&&void 0!==t?t:""}}))},[t]);let g=async e=>{if(!l)return console.error("Access token is missing"),!1;try{let t={};return e.forEach(e=>{t[e.aliasName]=e.targetModelGroup}),console.log("Saving model group alias:",t),await (0,c.setCallbacksCall)(l,{router_settings:{model_group_alias:t}}),a&&a(t),!0}catch(e){return console.error("Failed to save model group alias settings:",e),d.Z.fromBackend("Failed to save model group alias settings"),!1}},f=async()=>{if(!n.aliasName||!n.targetModelGroup){d.Z.fromBackend("Please provide both alias name and target model group");return}if(r.some(e=>e.aliasName===n.aliasName)){d.Z.fromBackend("An alias with this name already exists");return}let e=[...r,{id:"".concat(Date.now(),"-").concat(n.aliasName),aliasName:n.aliasName,targetModelGroup:n.targetModelGroup}];await g(e)&&(i(e),m({aliasName:"",targetModelGroup:""}),d.Z.success("Alias added successfully"))},j=e=>{h({...e})},v=async()=>{if(!u)return;if(!u.aliasName||!u.targetModelGroup){d.Z.fromBackend("Please provide both alias name and target model group");return}if(r.some(e=>e.id!==u.id&&e.aliasName===u.aliasName)){d.Z.fromBackend("An alias with this name already exists");return}let e=r.map(e=>e.id===u.id?u:e);await g(e)&&(i(e),h(null),d.Z.success("Alias updated successfully"))},_=()=>{h(null)},b=async e=>{let l=r.filter(l=>l.id!==e);await g(l)&&(i(l),d.Z.success("Alias deleted successfully"))},N=r.reduce((e,l)=>(e[l.aliasName]=l.targetModelGroup,e),{});return(0,s.jsxs)(lU.Zb,{className:"mb-6",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between cursor-pointer",onClick:()=>p(!x),children:[(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)(lU.Dx,{className:"mb-0",children:"Model Group Alias Settings"}),(0,s.jsx)("p",{className:"text-sm text-gray-500",children:"Create aliases for your model groups to simplify API calls. For example, you can create an alias 'gpt-4o' that points to 'gpt-4o-mini-openai' model group."})]}),(0,s.jsx)("div",{className:"flex items-center",children:x?(0,s.jsx)(lD.Z,{className:"w-5 h-5 text-gray-500"}):(0,s.jsx)(lz.Z,{className:"w-5 h-5 text-gray-500"})})]}),x&&(0,s.jsxs)("div",{className:"mt-4",children:[(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)(lU.xv,{className:"text-sm font-medium text-gray-700 mb-2",children:"Add New Alias"}),(0,s.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Alias Name"}),(0,s.jsx)("input",{type:"text",value:n.aliasName,onChange:e=>m({...n,aliasName:e.target.value}),placeholder:"e.g., gpt-4o",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Target Model Group"}),(0,s.jsx)("input",{type:"text",value:n.targetModelGroup,onChange:e=>m({...n,targetModelGroup:e.target.value}),placeholder:"e.g., gpt-4o-mini-openai",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,s.jsx)("div",{className:"flex items-end",children:(0,s.jsxs)("button",{onClick:f,disabled:!n.aliasName||!n.targetModelGroup,className:"flex items-center px-4 py-2 rounded-md text-sm ".concat(n.aliasName&&n.targetModelGroup?"bg-green-600 text-white hover:bg-green-700":"bg-gray-300 text-gray-500 cursor-not-allowed"),children:[(0,s.jsx)(lq.Z,{className:"w-4 h-4 mr-1"}),"Add Alias"]})})]})]}),(0,s.jsx)(lU.xv,{className:"text-sm font-medium text-gray-700 mb-2",children:"Manage Existing Aliases"}),(0,s.jsx)("div",{className:"rounded-lg custom-border relative mb-6",children:(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsxs)(lU.iA,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,s.jsx)(lU.ss,{children:(0,s.jsxs)(lU.SC,{children:[(0,s.jsx)(lU.xs,{className:"py-1 h-8",children:"Alias Name"}),(0,s.jsx)(lU.xs,{className:"py-1 h-8",children:"Target Model Group"}),(0,s.jsx)(lU.xs,{className:"py-1 h-8",children:"Actions"})]})}),(0,s.jsxs)(lU.RM,{children:[r.map(e=>(0,s.jsx)(lU.SC,{className:"h-8",children:u&&u.id===e.id?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(lU.pj,{className:"py-0.5",children:(0,s.jsx)("input",{type:"text",value:u.aliasName,onChange:e=>h({...u,aliasName:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,s.jsx)(lU.pj,{className:"py-0.5",children:(0,s.jsx)("input",{type:"text",value:u.targetModelGroup,onChange:e=>h({...u,targetModelGroup:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,s.jsx)(lU.pj,{className:"py-0.5 whitespace-nowrap",children:(0,s.jsxs)("div",{className:"flex space-x-2",children:[(0,s.jsx)("button",{onClick:v,className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:"Save"}),(0,s.jsx)("button",{onClick:_,className:"text-xs bg-gray-50 text-gray-600 px-2 py-1 rounded hover:bg-gray-100",children:"Cancel"})]})})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(lU.pj,{className:"py-0.5 text-sm text-gray-900",children:e.aliasName}),(0,s.jsx)(lU.pj,{className:"py-0.5 text-sm text-gray-500",children:e.targetModelGroup}),(0,s.jsx)(lU.pj,{className:"py-0.5 whitespace-nowrap",children:(0,s.jsxs)("div",{className:"flex space-x-2",children:[(0,s.jsx)("button",{onClick:()=>j(e),className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:(0,s.jsx)(lB.Z,{className:"w-3 h-3"})}),(0,s.jsx)("button",{onClick:()=>b(e.id),className:"text-xs bg-red-50 text-red-600 px-2 py-1 rounded hover:bg-red-100",children:(0,s.jsx)(y.Z,{className:"w-3 h-3"})})]})})]})},e.id)),0===r.length&&(0,s.jsx)(lU.SC,{children:(0,s.jsx)(lU.pj,{colSpan:3,className:"py-0.5 text-sm text-gray-500 text-center",children:"No aliases added yet. Add a new alias above."})})]})]})})}),(0,s.jsxs)(lU.Zb,{children:[(0,s.jsx)(lU.Dx,{className:"mb-4",children:"Configuration Example"}),(0,s.jsx)(lU.xv,{className:"text-gray-600 mb-4",children:"Here's how your current aliases would look in the config.yaml:"}),(0,s.jsx)("div",{className:"bg-gray-100 rounded-lg p-4 font-mono text-sm",children:(0,s.jsxs)("div",{className:"text-gray-700",children:["router_settings:",(0,s.jsx)("br",{}),"\xa0\xa0model_group_alias:",0===Object.keys(N).length?(0,s.jsxs)("span",{className:"text-gray-500",children:[(0,s.jsx)("br",{}),"\xa0\xa0\xa0\xa0# No aliases configured yet"]}):Object.entries(N).map(e=>{let[l,t]=e;return(0,s.jsxs)("span",{children:[(0,s.jsx)("br",{}),'\xa0\xa0\xa0\xa0"',l,'": "',t,'"']},l)})]})})]})]})]})},lH=t(27593),lK=e=>{let{accessToken:l,token:t,userRole:u,userID:x,modelData:p={data:[]},keys:g,setModelData:j,premiumUser:_,teams:y}=e,[b]=N.Z.useForm(),[Z,w]=(0,o.useState)(null),[S,k]=(0,o.useState)(""),[A,E]=(0,o.useState)([]),[M,I]=(0,o.useState)([]),[F,P]=(0,o.useState)(m.Cl.Anthropic),[L,T]=(0,o.useState)(!1),[R,O]=(0,o.useState)(null),[V,D]=(0,o.useState)([]),[z,q]=(0,o.useState)([]),[B,U]=(0,o.useState)(null),[G,H]=(0,o.useState)([]),[es,ea]=(0,o.useState)([]),[er,ei]=(0,o.useState)([]),[en,eo]=(0,o.useState)([]),[ed,ec]=(0,o.useState)([]),[em,eu]=(0,o.useState)([]),[eh,ex]=(0,o.useState)([]),[ep,eg]=(0,o.useState)({from:new Date(Date.now()-6048e5),to:new Date}),[ef,ej]=(0,o.useState)(null),[ev,e_]=(0,o.useState)(null),[ey,eb]=(0,o.useState)(0),[eN,eZ]=(0,o.useState)({}),[ew,eC]=(0,o.useState)([]),[eS,ek]=(0,o.useState)(!1),[eA,eE]=(0,o.useState)(null),[eM,eI]=(0,o.useState)(null),[eF,eP]=(0,o.useState)([]),[eL,eT]=(0,o.useState)({}),[eR,eO]=(0,o.useState)(!1),[eV,eD]=(0,o.useState)(null),[ez,eq]=(0,o.useState)(!1),[eB,eU]=(0,o.useState)(null),[eG,eH]=(0,o.useState)(null),[eJ,eW]=(0,o.useState)(!1),eY=(0,o.useRef)(null),[e$,eQ]=(0,o.useState)(0),eX=(0,a.NL)(),{data:e0,isLoading:e1,refetch:e2}=v(l,x,u),{data:e4}=f(l),e5=(null==e4?void 0:e4.credentials)||[];(0,o.useEffect)(()=>{let e=e=>{eY.current&&!eY.current.contains(e.target)&&eW(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let e6={name:"file",accept:".json",pastable:!1,beforeUpload:e=>{if("application/json"===e.type){let l=new FileReader;l.onload=e=>{if(e.target){let l=e.target.result;b.setFieldsValue({vertex_credentials:l})}},l.readAsText(e)}return!1},onChange(e){"done"===e.file.status?d.Z.success("".concat(e.file.name," file uploaded successfully")):"error"===e.file.status&&d.Z.fromBackend("".concat(e.file.name," file upload failed."))}},e3=()=>{k(new Date().toLocaleString()),eX.invalidateQueries({queryKey:["models","list"]}),e2()},e9=async()=>{if(l)try{let e={router_settings:{}};"global"===B?(ev&&(e.router_settings.retry_policy=ev),d.Z.success("Global retry settings saved successfully")):(ef&&(e.router_settings.model_group_retry_policy=ef),d.Z.success("Retry settings saved successfully for ".concat(B))),await (0,c.setCallbacksCall)(l,e)}catch(e){d.Z.fromBackend("Failed to save retry settings")}};if((0,o.useEffect)(()=>{if(!l||!t||!u||!x||!e0)return;let e=async()=>{try{var e,t,s,a,r,i,n,o,d,m,h,p;j(e0);let g=await (0,c.modelSettingsCall)(l);g&&I(g);let f=new Set;for(let e=0;e0&&(y=v[v.length-1]);let b=await (0,c.modelMetricsCall)(l,x,u,y,null===(e=ep.from)||void 0===e?void 0:e.toISOString(),null===(t=ep.to)||void 0===t?void 0:t.toISOString(),null==eA?void 0:eA.token,eM);H(b.data),ea(b.all_api_bases);let N=await (0,c.streamingModelMetricsCall)(l,y,null===(s=ep.from)||void 0===s?void 0:s.toISOString(),null===(a=ep.to)||void 0===a?void 0:a.toISOString());ei(N.data),eo(N.all_api_bases);let Z=await (0,c.modelExceptionsCall)(l,x,u,y,null===(r=ep.from)||void 0===r?void 0:r.toISOString(),null===(i=ep.to)||void 0===i?void 0:i.toISOString(),null==eA?void 0:eA.token,eM);ec(Z.data),eu(Z.exception_types);let w=await (0,c.modelMetricsSlowResponsesCall)(l,x,u,y,null===(n=ep.from)||void 0===n?void 0:n.toISOString(),null===(o=ep.to)||void 0===o?void 0:o.toISOString(),null==eA?void 0:eA.token,eM),C=await (0,c.adminGlobalActivityExceptions)(l,null===(d=ep.from)||void 0===d?void 0:d.toISOString().split("T")[0],null===(m=ep.to)||void 0===m?void 0:m.toISOString().split("T")[0],y);eZ(C);let S=await (0,c.adminGlobalActivityExceptionsPerDeployment)(l,null===(h=ep.from)||void 0===h?void 0:h.toISOString().split("T")[0],null===(p=ep.to)||void 0===p?void 0:p.toISOString().split("T")[0],y);eC(S),ex(w);let k=await (0,c.allEndUsersCall)(l);eP(null==k?void 0:k.map(e=>e.user_id));let A=(await (0,c.getCallbacksCall)(l,x,u)).router_settings,E=A.model_group_retry_policy,M=A.num_retries;ej(E),e_(A.retry_policy),eb(M);let F=A.model_group_alias||{};eT(F)}catch(e){console.error("Error fetching model data:",e)}};l&&t&&u&&x&&e0&&e();let s=async()=>{w(await (0,c.modelCostMap)(l))};null==Z&&s()},[l,t,u,x,e0]),!p||e1||!l||!t||!u||!x)return(0,s.jsx)("div",{children:"Loading..."});let le=[],ll=[];for(let e=0;enull!=Z&&"object"==typeof Z&&e in Z?Z[e].litellm_provider:"openai";if(t){let e=t.split("/"),l=e[0];(r=s)||(r=1===e.length?m(t):l)}else r="-";a&&(i=null==a?void 0:a.input_cost_per_token,n=null==a?void 0:a.output_cost_per_token,o=null==a?void 0:a.max_tokens,d=null==a?void 0:a.max_input_tokens),(null==l?void 0:l.litellm_params)&&(c=Object.fromEntries(Object.entries(null==l?void 0:l.litellm_params).filter(e=>{let[l]=e;return"model"!==l&&"api_base"!==l}))),p.data[e].provider=r,p.data[e].input_cost=i,p.data[e].output_cost=n,p.data[e].litellm_model_name=t,ll.push(r),p.data[e].input_cost&&(p.data[e].input_cost=(1e6*Number(p.data[e].input_cost)).toFixed(2)),p.data[e].output_cost&&(p.data[e].output_cost=(1e6*Number(p.data[e].output_cost)).toFixed(2)),p.data[e].max_tokens=o,p.data[e].max_input_tokens=d,p.data[e].api_base=null==l?void 0:null===(la=l.litellm_params)||void 0===la?void 0:la.api_base,p.data[e].cleanedLitellmParams=c,le.push(l.model_name)}if(u&&"Admin Viewer"==u){let{Title:e,Paragraph:l}=C.default;return(0,s.jsxs)("div",{children:[(0,s.jsx)(e,{level:1,children:"Access Denied"}),(0,s.jsx)(l,{children:"Ask your proxy admin for access to view all models"})]})}return(Object.keys(m.Cl).find(e=>m.Cl[e]===F),eB)?(0,s.jsx)("div",{className:"w-full h-full",children:(0,s.jsx)(e7.Z,{teamId:eB,onClose:()=>eU(null),accessToken:l,is_team_admin:"Admin"===u,is_proxy_admin:"Proxy Admin"===u,userModels:le,editTeam:!1,onUpdate:e3})}):(0,s.jsx)("div",{className:"w-full mx-4 h-[75vh]",children:(0,s.jsx)(i.Z,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:(0,s.jsxs)(r.Z,{numColSpan:1,className:"flex flex-col gap-2",children:[(0,s.jsx)("div",{className:"flex justify-between items-center mb-4",children:(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"Model Management"}),et.ZL.includes(u)?(0,s.jsx)("p",{className:"text-sm text-gray-600",children:"Add and manage models for the proxy"}):(0,s.jsx)("p",{className:"text-sm text-gray-600",children:"Add models for teams you are an admin for."})]})}),eV?(0,s.jsx)(e8,{modelId:eV,editModel:!0,onClose:()=>{eD(null),eq(!1)},modelData:p.data.find(e=>e.model_info.id===eV),accessToken:l,userID:x,userRole:u,setEditModalVisible:T,setSelectedModel:O,onModelUpdate:e=>{e.deleted?j({...p,data:p.data.filter(l=>l.model_info.id!==e.model_info.id)}):j({...p,data:p.data.map(l=>l.model_info.id===e.model_info.id?e:l)}),eX.invalidateQueries({queryKey:["models","list"]}),e3()},modelAccessGroups:z}):(0,s.jsxs)(Q.Z,{index:e$,onIndexChange:eQ,className:"gap-2 h-[75vh] w-full ",children:[(0,s.jsxs)(X.Z,{className:"flex justify-between mt-2 w-full items-center",children:[(0,s.jsxs)("div",{className:"flex",children:[et.ZL.includes(u)?(0,s.jsx)($.Z,{children:"All Models"}):(0,s.jsx)($.Z,{children:"Your Models"}),(0,s.jsx)($.Z,{children:"Add Model"}),et.ZL.includes(u)&&(0,s.jsx)($.Z,{children:"LLM Credentials"}),et.ZL.includes(u)&&(0,s.jsx)($.Z,{children:"Pass-Through Endpoints"}),et.ZL.includes(u)&&(0,s.jsx)($.Z,{children:"Health Status"}),et.ZL.includes(u)&&(0,s.jsx)($.Z,{children:"Model Analytics"}),et.ZL.includes(u)&&(0,s.jsx)($.Z,{children:"Model Retry Settings"}),et.ZL.includes(u)&&(0,s.jsx)($.Z,{children:"Model Group Alias"}),et.ZL.includes(u)&&(0,s.jsx)($.Z,{children:"Price Data Reload"})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[S&&(0,s.jsxs)(n.Z,{children:["Last Refreshed: ",S]}),(0,s.jsx)(Y.Z,{icon:W.Z,variant:"shadow",size:"xs",className:"self-center",onClick:e3})]})]}),(0,s.jsxs)(el.Z,{children:[(0,s.jsx)(li,{selectedModelGroup:B,setSelectedModelGroup:U,availableModelGroups:V,availableModelAccessGroups:z,setSelectedModelId:eD,setSelectedTeamId:eU,setEditModel:eq,modelData:p}),(0,s.jsx)(ee.Z,{className:"h-full",children:(0,s.jsx)(eK,{form:b,handleOk:()=>{b.validateFields().then(e=>{h(e,l,b,e3)}).catch(e=>{var l;let t=(null===(l=e.errorFields)||void 0===l?void 0:l.map(e=>"".concat(e.name.join("."),": ").concat(e.errors.join(", "))).join(" | "))||"Unknown validation error";d.Z.fromBackend("Please fill in the following required fields: ".concat(t))})},selectedProvider:F,setSelectedProvider:P,providerModels:A,setProviderModelsFn:e=>{E((0,m.bK)(e,Z))},getPlaceholder:m.ph,uploadProps:e6,showAdvancedSettings:eR,setShowAdvancedSettings:eO,teams:y,credentials:e5,accessToken:l,userRole:u,premiumUser:_})}),(0,s.jsx)(ee.Z,{children:(0,s.jsx)(K,{uploadProps:e6})}),(0,s.jsx)(ee.Z,{children:(0,s.jsx)(lH.Z,{accessToken:l,userRole:u,userID:x,modelData:p,premiumUser:_})}),(0,s.jsx)(ee.Z,{children:(0,s.jsx)(lV,{accessToken:l,modelData:p,all_models_on_proxy:le,getDisplayModelName:J,setSelectedModelId:eD})}),(0,s.jsx)(lb,{dateValue:ep,setDateValue:eg,selectedModelGroup:B,availableModelGroups:V,setShowAdvancedFilters:ek,modelMetrics:G,modelMetricsCategories:es,streamingModelMetrics:er,streamingModelMetricsCategories:en,customTooltip:e=>{var l,t;let{payload:a,active:r}=e;if(!r||!a)return null;let i=null===(t=a[0])||void 0===t?void 0:null===(l=t.payload)||void 0===l?void 0:l.date,n=a.sort((e,l)=>l.value-e.value);if(n.length>5){let e=n.length-5;(n=n.slice(0,5)).push({dataKey:"".concat(e," other deployments"),value:a.slice(5).reduce((e,l)=>e+l.value,0),color:"gray"})}return(0,s.jsxs)("div",{className:"w-150 rounded-tremor-default border border-tremor-border bg-tremor-background p-2 text-tremor-default shadow-tremor-dropdown",children:[i&&(0,s.jsxs)("p",{className:"text-tremor-content-emphasis mb-2",children:["Date: ",i]}),n.map((e,l)=>{let t=parseFloat(e.value.toFixed(5)),a=0===t&&e.value>0?"<0.00001":t.toFixed(5);return(0,s.jsxs)("div",{className:"flex justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 mt-1 rounded-full bg-".concat(e.color,"-500")}),(0,s.jsx)("p",{className:"text-tremor-content",children:e.dataKey})]}),(0,s.jsx)("p",{className:"font-medium text-tremor-content-emphasis text-righ ml-2",children:a})]},l)})]})},slowResponsesData:eh,modelExceptions:ed,globalExceptionData:eN,allExceptions:em,globalExceptionPerDeployment:ew,allEndUsers:eF,keys:g,setSelectedAPIKey:eE,setSelectedCustomer:eI,teams:y,selectedAPIKey:eA,selectedCustomer:eM,selectedTeam:eG,setAllExceptions:eu,setGlobalExceptionData:eZ,setGlobalExceptionPerDeployment:eC,setModelExceptions:ec,setModelMetrics:H,setModelMetricsCategories:ea,setSelectedModelGroup:U,setSlowResponsesData:ex,setStreamingModelMetrics:ei,setStreamingModelMetricsCategories:eo}),(0,s.jsx)(lZ,{selectedModelGroup:B,setSelectedModelGroup:U,availableModelGroups:V,globalRetryPolicy:ev,setGlobalRetryPolicy:e_,defaultRetry:ey,modelGroupRetryPolicy:ef,setModelGroupRetryPolicy:ej,handleSaveRetrySettings:e9}),(0,s.jsx)(ee.Z,{children:(0,s.jsx)(lG,{accessToken:l,initialModelGroupAlias:eL,onAliasUpdate:eT})}),(0,s.jsx)(lF,{setModelMap:w})]})]})]})})})}},27593:function(e,l,t){t.d(l,{Z:function(){return Y}});var s=t(57437),a=t(2265),r=t(78489),i=t(47323),n=t(84264),o=t(96761),d=t(19250),c=t(99981),m=t(33866),u=t(15731),h=t(53410),x=t(74998),p=t(59341),g=t(49566),f=t(12514),j=t(97765),v=t(37592),_=t(10032),y=t(22116),b=t(51653),N=t(24199),Z=t(12660),w=t(15424),C=t(58760),S=t(5545),k=t(45246),A=t(96473),E=t(31283),M=e=>{let{value:l={},onChange:t}=e,[r,i]=(0,a.useState)(Object.entries(l)),n=e=>{let l=r.filter((l,t)=>t!==e);i(l),null==t||t(Object.fromEntries(l))},o=(e,l,s)=>{let a=[...r];a[e]=[l,s],i(a),null==t||t(Object.fromEntries(a))};return(0,s.jsxs)("div",{children:[r.map((e,l)=>{let[t,a]=e;return(0,s.jsxs)(C.Z,{style:{display:"flex",marginBottom:8},align:"center",children:[(0,s.jsx)(E.o,{placeholder:"Header Name",value:t,onChange:e=>o(l,e.target.value,a)}),(0,s.jsx)(E.o,{placeholder:"Header Value",value:a,onChange:e=>o(l,t,e.target.value)}),(0,s.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:(0,s.jsx)(k.Z,{onClick:()=>n(l),style:{cursor:"pointer"}})})]},l)}),(0,s.jsx)(S.ZP,{type:"dashed",onClick:()=>{i([...r,["",""]])},icon:(0,s.jsx)(A.Z,{}),children:"Add Header"})]})},I=t(77565),F=e=>{let{pathValue:l,targetValue:t,includeSubpath:a}=e,r=(0,d.getProxyBaseUrl)();return l&&t?(0,s.jsxs)(f.Z,{className:"p-5",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Route Preview"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-5",children:"How your requests will be routed"}),(0,s.jsxs)("div",{className:"space-y-5",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-base font-semibold text-gray-900 mb-3",children:"Basic routing:"}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,s.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Your endpoint"}),(0,s.jsx)("code",{className:"font-mono text-sm text-gray-900",children:l?"".concat(r).concat(l):""})]}),(0,s.jsx)("div",{className:"text-gray-400",children:(0,s.jsx)(I.Z,{className:"text-lg"})}),(0,s.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,s.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Forwards to"}),(0,s.jsx)("code",{className:"font-mono text-sm text-gray-900",children:t})]})]})]}),a&&(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-base font-semibold text-gray-900 mb-3",children:"With subpaths:"}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,s.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Your endpoint + subpath"}),(0,s.jsxs)("code",{className:"font-mono text-sm text-gray-900",children:[l&&"".concat(r).concat(l),(0,s.jsx)("span",{className:"text-blue-600",children:"/v1/text-to-image/base/model"})]})]}),(0,s.jsx)("div",{className:"text-gray-400",children:(0,s.jsx)(I.Z,{className:"text-lg"})}),(0,s.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,s.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Forwards to"}),(0,s.jsxs)("code",{className:"font-mono text-sm text-gray-900",children:[t,(0,s.jsx)("span",{className:"text-blue-600",children:"/v1/text-to-image/base/model"})]})]})]}),(0,s.jsxs)("div",{className:"mt-3 text-sm text-gray-600",children:["Any path after ",l," will be appended to the target URL"]})]})}),!a&&(0,s.jsx)("div",{className:"mt-4 p-3 bg-blue-50 rounded-md border border-blue-200",children:(0,s.jsxs)("div",{className:"flex items-start",children:[(0,s.jsx)(w.Z,{className:"text-blue-500 mt-0.5 mr-2 flex-shrink-0"}),(0,s.jsxs)("div",{className:"text-sm text-blue-700",children:[(0,s.jsx)("span",{className:"font-medium",children:"Not seeing the routing you wanted?"})," Try enabling - Include Subpaths - above - this allows subroutes like"," ",(0,s.jsx)("code",{className:"bg-blue-100 px-1 py-0.5 rounded font-mono text-xs",children:"/api/v1/models"})," to be forwarded automatically."]})]})})]})]}):null},P=t(9114),L=t(63709),T=e=>{let{premiumUser:l,authEnabled:t,onAuthChange:a}=e;return(0,s.jsxs)(f.Z,{className:"p-6",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Security"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-4",children:"When enabled, requests to this endpoint will require a valid LiteLLM Virtual Key"}),l?(0,s.jsx)(_.Z.Item,{name:"auth",valuePropName:"checked",className:"mb-0",children:(0,s.jsx)(L.Z,{checked:t,onChange:e=>{a(e)}})}):(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center mb-3",children:[(0,s.jsx)(L.Z,{disabled:!0,checked:!1,style:{outline:"2px solid #d1d5db",outlineOffset:"2px"}}),(0,s.jsx)("span",{className:"ml-2 text-sm text-gray-400",children:"Authentication (Premium)"})]}),(0,s.jsx)("div",{className:"p-3 bg-yellow-50 border border-yellow-200 rounded-lg",children:(0,s.jsxs)(n.Z,{className:"text-sm text-yellow-800",children:["Setting authentication for pass-through endpoints is a LiteLLM Enterprise feature. Get a trial key"," ",(0,s.jsx)("a",{href:"https://www.litellm.ai/#pricing",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"here"}),"."]})})]})]})},R=t(67479),O=e=>{let{accessToken:l,value:t={},onChange:r,disabled:i=!1}=e,[n,d]=(0,a.useState)(Object.keys(t)),[m,u]=(0,a.useState)(t);(0,a.useEffect)(()=>{u(t),d(Object.keys(t))},[t]);let h=(e,l,t)=>{var s,a;let i=m[e]||{},n={...m,[e]:{...i,[l]:t.length>0?t:void 0}};(null===(s=n[e])||void 0===s?void 0:s.request_fields)||(null===(a=n[e])||void 0===a?void 0:a.response_fields)||(n[e]=null),u(n),r&&r(n)};return(0,s.jsxs)(f.Z,{className:"p-6",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Guardrails"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-6",children:"Configure guardrails to enforce policies on requests and responses. Guardrails are opt-in for passthrough endpoints."}),(0,s.jsx)(b.Z,{message:(0,s.jsxs)("span",{children:["Field-Level Targeting"," ",(0,s.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/pass_through_guardrails#field-level-targeting",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"(Learn More)"})]}),description:(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("div",{children:"Optionally specify which fields to check. If left empty, the entire request/response is sent to the guardrail."}),(0,s.jsxs)("div",{className:"text-xs space-y-1 mt-2",children:[(0,s.jsx)("div",{className:"font-medium",children:"Common Examples:"}),(0,s.jsxs)("div",{children:["• ",(0,s.jsx)("code",{className:"bg-gray-100 px-1 rounded",children:"query"})," - Single field"]}),(0,s.jsxs)("div",{children:["• ",(0,s.jsx)("code",{className:"bg-gray-100 px-1 rounded",children:"documents[*].text"})," - All text in documents array"]}),(0,s.jsxs)("div",{children:["• ",(0,s.jsx)("code",{className:"bg-gray-100 px-1 rounded",children:"messages[*].content"})," - All message contents"]})]})]}),type:"info",showIcon:!0,className:"mb-4"}),(0,s.jsx)(_.Z.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Select Guardrails",(0,s.jsx)(c.Z,{title:"Choose which guardrails should run on this endpoint. Org/team/key level guardrails will also be included.",children:(0,s.jsx)(w.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),children:(0,s.jsx)(R.Z,{accessToken:l,value:n,onChange:e=>{d(e);let l={};e.forEach(e=>{l[e]=m[e]||null}),u(l),r&&r(l)},disabled:i})}),n.length>0&&(0,s.jsxs)("div",{className:"mt-6 space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,s.jsx)("div",{className:"text-sm font-medium text-gray-700",children:"Field Targeting (Optional)"}),(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"\uD83D\uDCA1 Tip: Leave empty to check entire payload"})]}),n.map(e=>{var l,t;return(0,s.jsxs)(f.Z,{className:"p-4 bg-gray-50",children:[(0,s.jsx)("div",{className:"text-sm font-medium text-gray-900 mb-3",children:e}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,s.jsxs)("label",{className:"text-xs text-gray-600 flex items-center",children:["Request Fields (pre_call)",(0,s.jsx)(c.Z,{title:(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"font-medium mb-1",children:"Specify which request fields to check"}),(0,s.jsxs)("div",{className:"text-xs space-y-1",children:[(0,s.jsx)("div",{children:"Examples:"}),(0,s.jsx)("div",{children:"• query"}),(0,s.jsx)("div",{children:"• documents[*].text"}),(0,s.jsx)("div",{children:"• messages[*].content"})]})]}),children:(0,s.jsx)(w.Z,{className:"ml-1 text-gray-400"})})]}),(0,s.jsxs)("div",{className:"flex gap-1",children:[(0,s.jsx)("button",{type:"button",onClick:()=>{var l;let t=(null===(l=m[e])||void 0===l?void 0:l.request_fields)||[];h(e,"request_fields",[...t,"query"])},className:"text-xs px-2 py-1 bg-white border border-gray-300 rounded hover:bg-gray-50",disabled:i,children:"+ query"}),(0,s.jsx)("button",{type:"button",onClick:()=>{var l;let t=(null===(l=m[e])||void 0===l?void 0:l.request_fields)||[];h(e,"request_fields",[...t,"documents[*]"])},className:"text-xs px-2 py-1 bg-white border border-gray-300 rounded hover:bg-gray-50",disabled:i,children:"+ documents[*]"})]})]}),(0,s.jsx)(v.default,{mode:"tags",style:{width:"100%"},placeholder:"Type field name or use + buttons above (e.g., query, documents[*].text)",value:(null===(l=m[e])||void 0===l?void 0:l.request_fields)||[],onChange:l=>h(e,"request_fields",l),disabled:i,tokenSeparators:[","]})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,s.jsxs)("label",{className:"text-xs text-gray-600 flex items-center",children:["Response Fields (post_call)",(0,s.jsx)(c.Z,{title:(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"font-medium mb-1",children:"Specify which response fields to check"}),(0,s.jsxs)("div",{className:"text-xs space-y-1",children:[(0,s.jsx)("div",{children:"Examples:"}),(0,s.jsx)("div",{children:"• results[*].text"}),(0,s.jsx)("div",{children:"• choices[*].message.content"})]})]}),children:(0,s.jsx)(w.Z,{className:"ml-1 text-gray-400"})})]}),(0,s.jsx)("div",{className:"flex gap-1",children:(0,s.jsx)("button",{type:"button",onClick:()=>{var l;let t=(null===(l=m[e])||void 0===l?void 0:l.response_fields)||[];h(e,"response_fields",[...t,"results[*]"])},className:"text-xs px-2 py-1 bg-white border border-gray-300 rounded hover:bg-gray-50",disabled:i,children:"+ results[*]"})})]}),(0,s.jsx)(v.default,{mode:"tags",style:{width:"100%"},placeholder:"Type field name or use + buttons above (e.g., results[*].text)",value:(null===(t=m[e])||void 0===t?void 0:t.response_fields)||[],onChange:l=>h(e,"response_fields",l),disabled:i,tokenSeparators:[","]})]})]})]},e)})]})]})};let{Option:V}=v.default;var D=e=>{let{accessToken:l,setPassThroughItems:t,passThroughItems:i,premiumUser:n=!1}=e,[m]=_.Z.useForm(),[u,h]=(0,a.useState)(!1),[x,v]=(0,a.useState)(!1),[C,S]=(0,a.useState)(""),[k,A]=(0,a.useState)(""),[E,I]=(0,a.useState)(""),[L,R]=(0,a.useState)(!0),[V,D]=(0,a.useState)(!1),[z,q]=(0,a.useState)({}),B=()=>{m.resetFields(),A(""),I(""),R(!0),q({}),h(!1)},U=e=>{let l=e;e&&!e.startsWith("/")&&(l="/"+e),A(l),m.setFieldsValue({path:l})},G=async e=>{console.log("addPassThrough called with:",e),v(!0);try{!n&&"auth"in e&&delete e.auth,z&&Object.keys(z).length>0&&(e.guardrails=z),console.log("formValues: ".concat(JSON.stringify(e)));let s=(await (0,d.createPassThroughEndpoint)(l,e)).endpoints[0],a=[...i,s];t(a),P.Z.success("Pass-through endpoint created successfully"),m.resetFields(),A(""),I(""),R(!0),q({}),h(!1)}catch(e){P.Z.fromBackend("Error creating pass-through endpoint: "+e)}finally{v(!1)}};return(0,s.jsxs)("div",{children:[(0,s.jsx)(r.Z,{className:"mx-auto mb-4 mt-4",onClick:()=>h(!0),children:"+ Add Pass-Through Endpoint"}),(0,s.jsx)(y.Z,{title:(0,s.jsxs)("div",{className:"flex items-center space-x-3 pb-4 border-b border-gray-100",children:[(0,s.jsx)(Z.Z,{className:"text-xl text-blue-500"}),(0,s.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Add Pass-Through Endpoint"})]}),open:u,width:1e3,onCancel:B,footer:null,className:"top-8",styles:{body:{padding:"24px"},header:{padding:"24px 24px 0 24px",border:"none"}},children:(0,s.jsxs)("div",{className:"mt-6",children:[(0,s.jsx)(b.Z,{message:"What is a Pass-Through Endpoint?",description:"Route requests from your LiteLLM proxy to any external API. Perfect for custom models, image generation APIs, or any service you want to proxy through LiteLLM.",type:"info",showIcon:!0,className:"mb-6"}),(0,s.jsxs)(_.Z,{form:m,onFinish:G,layout:"vertical",className:"space-y-6",initialValues:{include_subpath:!0,path:k,target:E},children:[(0,s.jsxs)(f.Z,{className:"p-5",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Route Configuration"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-5",children:"Configure how requests to your domain will be forwarded to the target API"}),(0,s.jsxs)("div",{className:"space-y-5",children:[(0,s.jsx)(_.Z.Item,{label:(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Path Prefix"}),name:"path",rules:[{required:!0,message:"Path is required",pattern:/^\//}],extra:(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-1",children:"Example: /bria, /adobe-photoshop, /elasticsearch"}),className:"mb-4",children:(0,s.jsx)("div",{className:"flex items-center",children:(0,s.jsx)(g.Z,{placeholder:"bria",value:k,onChange:e=>U(e.target.value),className:"flex-1"})})}),(0,s.jsx)(_.Z.Item,{label:(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Target URL"}),name:"target",rules:[{required:!0,message:"Target URL is required"},{type:"url",message:"Please enter a valid URL"}],extra:(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-1",children:"Example:https://engine.prod.bria-api.com"}),className:"mb-4",children:(0,s.jsx)(g.Z,{placeholder:"https://engine.prod.bria-api.com",value:E,onChange:e=>{I(e.target.value),m.setFieldsValue({target:e.target.value})}})}),(0,s.jsxs)("div",{className:"flex items-center justify-between py-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-sm font-medium text-gray-700",children:"Include Subpaths"}),(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-0.5",children:"Forward all subpaths to the target API (recommended for REST APIs)"})]}),(0,s.jsx)(_.Z.Item,{name:"include_subpath",valuePropName:"checked",className:"mb-0",children:(0,s.jsx)(p.Z,{checked:L,onChange:R})})]})]})]}),(0,s.jsx)(F,{pathValue:k,targetValue:E,includeSubpath:L}),(0,s.jsxs)(f.Z,{className:"p-6",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Headers"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-6",children:"Add headers that will be sent with every request to the target API"}),(0,s.jsx)(_.Z.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Authentication Headers",(0,s.jsx)(c.Z,{title:"Authentication and other headers to forward with requests",children:(0,s.jsx)(w.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"headers",rules:[{required:!0,message:"Please configure the headers"}],extra:(0,s.jsxs)("div",{className:"text-xs text-gray-500 mt-2",children:[(0,s.jsx)("div",{className:"font-medium mb-1",children:"Add authentication tokens and other required headers"}),(0,s.jsx)("div",{children:"Common examples: auth_token, Authorization, x-api-key"})]}),children:(0,s.jsx)(M,{})})]}),(0,s.jsx)(T,{premiumUser:n,authEnabled:V,onAuthChange:e=>{D(e),m.setFieldsValue({auth:e})}}),(0,s.jsx)(O,{accessToken:l,value:z,onChange:q}),(0,s.jsxs)(f.Z,{className:"p-6",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Billing"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-6",children:"Optional cost tracking for this endpoint"}),(0,s.jsx)(_.Z.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Cost Per Request (USD)",(0,s.jsx)(c.Z,{title:"Optional: Track costs for requests to this endpoint",children:(0,s.jsx)(w.Z,{className:"ml-2 text-gray-400 hover:text-gray-600"})})]}),name:"cost_per_request",extra:(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-2",children:"The cost charged for each request through this endpoint"}),children:(0,s.jsx)(N.Z,{min:0,step:.001,precision:4,placeholder:"2.0000",size:"large"})})]}),(0,s.jsxs)("div",{className:"flex items-center justify-end space-x-3 pt-6 border-t border-gray-100",children:[(0,s.jsx)(r.Z,{variant:"secondary",onClick:B,children:"Cancel"}),(0,s.jsx)(r.Z,{variant:"primary",loading:x,onClick:()=>{console.log("Submit button clicked"),m.submit()},children:x?"Creating...":"Add Pass-Through Endpoint"})]})]})]})})]})},z=t(30078),q=t(4260),B=t(19015),U=t(87769),G=t(42208);let H=e=>{let{value:l}=e,[t,r]=(0,a.useState)(!1),i=JSON.stringify(l,null,2);return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("pre",{className:"font-mono text-xs bg-gray-50 p-2 rounded max-w-md overflow-auto",children:t?i:"••••••••"}),(0,s.jsx)("button",{onClick:()=>r(!t),className:"p-1 hover:bg-gray-100 rounded",type:"button",children:t?(0,s.jsx)(U.Z,{className:"w-4 h-4 text-gray-500"}):(0,s.jsx)(G.Z,{className:"w-4 h-4 text-gray-500"})})]})};var K=e=>{let{endpointData:l,onClose:t,accessToken:r,isAdmin:i,premiumUser:n=!1,onEndpointUpdated:o}=e,[c,m]=(0,a.useState)(l),[u,h]=(0,a.useState)(!1),[x,p]=(0,a.useState)(!1),[g,f]=(0,a.useState)((null==l?void 0:l.auth)||!1),[j,v]=(0,a.useState)((null==l?void 0:l.guardrails)||{}),[y]=_.Z.useForm(),b=async e=>{try{if(!r||!(null==c?void 0:c.id))return;let l={};if(e.headers)try{l="string"==typeof e.headers?JSON.parse(e.headers):e.headers}catch(e){P.Z.fromBackend("Invalid JSON format for headers");return}let t={path:c.path,target:e.target,headers:l,include_subpath:e.include_subpath,cost_per_request:e.cost_per_request,auth:n?e.auth:void 0,guardrails:j&&Object.keys(j).length>0?j:void 0};await (0,d.updatePassThroughEndpoint)(r,c.id,t),m({...c,...t}),p(!1),o&&o()}catch(e){console.error("Error updating endpoint:",e),P.Z.fromBackend("Failed to update pass through endpoint")}},N=async()=>{try{if(!r||!(null==c?void 0:c.id))return;await (0,d.deletePassThroughEndpointsCall)(r,c.id),P.Z.success("Pass through endpoint deleted successfully"),t(),o&&o()}catch(e){console.error("Error deleting endpoint:",e),P.Z.fromBackend("Failed to delete pass through endpoint")}};return u?(0,s.jsx)("div",{className:"p-4",children:"Loading..."}):c?(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,s.jsxs)("div",{children:[(0,s.jsx)(S.ZP,{onClick:t,className:"mb-4",children:"← Back"}),(0,s.jsxs)(z.Dx,{children:["Pass Through Endpoint: ",c.path]}),(0,s.jsx)(z.xv,{className:"text-gray-500 font-mono",children:c.id})]})}),(0,s.jsxs)(z.v0,{children:[(0,s.jsxs)(z.td,{className:"mb-4",children:[(0,s.jsx)(z.OK,{children:"Overview"},"overview"),i?(0,s.jsx)(z.OK,{children:"Settings"},"settings"):(0,s.jsx)(s.Fragment,{})]}),(0,s.jsxs)(z.nP,{children:[(0,s.jsxs)(z.x4,{children:[(0,s.jsxs)(z.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,s.jsxs)(z.Zb,{children:[(0,s.jsx)(z.xv,{children:"Path"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(z.Dx,{className:"font-mono",children:c.path})})]}),(0,s.jsxs)(z.Zb,{children:[(0,s.jsx)(z.xv,{children:"Target"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(z.Dx,{children:c.target})})]}),(0,s.jsxs)(z.Zb,{children:[(0,s.jsx)(z.xv,{children:"Configuration"}),(0,s.jsxs)("div",{className:"mt-2 space-y-2",children:[(0,s.jsx)("div",{children:(0,s.jsx)(z.Ct,{color:c.include_subpath?"green":"gray",children:c.include_subpath?"Include Subpath":"Exact Path"})}),(0,s.jsx)("div",{children:(0,s.jsx)(z.Ct,{color:c.auth?"blue":"gray",children:c.auth?"Auth Required":"No Auth"})}),void 0!==c.cost_per_request&&(0,s.jsx)("div",{children:(0,s.jsxs)(z.xv,{children:["Cost per request: $",c.cost_per_request]})})]})]})]}),(0,s.jsx)("div",{className:"mt-6",children:(0,s.jsx)(F,{pathValue:c.path,targetValue:c.target,includeSubpath:c.include_subpath||!1})}),c.headers&&Object.keys(c.headers).length>0&&(0,s.jsxs)(z.Zb,{className:"mt-6",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Headers"}),(0,s.jsxs)(z.Ct,{color:"blue",children:[Object.keys(c.headers).length," headers configured"]})]}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(H,{value:c.headers})})]}),c.guardrails&&Object.keys(c.guardrails).length>0&&(0,s.jsxs)(z.Zb,{className:"mt-6",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Guardrails"}),(0,s.jsxs)(z.Ct,{color:"purple",children:[Object.keys(c.guardrails).length," guardrails configured"]})]}),(0,s.jsx)("div",{className:"mt-4 space-y-2",children:Object.entries(c.guardrails).map(e=>{let[l,t]=e;return(0,s.jsxs)("div",{className:"p-3 bg-gray-50 rounded",children:[(0,s.jsx)("div",{className:"font-medium text-sm",children:l}),t&&(t.request_fields||t.response_fields)&&(0,s.jsxs)("div",{className:"mt-2 text-xs text-gray-600 space-y-1",children:[t.request_fields&&(0,s.jsxs)("div",{children:["Request fields: ",t.request_fields.join(", ")]}),t.response_fields&&(0,s.jsxs)("div",{children:["Response fields: ",t.response_fields.join(", ")]})]}),!t&&(0,s.jsx)("div",{className:"text-xs text-gray-600 mt-1",children:"Uses entire payload"})]},l)})})]})]}),i&&(0,s.jsx)(z.x4,{children:(0,s.jsxs)(z.Zb,{children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(z.Dx,{children:"Pass Through Endpoint Settings"}),(0,s.jsx)("div",{className:"space-x-2",children:!x&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(z.zx,{onClick:()=>p(!0),children:"Edit Settings"}),(0,s.jsx)(z.zx,{onClick:N,variant:"secondary",color:"red",children:"Delete Endpoint"})]})})]}),x?(0,s.jsxs)(_.Z,{form:y,onFinish:b,initialValues:{target:c.target,headers:c.headers?JSON.stringify(c.headers,null,2):"",include_subpath:c.include_subpath||!1,cost_per_request:c.cost_per_request,auth:c.auth||!1},layout:"vertical",children:[(0,s.jsx)(_.Z.Item,{label:"Target URL",name:"target",rules:[{required:!0,message:"Please input a target URL"}],children:(0,s.jsx)(z.oi,{placeholder:"https://api.example.com"})}),(0,s.jsx)(_.Z.Item,{label:"Headers (JSON)",name:"headers",children:(0,s.jsx)(q.default.TextArea,{rows:5,placeholder:'{"Authorization": "Bearer your-token", "Content-Type": "application/json"}'})}),(0,s.jsx)(_.Z.Item,{label:"Include Subpath",name:"include_subpath",valuePropName:"checked",children:(0,s.jsx)(L.Z,{})}),(0,s.jsx)(_.Z.Item,{label:"Cost per Request",name:"cost_per_request",children:(0,s.jsx)(B.Z,{min:0,step:.01,precision:2,placeholder:"0.00",addonBefore:"$"})}),(0,s.jsx)(T,{premiumUser:n,authEnabled:g,onAuthChange:e=>{f(e),y.setFieldsValue({auth:e})}}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(O,{accessToken:r||"",value:j,onChange:v})}),(0,s.jsxs)("div",{className:"flex justify-end gap-2 mt-6",children:[(0,s.jsx)(S.ZP,{onClick:()=>p(!1),children:"Cancel"}),(0,s.jsx)(z.zx,{children:"Save Changes"})]})]}):(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Path"}),(0,s.jsx)("div",{className:"font-mono",children:c.path})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Target URL"}),(0,s.jsx)("div",{children:c.target})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Include Subpath"}),(0,s.jsx)(z.Ct,{color:c.include_subpath?"green":"gray",children:c.include_subpath?"Yes":"No"})]}),void 0!==c.cost_per_request&&(0,s.jsxs)("div",{children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Cost per Request"}),(0,s.jsxs)("div",{children:["$",c.cost_per_request]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Authentication Required"}),(0,s.jsx)(z.Ct,{color:c.auth?"green":"gray",children:c.auth?"Yes":"No"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(z.xv,{className:"font-medium",children:"Headers"}),c.headers&&Object.keys(c.headers).length>0?(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(H,{value:c.headers})}):(0,s.jsx)("div",{className:"text-gray-500",children:"No headers configured"})]})]})]})})]})]})]}):(0,s.jsx)("div",{className:"p-4",children:"Pass through endpoint not found"})},J=t(12322);let W=e=>{let{value:l}=e,[t,r]=(0,a.useState)(!1),i=JSON.stringify(l);return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("span",{className:"font-mono text-xs",children:t?i:"••••••••"}),(0,s.jsx)("button",{onClick:()=>r(!t),className:"p-1 hover:bg-gray-100 rounded",type:"button",children:t?(0,s.jsx)(U.Z,{className:"w-4 h-4 text-gray-500"}):(0,s.jsx)(G.Z,{className:"w-4 h-4 text-gray-500"})})]})};var Y=e=>{let{accessToken:l,userRole:t,userID:p,modelData:g,premiumUser:f}=e,[j,v]=(0,a.useState)([]),[_,y]=(0,a.useState)(null),[b,N]=(0,a.useState)(!1),[Z,w]=(0,a.useState)(null);(0,a.useEffect)(()=>{l&&t&&p&&(0,d.getPassThroughEndpointsCall)(l).then(e=>{v(e.endpoints)})},[l,t,p]);let C=async e=>{w(e),N(!0)},S=async()=>{if(null!=Z&&l){try{await (0,d.deletePassThroughEndpointsCall)(l,Z);let e=j.filter(e=>e.id!==Z);v(e),P.Z.success("Endpoint deleted successfully.")}catch(e){console.error("Error deleting the endpoint:",e),P.Z.fromBackend("Error deleting the endpoint: "+e)}N(!1),w(null)}},k=(e,l)=>{C(e)},A=[{header:"ID",accessorKey:"id",cell:e=>(0,s.jsx)(c.Z,{title:e.row.original.id,children:(0,s.jsx)("div",{className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",onClick:()=>e.row.original.id&&y(e.row.original.id),children:e.row.original.id})})},{header:"Path",accessorKey:"path"},{header:"Target",accessorKey:"target",cell:e=>(0,s.jsx)(n.Z,{children:e.getValue()})},{header:()=>(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)("span",{children:"Authentication"}),(0,s.jsx)(c.Z,{title:"LiteLLM Virtual Key required to call endpoint",children:(0,s.jsx)(u.Z,{className:"w-4 h-4 text-gray-400 cursor-help"})})]}),accessorKey:"auth",cell:e=>(0,s.jsx)(m.Z,{color:e.getValue()?"green":"gray",children:e.getValue()?"Yes":"No"})},{header:"Headers",accessorKey:"headers",cell:e=>(0,s.jsx)(W,{value:e.getValue()||{}})},{header:"Actions",id:"actions",cell:e=>{let{row:l}=e;return(0,s.jsxs)("div",{className:"flex space-x-1",children:[(0,s.jsx)(i.Z,{icon:h.Z,size:"sm",onClick:()=>l.original.id&&y(l.original.id),title:"Edit"}),(0,s.jsx)(i.Z,{icon:x.Z,size:"sm",onClick:()=>k(l.original.id,l.index),title:"Delete"})]})}}];if(!l)return null;if(_){console.log("selectedEndpointId",_),console.log("generalSettings",j);let e=j.find(e=>e.id===_);return e?(0,s.jsx)(K,{endpointData:e,onClose:()=>y(null),accessToken:l,isAdmin:"Admin"===t||"admin"===t,premiumUser:f,onEndpointUpdated:()=>{l&&(0,d.getPassThroughEndpointsCall)(l).then(e=>{v(e.endpoints)})}}):(0,s.jsx)("div",{children:"Endpoint not found"})}return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(o.Z,{children:"Pass Through Endpoints"}),(0,s.jsx)(n.Z,{className:"text-tremor-content",children:"Configure and manage your pass-through endpoints"})]}),(0,s.jsx)(D,{accessToken:l,setPassThroughItems:v,passThroughItems:j,premiumUser:f}),(0,s.jsx)(J.w,{data:j,columns:A,renderSubComponent:()=>(0,s.jsx)("div",{}),getRowCanExpand:()=>!1,isLoading:!1,noDataMessage:"No pass-through endpoints configured"}),b&&(0,s.jsx)("div",{className:"fixed z-10 inset-0 overflow-y-auto",children:(0,s.jsxs)("div",{className:"flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0",children:[(0,s.jsx)("div",{className:"fixed inset-0 transition-opacity","aria-hidden":"true",children:(0,s.jsx)("div",{className:"absolute inset-0 bg-gray-500 opacity-75"})}),(0,s.jsx)("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true",children:"​"}),(0,s.jsxs)("div",{className:"inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full",children:[(0,s.jsx)("div",{className:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4",children:(0,s.jsx)("div",{className:"sm:flex sm:items-start",children:(0,s.jsxs)("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[(0,s.jsx)("h3",{className:"text-lg leading-6 font-medium text-gray-900",children:"Delete Pass-Through Endpoint"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)("p",{className:"text-sm text-gray-500",children:"Are you sure you want to delete this pass-through endpoint? This action cannot be undone."})})]})})}),(0,s.jsxs)("div",{className:"bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse",children:[(0,s.jsx)(r.Z,{onClick:S,color:"red",className:"ml-2",children:"Delete"}),(0,s.jsx)(r.Z,{onClick:()=>{N(!1),w(null)},children:"Cancel"})]})]})]})})]})}},39789:function(e,l,t){t.d(l,{Z:function(){return n}});var s=t(57437),a=t(2265),r=t(88237),i=t(84264),n=e=>{let{value:l,onValueChange:t,label:n="Select Time Range",className:o="",showTimeRange:d=!0}=e,[c,m]=(0,a.useState)(!1),u=(0,a.useRef)(null),h=(0,a.useCallback)(e=>{m(!0),setTimeout(()=>m(!1),1500),t(e),requestIdleCallback(()=>{if(e.from){let l;let s={...e},a=new Date(e.from);l=new Date(e.to?e.to:e.from),a.toDateString(),l.toDateString(),a.setHours(0,0,0,0),l.setHours(23,59,59,999),s.from=a,s.to=l,t(s)}},{timeout:100})},[t]),x=(0,a.useCallback)((e,l)=>{if(!e||!l)return"";let t=e=>e.toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0,timeZoneName:"short"});if(e.toDateString()!==l.toDateString())return"".concat(t(e)," - ").concat(t(l));{let t=e.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),s=e.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0}),a=l.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0,timeZoneName:"short"});return"".concat(t,": ").concat(s," - ").concat(a)}},[]);return(0,s.jsxs)("div",{className:o,children:[n&&(0,s.jsx)(i.Z,{className:"mb-2",children:n}),(0,s.jsxs)("div",{className:"relative w-fit",children:[(0,s.jsx)("div",{ref:u,children:(0,s.jsx)(r.Z,{enableSelect:!0,value:l,onValueChange:h,placeholder:"Select date range",enableClear:!1,style:{zIndex:100}})}),c&&(0,s.jsx)("div",{className:"absolute top-1/2 animate-pulse",style:{left:"calc(100% + 8px)",transform:"translateY(-50%)",zIndex:110},children:(0,s.jsxs)("div",{className:"flex items-center gap-1 text-green-600 text-sm font-medium bg-white px-2 py-1 rounded-full border border-green-200 shadow-sm whitespace-nowrap",children:[(0,s.jsx)("div",{className:"w-3 h-3 bg-green-500 text-white rounded-full flex items-center justify-center text-xs",children:"āœ“"}),(0,s.jsx)("span",{className:"text-xs",children:"Selected"})]})})]}),d&&l.from&&l.to&&(0,s.jsx)(i.Z,{className:"mt-2 text-xs text-gray-500",children:x(l.from,l.to)})]})}},12322:function(e,l,t){t.d(l,{w:function(){return o}});var s=t(57437),a=t(2265),r=t(71594),i=t(24525),n=t(19130);function o(e){let{data:l=[],columns:t,getRowCanExpand:o,renderSubComponent:d,isLoading:c=!1,loadingMessage:m="\uD83D\uDE85 Loading logs...",noDataMessage:u="No logs found"}=e,h=(0,r.b7)({data:l,columns:t,getRowCanExpand:o,getRowId:(e,l)=>{var t;return null!==(t=null==e?void 0:e.request_id)&&void 0!==t?t:String(l)},getCoreRowModel:(0,i.sC)(),getExpandedRowModel:(0,i.rV)()});return(0,s.jsx)("div",{className:"rounded-lg custom-border overflow-x-auto w-full max-w-full box-border",children:(0,s.jsxs)(n.iA,{className:"[&_td]:py-0.5 [&_th]:py-1 table-fixed w-full box-border",style:{minWidth:"400px"},children:[(0,s.jsx)(n.ss,{children:h.getHeaderGroups().map(e=>(0,s.jsx)(n.SC,{children:e.headers.map(e=>(0,s.jsx)(n.xs,{className:"py-1 h-8",children:e.isPlaceholder?null:(0,r.ie)(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,s.jsx)(n.RM,{children:c?(0,s.jsx)(n.SC,{children:(0,s.jsx)(n.pj,{colSpan:t.length,className:"h-8 text-center",children:(0,s.jsx)("div",{className:"text-center text-gray-500",children:(0,s.jsx)("p",{children:m})})})}):h.getRowModel().rows.length>0?h.getRowModel().rows.map(e=>(0,s.jsxs)(a.Fragment,{children:[(0,s.jsx)(n.SC,{className:"h-8",children:e.getVisibleCells().map(e=>(0,s.jsx)(n.pj,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap",children:(0,r.ie)(e.column.columnDef.cell,e.getContext())},e.id))}),e.getIsExpanded()&&(0,s.jsx)(n.SC,{children:(0,s.jsx)(n.pj,{colSpan:e.getVisibleCells().length,className:"p-0",children:(0,s.jsx)("div",{className:"w-full max-w-full overflow-hidden box-border",children:d({row:e})})})})]},e.id)):(0,s.jsx)(n.SC,{children:(0,s.jsx)(n.pj,{colSpan:t.length,className:"h-8 text-center",children:(0,s.jsx)("div",{className:"text-center text-gray-500",children:(0,s.jsx)("p",{children:u})})})})})]})})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1301-739c2d4a8ce60896.js b/litellm/proxy/_experimental/out/_next/static/chunks/1301-739c2d4a8ce60896.js new file mode 100644 index 00000000000..621fba93f95 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1301-739c2d4a8ce60896.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1301],{69993:function(e,t,r){r.d(t,{Z:function(){return s}});var n=r(1119),a=r(2265),i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M300 328a60 60 0 10120 0 60 60 0 10-120 0zM852 64H172c-17.7 0-32 14.3-32 32v660c0 17.7 14.3 32 32 32h680c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-32 660H204V128h616v596zM604 328a60 60 0 10120 0 60 60 0 10-120 0zm250.2 556H169.8c-16.5 0-29.8 14.3-29.8 32v36c0 4.4 3.3 8 7.4 8h729.1c4.1 0 7.4-3.6 7.4-8v-36c.1-17.7-13.2-32-29.7-32zM664 508H360c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"robot",theme:"outlined"},o=r(55015),s=a.forwardRef(function(e,t){return a.createElement(o.Z,(0,n.Z)({},e,{ref:t,icon:i}))})},58747:function(e,t,r){r.d(t,{Z:function(){return i}});var n=r(5853),a=r(2265);let i=e=>{var t=(0,n._T)(e,[]);return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),a.createElement("path",{d:"M11.9999 13.1714L16.9497 8.22168L18.3639 9.63589L11.9999 15.9999L5.63599 9.63589L7.0502 8.22168L11.9999 13.1714Z"}))}},4537:function(e,t,r){r.d(t,{Z:function(){return i}});var n=r(5853),a=r(2265);let i=e=>{var t=(0,n._T)(e,[]);return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),a.createElement("path",{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 10.5858L9.17157 7.75736L7.75736 9.17157L10.5858 12L7.75736 14.8284L9.17157 16.2426L12 13.4142L14.8284 16.2426L16.2426 14.8284L13.4142 12L16.2426 9.17157L14.8284 7.75736L12 10.5858Z"}))}},47323:function(e,t,r){r.d(t,{Z:function(){return p}});var n=r(5853),a=r(2265),i=r(47187),o=r(7084),s=r(13241),l=r(1153),u=r(26898);let d={xs:{paddingX:"px-1.5",paddingY:"py-1.5"},sm:{paddingX:"px-1.5",paddingY:"py-1.5"},md:{paddingX:"px-2",paddingY:"py-2"},lg:{paddingX:"px-2",paddingY:"py-2"},xl:{paddingX:"px-2.5",paddingY:"py-2.5"}},c={xs:{height:"h-3",width:"w-3"},sm:{height:"h-5",width:"w-5"},md:{height:"h-5",width:"w-5"},lg:{height:"h-7",width:"w-7"},xl:{height:"h-9",width:"w-9"}},h={simple:{rounded:"",border:"",ring:"",shadow:""},light:{rounded:"rounded-tremor-default",border:"",ring:"",shadow:""},shadow:{rounded:"rounded-tremor-default",border:"border",ring:"",shadow:"shadow-tremor-card dark:shadow-dark-tremor-card"},solid:{rounded:"rounded-tremor-default",border:"border-2",ring:"ring-1",shadow:""},outlined:{rounded:"rounded-tremor-default",border:"border",ring:"ring-2",shadow:""}},f=(e,t)=>{switch(e){case"simple":return{textColor:t?(0,l.bM)(t,u.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:"",borderColor:"",ringColor:""};case"light":return{textColor:t?(0,l.bM)(t,u.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,s.q)((0,l.bM)(t,u.K.background).bgColor,"bg-opacity-20"):"bg-tremor-brand-muted dark:bg-dark-tremor-brand-muted",borderColor:"",ringColor:""};case"shadow":return{textColor:t?(0,l.bM)(t,u.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,s.q)((0,l.bM)(t,u.K.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:"border-tremor-border dark:border-dark-tremor-border",ringColor:""};case"solid":return{textColor:t?(0,l.bM)(t,u.K.text).textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:t?(0,s.q)((0,l.bM)(t,u.K.background).bgColor,"bg-opacity-20"):"bg-tremor-brand dark:bg-dark-tremor-brand",borderColor:"border-tremor-brand-inverted dark:border-dark-tremor-brand-inverted",ringColor:"ring-tremor-ring dark:ring-dark-tremor-ring"};case"outlined":return{textColor:t?(0,l.bM)(t,u.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,s.q)((0,l.bM)(t,u.K.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:t?(0,l.bM)(t,u.K.ring).borderColor:"border-tremor-brand-subtle dark:border-dark-tremor-brand-subtle",ringColor:t?(0,s.q)((0,l.bM)(t,u.K.ring).ringColor,"ring-opacity-40"):"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"}}},m=(0,l.fn)("Icon"),p=a.forwardRef((e,t)=>{let{icon:r,variant:u="simple",tooltip:p,size:g=o.u8.SM,color:b,className:v}=e,w=(0,n._T)(e,["icon","variant","tooltip","size","color","className"]),y=f(u,b),{tooltipProps:k,getReferenceProps:C}=(0,i.l)();return a.createElement("span",Object.assign({ref:(0,l.lq)([t,k.refs.setReference]),className:(0,s.q)(m("root"),"inline-flex shrink-0 items-center justify-center",y.bgColor,y.textColor,y.borderColor,y.ringColor,h[u].rounded,h[u].border,h[u].shadow,h[u].ring,d[g].paddingX,d[g].paddingY,v)},C,w),a.createElement(i.Z,Object.assign({text:p},k)),a.createElement(r,{className:(0,s.q)(m("icon"),"shrink-0",c[g].height,c[g].width)}))});p.displayName="Icon"},27281:function(e,t,r){r.d(t,{Z:function(){return m}});var n=r(5853),a=r(58747),i=r(2265),o=r(4537),s=r(13241),l=r(1153),u=r(96398),d=r(51975),c=r(85238),h=r(44140);let f=(0,l.fn)("Select"),m=i.forwardRef((e,t)=>{let{defaultValue:r="",value:l,onValueChange:m,placeholder:p="Select...",disabled:g=!1,icon:b,enableClear:v=!1,required:w,children:y,name:k,error:C=!1,errorMessage:x,className:E,id:M}=e,q=(0,n._T)(e,["defaultValue","value","onValueChange","placeholder","disabled","icon","enableClear","required","children","name","error","errorMessage","className","id"]),O=(0,i.useRef)(null),L=i.Children.toArray(y),[N,P]=(0,h.Z)(r,l),R=(0,i.useMemo)(()=>{let e=i.Children.toArray(y).filter(i.isValidElement);return(0,u.sl)(e)},[y]);return i.createElement("div",{className:(0,s.q)("w-full min-w-[10rem] text-tremor-default",E)},i.createElement("div",{className:"relative"},i.createElement("select",{title:"select-hidden",required:w,className:(0,s.q)("h-full w-full absolute left-0 top-0 -z-10 opacity-0"),value:N,onChange:e=>{e.preventDefault()},name:k,disabled:g,id:M,onFocus:()=>{let e=O.current;e&&e.focus()}},i.createElement("option",{className:"hidden",value:"",disabled:!0,hidden:!0},p),L.map(e=>{let t=e.props.value,r=e.props.children;return i.createElement("option",{className:"hidden",key:t,value:t},r)})),i.createElement(d.Ri,Object.assign({as:"div",ref:t,defaultValue:N,value:N,onChange:e=>{null==m||m(e),P(e)},disabled:g,id:M},q),e=>{var t;let{value:r}=e;return i.createElement(i.Fragment,null,i.createElement(d.Y4,{ref:O,className:(0,s.q)("w-full outline-none text-left whitespace-nowrap truncate rounded-tremor-default focus:ring-2 transition duration-100 border pr-8 py-2","border-tremor-border shadow-tremor-input focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:border-dark-tremor-border dark:shadow-dark-tremor-input dark:focus:border-dark-tremor-brand-subtle dark:focus:ring-dark-tremor-brand-muted",b?"pl-10":"pl-3",(0,u.um)((0,u.Uh)(r),g,C))},b&&i.createElement("span",{className:(0,s.q)("absolute inset-y-0 left-0 flex items-center ml-px pl-2.5")},i.createElement(b,{className:(0,s.q)(f("Icon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})),i.createElement("span",{className:"w-[90%] block truncate"},r&&null!==(t=R.get(r))&&void 0!==t?t:p),i.createElement("span",{className:(0,s.q)("absolute inset-y-0 right-0 flex items-center mr-3")},i.createElement(a.Z,{className:(0,s.q)(f("arrowDownIcon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}))),v&&N?i.createElement("button",{type:"button",className:(0,s.q)("absolute inset-y-0 right-0 flex items-center mr-8"),onClick:e=>{e.preventDefault(),P(""),null==m||m("")}},i.createElement(o.Z,{className:(0,s.q)(f("clearIcon"),"flex-none h-4 w-4","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})):null,i.createElement(c.u,{enter:"transition ease duration-100 transform",enterFrom:"opacity-0 -translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"transition ease duration-100 transform",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-4"},i.createElement(d.O_,{anchor:"bottom start",className:(0,s.q)("z-10 w-[var(--button-width)] divide-y overflow-y-auto outline-none rounded-tremor-default max-h-[228px] border [--anchor-gap:4px]","bg-tremor-background border-tremor-border divide-tremor-border shadow-tremor-dropdown","dark:bg-dark-tremor-background dark:border-dark-tremor-border dark:divide-dark-tremor-border dark:shadow-dark-tremor-dropdown")},y)))})),C&&x?i.createElement("p",{className:(0,s.q)("errorMessage","text-sm text-rose-500 mt-1")},x):null)});m.displayName="Select"},94789:function(e,t,r){r.d(t,{Z:function(){return u}});var n=r(5853),a=r(2265),i=r(26898),o=r(13241),s=r(1153);let l=(0,s.fn)("Callout"),u=a.forwardRef((e,t)=>{let{title:r,icon:u,color:d,className:c,children:h}=e,f=(0,n._T)(e,["title","icon","color","className","children"]);return a.createElement("div",Object.assign({ref:t,className:(0,o.q)(l("root"),"flex flex-col overflow-hidden rounded-tremor-default text-tremor-default border-l-4 py-3 pr-3 pl-4",d?(0,o.q)((0,s.bM)(d,i.K.background).bgColor,(0,s.bM)(d,i.K.darkBorder).borderColor,(0,s.bM)(d,i.K.darkText).textColor,"dark:bg-opacity-10 bg-opacity-10"):(0,o.q)("bg-tremor-brand-faint border-tremor-brand-emphasis text-tremor-brand-emphasis","dark:bg-dark-tremor-brand-muted/70 dark:border-dark-tremor-brand-emphasis dark:text-dark-tremor-brand-emphasis"),c)},f),a.createElement("div",{className:(0,o.q)(l("header"),"flex items-start")},u?a.createElement(u,{className:(0,o.q)(l("icon"),"flex-none h-5 w-5 mr-1.5")}):null,a.createElement("h4",{className:(0,o.q)(l("title"),"font-semibold")},r)),a.createElement("p",{className:(0,o.q)(l("body"),"overflow-y-auto",h?"mt-2":"")},h))});u.displayName="Callout"},44140:function(e,t,r){r.d(t,{Z:function(){return a}});var n=r(2265);let a=(e,t)=>{let r=void 0!==t,[a,i]=(0,n.useState)(e);return[r?t:a,e=>{r||i(e)}]}},32489:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},77331:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"}))});t.Z=a},91777:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636"}))});t.Z=a},47686:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"}))});t.Z=a},44633:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"}))});t.Z=a},58710:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=a},82182:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}))});t.Z=a},79814:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4"}))});t.Z=a},2356:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"}))});t.Z=a},93416:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))});t.Z=a},77355:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=a},22452:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"}))});t.Z=a},25327:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01"}))});t.Z=a},49084:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"}))});t.Z=a},3497:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"}))});t.Z=a},2894:function(e,t,r){r.d(t,{R:function(){return s},m:function(){return o}});var n=r(18238),a=r(7989),i=r(11255),o=class extends a.F{#e;#t;#r;#n;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#r=e.mutationCache,this.#t=[],this.state=e.state||s(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#r.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||("pending"===this.state.status?this.scheduleGc():this.#r.remove(this))}continue(){return this.#n?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#a({type:"continue"})},r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#n=(0,i.Mz)({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{this.#a({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#a({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#r.canRun(this)});let n="pending"===this.state.status,a=!this.#n.canStart();try{if(n)t();else{this.#a({type:"pending",variables:e,isPaused:a}),await this.#r.config.onMutate?.(e,this,r);let t=await this.options.onMutate?.(e,r);t!==this.state.context&&this.#a({type:"pending",context:t,variables:e,isPaused:a})}let i=await this.#n.start();return await this.#r.config.onSuccess?.(i,e,this.state.context,this,r),await this.options.onSuccess?.(i,e,this.state.context,r),await this.#r.config.onSettled?.(i,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(i,null,e,this.state.context,r),this.#a({type:"success",data:i}),i}catch(t){try{throw await this.#r.config.onError?.(t,e,this.state.context,this,r),await this.options.onError?.(t,e,this.state.context,r),await this.#r.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(void 0,t,e,this.state.context,r),t}finally{this.#a({type:"error",error:t})}}finally{this.#r.runNext(this)}}#a(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),n.Vr.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#r.notify({mutation:this,type:"updated",action:e})})}};function s(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}},21623:function(e,t,r){r.d(t,{S:function(){return p}});var n=r(45345),a=r(21733),i=r(18238),o=r(24112),s=class extends o.l{constructor(e={}){super(),this.config=e,this.#i=new Map}#i;build(e,t,r){let i=t.queryKey,o=t.queryHash??(0,n.Rm)(i,t),s=this.get(o);return s||(s=new a.A({client:e,queryKey:i,queryHash:o,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(s)),s}add(e){this.#i.has(e.queryHash)||(this.#i.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#i.get(e.queryHash);t&&(e.destroy(),t===e&&this.#i.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){i.Vr.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#i.get(e)}getAll(){return[...this.#i.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,n._x)(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>(0,n._x)(e,t)):t}notify(e){i.Vr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){i.Vr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){i.Vr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},l=r(2894),u=class extends o.l{constructor(e={}){super(),this.config=e,this.#o=new Set,this.#s=new Map,this.#l=0}#o;#s;#l;build(e,t,r){let n=new l.m({client:e,mutationCache:this,mutationId:++this.#l,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#o.add(e);let t=d(e);if("string"==typeof t){let r=this.#s.get(t);r?r.push(e):this.#s.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#o.delete(e)){let t=d(e);if("string"==typeof t){let r=this.#s.get(t);if(r){if(r.length>1){let t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&this.#s.delete(t)}}}this.notify({type:"removed",mutation:e})}canRun(e){let t=d(e);if("string"!=typeof t)return!0;{let r=this.#s.get(t),n=r?.find(e=>"pending"===e.state.status);return!n||n===e}}runNext(e){let t=d(e);if("string"!=typeof t)return Promise.resolve();{let r=this.#s.get(t)?.find(t=>t!==e&&t.state.isPaused);return r?.continue()??Promise.resolve()}}clear(){i.Vr.batch(()=>{this.#o.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#o.clear(),this.#s.clear()})}getAll(){return Array.from(this.#o)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,n.X7)(t,e))}findAll(e={}){return this.getAll().filter(t=>(0,n.X7)(e,t))}notify(e){i.Vr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return i.Vr.batch(()=>Promise.all(e.map(e=>e.continue().catch(n.ZT))))}};function d(e){return e.options.scope?.id}var c=r(87045),h=r(57853);function f(e){return{onFetch:(t,r)=>{let a=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,o=t.state.data?.pages||[],s=t.state.data?.pageParams||[],l={pages:[],pageParams:[]},u=0,d=async()=>{let r=!1,d=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(t.signal.aborted?r=!0:t.signal.addEventListener("abort",()=>{r=!0}),t.signal)})},c=(0,n.cG)(t.options,t.fetchOptions),h=async(e,a,i)=>{if(r)return Promise.reject();if(null==a&&e.pages.length)return Promise.resolve(e);let o=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:a,direction:i?"backward":"forward",meta:t.options.meta};return d(e),e})(),s=await c(o),{maxPages:l}=t.options,u=i?n.Ht:n.VX;return{pages:u(e.pages,s,l),pageParams:u(e.pageParams,a,l)}};if(i&&o.length){let e="backward"===i,t={pages:o,pageParams:s},r=(e?function(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}:m)(a,t);l=await h(t,r,e)}else{let t=e??o.length;do{let e=0===u?s[0]??a.initialPageParam:m(a,l);if(u>0&&null==e)break;l=await h(l,e),u++}while(ut.options.persister?.(d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=d}}}function m(e,{pages:t,pageParams:r}){let n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}var p=class{#u;#r;#d;#c;#h;#f;#m;#p;constructor(e={}){this.#u=e.queryCache||new s,this.#r=e.mutationCache||new u,this.#d=e.defaultOptions||{},this.#c=new Map,this.#h=new Map,this.#f=0}mount(){this.#f++,1===this.#f&&(this.#m=c.j.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#u.onFocus())}),this.#p=h.N.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#u.onOnline())}))}unmount(){this.#f--,0===this.#f&&(this.#m?.(),this.#m=void 0,this.#p?.(),this.#p=void 0)}isFetching(e){return this.#u.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#r.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#u.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=this.#u.build(this,t),a=r.state.data;return void 0===a?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime((0,n.KC)(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(a))}getQueriesData(e){return this.#u.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,r){let a=this.defaultQueryOptions({queryKey:e}),i=this.#u.get(a.queryHash),o=i?.state.data,s=(0,n.SE)(t,o);if(void 0!==s)return this.#u.build(this,a).setData(s,{...r,manual:!0})}setQueriesData(e,t,r){return i.Vr.batch(()=>this.#u.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#u.get(t.queryHash)?.state}removeQueries(e){let t=this.#u;i.Vr.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let r=this.#u;return i.Vr.batch(()=>(r.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:!0,...t};return Promise.all(i.Vr.batch(()=>this.#u.findAll(e).map(e=>e.cancel(r)))).then(n.ZT).catch(n.ZT)}invalidateQueries(e,t={}){return i.Vr.batch(()=>(this.#u.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType==="none")?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t))}refetchQueries(e,t={}){let r={...t,cancelRefetch:t.cancelRefetch??!0};return Promise.all(i.Vr.batch(()=>this.#u.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,r);return r.throwOnError||(t=t.catch(n.ZT)),"paused"===e.state.fetchStatus?Promise.resolve():t}))).then(n.ZT)}fetchQuery(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let r=this.#u.build(this,t);return r.isStaleByTime((0,n.KC)(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(n.ZT).catch(n.ZT)}fetchInfiniteQuery(e){return e.behavior=f(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(n.ZT).catch(n.ZT)}ensureInfiniteQueryData(e){return e.behavior=f(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return h.N.isOnline()?this.#r.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#u}getMutationCache(){return this.#r}getDefaultOptions(){return this.#d}setDefaultOptions(e){this.#d=e}setQueryDefaults(e,t){this.#c.set((0,n.Ym)(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#c.values()],r={};return t.forEach(t=>{(0,n.to)(e,t.queryKey)&&Object.assign(r,t.defaultOptions)}),r}setMutationDefaults(e,t){this.#h.set((0,n.Ym)(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#h.values()],r={};return t.forEach(t=>{(0,n.to)(e,t.mutationKey)&&Object.assign(r,t.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#d.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=(0,n.Rm)(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===n.CN&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#d.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#u.clear(),this.#r.clear()}}},85238:function(e,t,r){let n;r.d(t,{u:function(){return L}});var a=r(2265),i=r(59456),o=r(93980),s=r(25289),l=r(73389),u=r(43507),d=r(180),c=r(67561),h=r(98218),f=r(28294),m=r(95504),p=r(72468),g=r(38929);function b(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||(null!=(t=e.as)?t:x)!==a.Fragment||1===a.Children.count(e.children)}let v=(0,a.createContext)(null);v.displayName="TransitionContext";var w=((n=w||{}).Visible="visible",n.Hidden="hidden",n);let y=(0,a.createContext)(null);function k(e){return"children"in e?k(e.children):e.current.filter(e=>{let{el:t}=e;return null!==t.current}).filter(e=>{let{state:t}=e;return"visible"===t}).length>0}function C(e,t){let r=(0,u.E)(e),n=(0,a.useRef)([]),l=(0,s.t)(),d=(0,i.G)(),c=(0,o.z)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g.l4.Hidden,a=n.current.findIndex(t=>{let{el:r}=t;return r===e});-1!==a&&((0,p.E)(t,{[g.l4.Unmount](){n.current.splice(a,1)},[g.l4.Hidden](){n.current[a].state="hidden"}}),d.microTask(()=>{var e;!k(n)&&l.current&&(null==(e=r.current)||e.call(r))}))}),h=(0,o.z)(e=>{let t=n.current.find(t=>{let{el:r}=t;return r===e});return t?"visible"!==t.state&&(t.state="visible"):n.current.push({el:e,state:"visible"}),()=>c(e,g.l4.Unmount)}),f=(0,a.useRef)([]),m=(0,a.useRef)(Promise.resolve()),b=(0,a.useRef)({enter:[],leave:[]}),v=(0,o.z)((e,r,n)=>{f.current.splice(0),t&&(t.chains.current[r]=t.chains.current[r].filter(t=>{let[r]=t;return r!==e})),null==t||t.chains.current[r].push([e,new Promise(e=>{f.current.push(e)})]),null==t||t.chains.current[r].push([e,new Promise(e=>{Promise.all(b.current[r].map(e=>{let[t,r]=e;return r})).then(()=>e())})]),"enter"===r?m.current=m.current.then(()=>null==t?void 0:t.wait.current).then(()=>n(r)):n(r)}),w=(0,o.z)((e,t,r)=>{Promise.all(b.current[t].splice(0).map(e=>{let[t,r]=e;return r})).then(()=>{var e;null==(e=f.current.shift())||e()}).then(()=>r(t))});return(0,a.useMemo)(()=>({children:n,register:h,unregister:c,onStart:v,onStop:w,wait:m,chains:b}),[h,c,n,v,w,b,m])}y.displayName="NestingContext";let x=a.Fragment,E=g.VN.RenderStrategy,M=(0,g.yV)(function(e,t){let{show:r,appear:n=!1,unmount:i=!0,...s}=e,u=(0,a.useRef)(null),h=b(e),m=(0,c.T)(...h?[u,t]:null===t?[]:[t]);(0,d.H)();let p=(0,f.oJ)();if(void 0===r&&null!==p&&(r=(p&f.ZM.Open)===f.ZM.Open),void 0===r)throw Error("A is used but it is missing a `show={true | false}` prop.");let[w,x]=(0,a.useState)(r?"visible":"hidden"),M=C(()=>{r||x("hidden")}),[O,L]=(0,a.useState)(!0),N=(0,a.useRef)([r]);(0,l.e)(()=>{!1!==O&&N.current[N.current.length-1]!==r&&(N.current.push(r),L(!1))},[N,r]);let P=(0,a.useMemo)(()=>({show:r,appear:n,initial:O}),[r,n,O]);(0,l.e)(()=>{r?x("visible"):k(M)||null===u.current||x("hidden")},[r,M]);let R={unmount:i},j=(0,o.z)(()=>{var t;O&&L(!1),null==(t=e.beforeEnter)||t.call(e)}),T=(0,o.z)(()=>{var t;O&&L(!1),null==(t=e.beforeLeave)||t.call(e)}),Z=(0,g.L6)();return a.createElement(y.Provider,{value:M},a.createElement(v.Provider,{value:P},Z({ourProps:{...R,as:a.Fragment,children:a.createElement(q,{ref:m,...R,...s,beforeEnter:j,beforeLeave:T})},theirProps:{},defaultTag:a.Fragment,features:E,visible:"visible"===w,name:"Transition"})))}),q=(0,g.yV)(function(e,t){var r,n;let{transition:i=!0,beforeEnter:s,afterEnter:u,beforeLeave:w,afterLeave:M,enter:q,enterFrom:O,enterTo:L,entered:N,leave:P,leaveFrom:R,leaveTo:j,...T}=e,[Z,D]=(0,a.useState)(null),Q=(0,a.useRef)(null),A=b(e),S=(0,c.T)(...A?[Q,t,D]:null===t?[]:[t]),V=null==(r=T.unmount)||r?g.l4.Unmount:g.l4.Hidden,{show:F,appear:z,initial:K}=function(){let e=(0,a.useContext)(v);if(null===e)throw Error("A is used but it is missing a parent or .");return e}(),[H,B]=(0,a.useState)(F?"visible":"hidden"),I=function(){let e=(0,a.useContext)(y);if(null===e)throw Error("A is used but it is missing a parent or .");return e}(),{register:_,unregister:W}=I;(0,l.e)(()=>_(Q),[_,Q]),(0,l.e)(()=>{if(V===g.l4.Hidden&&Q.current){if(F&&"visible"!==H){B("visible");return}return(0,p.E)(H,{hidden:()=>W(Q),visible:()=>_(Q)})}},[H,Q,_,W,F,V]);let Y=(0,d.H)();(0,l.e)(()=>{if(A&&Y&&"visible"===H&&null===Q.current)throw Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[Q,H,Y,A]);let X=K&&!z,G=z&&F&&K,U=(0,a.useRef)(!1),J=C(()=>{U.current||(B("hidden"),W(Q))},I),$=(0,o.z)(e=>{U.current=!0,J.onStart(Q,e?"enter":"leave",e=>{"enter"===e?null==s||s():"leave"===e&&(null==w||w())})}),ee=(0,o.z)(e=>{let t=e?"enter":"leave";U.current=!1,J.onStop(Q,t,e=>{"enter"===e?null==u||u():"leave"===e&&(null==M||M())}),"leave"!==t||k(J)||(B("hidden"),W(Q))});(0,a.useEffect)(()=>{A&&i||($(F),ee(F))},[F,A,i]);let et=!(!i||!A||!Y||X),[,er]=(0,h.Y)(et,Z,F,{start:$,end:ee}),en=(0,g.oA)({ref:S,className:(null==(n=(0,m.A)(T.className,G&&q,G&&O,er.enter&&q,er.enter&&er.closed&&O,er.enter&&!er.closed&&L,er.leave&&P,er.leave&&!er.closed&&R,er.leave&&er.closed&&j,!er.transition&&F&&N))?void 0:n.trim())||void 0,...(0,h.X)(er)}),ea=0;"visible"===H&&(ea|=f.ZM.Open),"hidden"===H&&(ea|=f.ZM.Closed),er.enter&&(ea|=f.ZM.Opening),er.leave&&(ea|=f.ZM.Closing);let ei=(0,g.L6)();return a.createElement(y.Provider,{value:J},a.createElement(f.up,{value:ea},ei({ourProps:en,theirProps:T,defaultTag:x,features:E,visible:"visible"===H,name:"Transition.Child"})))}),O=(0,g.yV)(function(e,t){let r=null!==(0,a.useContext)(v),n=null!==(0,f.oJ)();return a.createElement(a.Fragment,null,!r&&n?a.createElement(M,{ref:t,...e}):a.createElement(q,{ref:t,...e}))}),L=Object.assign(M,{Child:O,Root:M})},92668:function(e,t,r){r.d(t,{I:function(){return s}});var n=r(59121),a=r(31091),i=r(63497),o=r(99649);function s(e,t){let{years:r=0,months:s=0,weeks:l=0,days:u=0,hours:d=0,minutes:c=0,seconds:h=0}=t,f=(0,o.Q)(e),m=s||r?(0,a.z)(f,s+12*r):f,p=u||l?(0,n.E)(m,u+7*l):m;return(0,i.L)(e,p.getTime()+1e3*(h+60*(c+60*d)))}},59121:function(e,t,r){r.d(t,{E:function(){return i}});var n=r(99649),a=r(63497);function i(e,t){let r=(0,n.Q)(e);return isNaN(t)?(0,a.L)(e,NaN):(t&&r.setDate(r.getDate()+t),r)}},31091:function(e,t,r){r.d(t,{z:function(){return i}});var n=r(99649),a=r(63497);function i(e,t){let r=(0,n.Q)(e);if(isNaN(t))return(0,a.L)(e,NaN);if(!t)return r;let i=r.getDate(),o=(0,a.L)(e,r.getTime());return(o.setMonth(r.getMonth()+t+1,0),i>=o.getDate())?o:(r.setFullYear(o.getFullYear(),o.getMonth(),i),r)}},63497:function(e,t,r){r.d(t,{L:function(){return n}});function n(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}},99649:function(e,t,r){r.d(t,{Q:function(){return n}});function n(e){let t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):new Date("number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?e:NaN)}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1518-4475f8385da5ac78.js b/litellm/proxy/_experimental/out/_next/static/chunks/1518-af5eabc2040f5a96.js similarity index 65% rename from litellm/proxy/_experimental/out/_next/static/chunks/1518-4475f8385da5ac78.js rename to litellm/proxy/_experimental/out/_next/static/chunks/1518-af5eabc2040f5a96.js index 476fabcb02f..1a82a757ee1 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1518-4475f8385da5ac78.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1518-af5eabc2040f5a96.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1518],{81518:function(e,s,a){a.r(s),a.d(s,{default:function(){return Y}});var t=a(57437),r=a(2265),n=a(85572),l=a(93837),i=a(37592),o=a(4260),d=a(99981),c=a(5545),m=a(26430),u=a(96473),x=a(9114),h=a(10703),p=a(95459),g=a(32489),f=a(98728),v=a(62831),j=a(17906),y=a(94263),b=a(79862),N=a(82222),k=a(51817),w=a(94331),A=a(38398),S=a(33152);function C(e){let{messages:s,isLoading:a}=e;if(0===s.length)return(0,t.jsx)("div",{className:"h-full"});let r=[],n=0;for(;n(0,t.jsx)("div",{className:"whitespace-pre-wrap break-words",style:{wordWrap:"break-word",overflowWrap:"break-word",wordBreak:"break-word",hyphens:"auto"},children:(0,t.jsx)(v.UG,{components:{code(e){let{node:s,inline:a,className:r,children:n,...l}=e,i=/language-(\w+)/.exec(r||"");return!a&&i?(0,t.jsx)(j.Z,{style:y.Z,language:i[1],PreTag:"div",className:"rounded-md my-2",wrapLines:!0,wrapLongLines:!0,...l,children:String(n).replace(/\n$/,"")}):(0,t.jsx)("code",{className:"".concat(r," px-1.5 py-0.5 rounded bg-gray-100 text-sm font-mono"),...l,children:n})},pre:e=>{let{node:s,...a}=e;return(0,t.jsx)("pre",{style:{overflowX:"auto",maxWidth:"100%"},...a})}},children:"string"==typeof e.content?e.content:""})});return(0,t.jsxs)("div",{className:"flex flex-col gap-6 min-w-0 w-full p-4",children:[r.map((e,s)=>{let n=e.assistant,i=(null==n?void 0:n.model)||"Assistant";return(0,t.jsxs)("div",{className:"space-y-4",children:[e.user&&(0,t.jsxs)("div",{className:"space-y-2 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-blue-100 text-blue-600",children:(0,t.jsx)(b.Z,{size:16})}),(0,t.jsx)("div",{className:"text-sm font-semibold text-gray-700",children:"You"})]}),l(e.user)]}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),n?(0,t.jsxs)("div",{className:"space-y-3 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-gray-100 text-gray-600",children:(0,t.jsx)(N.Z,{size:16})}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-semibold text-gray-700",children:i}),n.toolName&&(0,t.jsx)("span",{className:"rounded bg-gray-100 px-2 py-0.5 text-xs text-gray-600",children:n.toolName})]})]}),n.reasoningContent&&(0,t.jsx)(w.Z,{reasoningContent:n.reasoningContent}),n.searchResults&&(0,t.jsx)(S.J,{searchResults:n.searchResults}),l(n),(n.timeToFirstToken||n.totalLatency||n.usage)&&(0,t.jsx)(A.Z,{timeToFirstToken:n.timeToFirstToken,totalLatency:n.totalLatency,usage:n.usage,toolName:n.toolName})]}):a&&s===r.length-1?(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[(0,t.jsx)(k.Z,{size:18,className:"animate-spin"}),(0,t.jsx)("span",{children:"Generating response..."})]}):(0,t.jsx)("div",{className:"text-sm text-gray-500",children:"Waiting for a response..."})]},s)}),a&&0===r.length&&(0,t.jsxs)("div",{className:"flex items-center gap-2 text-gray-500",children:[(0,t.jsx)(k.Z,{size:18,className:"animate-spin"}),(0,t.jsx)("span",{children:"Generating response..."})]})]})}var T=a(31283);function P(e){let{value:s,onChange:a,models:n,loading:l,disabled:o}=e,[d,c]=(0,r.useState)(!1),[m,u]=(0,r.useState)(""),x=(0,r.useMemo)(()=>Array.from(new Set(n)).sort(),[n]),h=(0,r.useMemo)(()=>s&&!x.includes(s)?[s,...x]:x,[x,s]),p=d?"__custom__":s||void 0,g=()=>{let e=m.trim();if(!e){c(!1),u("");return}a(e),c(!1),u("")};return(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)(i.default,{value:p,onChange:e=>{if("__custom__"===e){c(!0),s&&!x.includes(s)?u(s):u("");return}c(!1),u(""),a(e)},disabled:o,loading:l,placeholder:l?"Loading models...":"Select a model",className:"w-full rounded-md",showSearch:!0,optionFilterProp:"children",children:[h.map(e=>(0,t.jsx)(i.default.Option,{value:e,children:e},e)),(0,t.jsx)(i.default.Option,{value:"__custom__",children:"+ Add custom model"})]}),d&&(0,t.jsx)(T.o,{className:"mt-2",placeholder:"Custom Model Name (Enter to add)",value:m,onValueChange:u,onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),g())},onBlur:g,autoFocus:!0})]})}var Z=a(99020),_=a(97415),L=a(67479),E=a(61994),M=a(23496),I=a(85847),O=a(79326);function R(e){let{comparison:s,onUpdate:a,onRemove:n,canRemove:l,modelOptions:i,isLoadingModels:o,apiKey:d}=e,[c,m]=(0,r.useState)(!1),u=e=>{e?a({applyAcrossModels:!0,temperature:s.temperature,maxTokens:s.maxTokens,tags:[...s.tags],vectorStores:[...s.vectorStores],guardrails:[...s.guardrails],useAdvancedParams:s.useAdvancedParams},{applyToAll:!0,keysToApply:["temperature","maxTokens","tags","vectorStores","guardrails","useAdvancedParams"]}):a({applyAcrossModels:!1})},x=e=>{a({useAdvancedParams:e},s.applyAcrossModels?{applyToAll:!0,keysToApply:["useAdvancedParams"]}:void 0)},h=(e,t)=>{a({[e]:t},s.applyAcrossModels?{applyToAll:!0,keysToApply:[e]}:void 0)},p=s.useAdvancedParams?1:.4,v=s.useAdvancedParams?"text-gray-700":"text-gray-400",j=()=>{m(e=>!e)},y=(0,t.jsxs)("div",{className:"w-[300px] max-h-[65vh] overflow-y-auto relative",children:[(0,t.jsx)("button",{onClick:()=>{m(!1)},className:"absolute top-0 right-0 p-1 hover:bg-gray-100 rounded transition-colors text-gray-500 hover:text-gray-700 z-10",children:(0,t.jsx)(g.Z,{size:14})}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsx)(E.Z,{checked:s.applyAcrossModels,onChange:e=>u(e.target.checked),children:(0,t.jsx)("span",{className:"text-xs font-medium",children:"Sync Settings Across Models"})})}),(0,t.jsx)(M.Z,{className:"border-gray-200"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-xs font-semibold text-gray-700 mb-1.5 uppercase tracking-wide",children:"General Settings"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-600 block mb-0.5",children:"Tags"}),(0,t.jsx)(Z.Z,{value:s.tags,onChange:e=>h("tags",e),accessToken:d})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-600 block mb-0.5",children:"Vector Stores"}),(0,t.jsx)(_.Z,{value:s.vectorStores,onChange:e=>h("vectorStores",e),accessToken:d})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-600 block mb-0.5",children:"Guardrails"}),(0,t.jsx)(L.Z,{value:s.guardrails,onChange:e=>h("guardrails",e),accessToken:d})]})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-xs font-semibold text-gray-700 mb-1.5 uppercase tracking-wide",children:"Advanced Settings"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("div",{className:"flex items-center gap-2 pb-1",children:(0,t.jsx)(E.Z,{checked:s.useAdvancedParams,onChange:e=>x(e.target.checked),children:(0,t.jsx)("span",{className:"text-sm font-medium",children:"Use Advanced Parameters"})})}),(0,t.jsxs)("div",{className:"space-y-2 transition-opacity duration-200",style:{opacity:p},children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium ".concat(v),children:"Temperature"}),(0,t.jsx)("span",{className:"text-xs ".concat(v),children:s.temperature.toFixed(2)})]}),(0,t.jsx)(I.Z,{min:0,max:2,step:.01,value:s.temperature,onChange:e=>{h("temperature",Math.min(2,Math.max(0,Number((Array.isArray(e)?e[0]:e).toFixed(2)))))},disabled:!s.useAdvancedParams})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium ".concat(v),children:"Max Tokens"}),(0,t.jsx)("span",{className:"text-xs ".concat(v),children:s.maxTokens})]}),(0,t.jsx)(I.Z,{min:1,max:32768,step:1,value:s.maxTokens,onChange:e=>{h("maxTokens",Math.min(32768,Math.max(1,Math.round(Array.isArray(e)?e[0]:e))))},disabled:!s.useAdvancedParams})]})]})]})]})]})]});return(0,t.jsxs)("div",{className:"bg-white first:border-l-0 border-l border-gray-200 flex flex-col min-h-0",children:[(0,t.jsxs)("div",{className:"border-b flex items-center justify-between gap-3 px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 flex-1",children:[(0,t.jsx)(P,{value:s.model,models:i,loading:o,onChange:e=>a({model:e})}),(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsx)(O.Z,{content:y,trigger:[],open:c,onOpenChange:()=>{},placement:"bottomRight",destroyTooltipOnHide:!1,children:(0,t.jsx)("button",{onClick:e=>{e.stopPropagation(),j()},className:"p-2 rounded-lg transition-colors ".concat(c?"bg-gray-200 text-gray-700":"hover:bg-gray-100 text-gray-600"),children:(0,t.jsx)(f.Z,{size:18})})})})]}),l&&(0,t.jsx)("button",{onClick:e=>{e.stopPropagation(),n()},className:"p-2 hover:bg-red-50 text-red-600 rounded-lg transition-colors",children:(0,t.jsx)(g.Z,{size:18})})]}),(0,t.jsx)("div",{className:"relative flex-1 flex flex-col min-h-0",children:(0,t.jsx)("div",{className:"flex-1 max-h-[calc(100vh-385px)] overflow-auto rounded-b-2xl",children:(0,t.jsx)(C,{messages:s.messages,isLoading:s.isLoading})})})]})}var z=a(79276);let{TextArea:U}=o.default;function K(e){let{value:s,onChange:a,onSend:r,disabled:n}=e;return(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsxs)("div",{className:"flex items-center flex-1 bg-white border border-gray-300 rounded-xl px-3 py-1 min-h-[44px]",children:[(0,t.jsx)(U,{value:s,onChange:e=>a(e.target.value),onKeyDown:e=>{"Enter"===e.key&&!e.shiftKey&&(e.preventDefault(),!n&&s.trim()&&r())},placeholder:"Type your message... (Shift+Enter for new line)",disabled:n,className:"flex-1",autoSize:{minRows:1,maxRows:4},style:{resize:"none",border:"none",boxShadow:"none",background:"transparent",padding:"4px 0",fontSize:"14px",lineHeight:"20px"}}),(0,t.jsx)(c.ZP,{onClick:r,disabled:n||!s.trim(),icon:(0,t.jsx)(z.Z,{}),shape:"circle"})]})})}let B=["Can you summarize the key points?","What assumptions did you make?","What are the next steps?"],D=["Write me a poem","Explain quantum computing","Draft a polite email requesting a meeting"],F="/v1/chat/completions";function W(e){let{accessToken:s,disabledPersonalKeyCreation:a}=e,[n,g]=(0,r.useState)([{id:"1",model:"",messages:[],isLoading:!1,tags:[],mcpTools:[],vectorStores:[],guardrails:[],temperature:1,maxTokens:2048,applyAcrossModels:!1,useAdvancedParams:!1},{id:"2",model:"",messages:[],isLoading:!1,tags:[],mcpTools:[],vectorStores:[],guardrails:[],temperature:1,maxTokens:2048,applyAcrossModels:!1,useAdvancedParams:!1}]),[f,v]=(0,r.useState)([]),[j,y]=(0,r.useState)(!1),[b,N]=(0,r.useState)(""),[k,w]=(0,r.useState)(a?"custom":"session"),[A,S]=(0,r.useState)(""),[C,T]=(0,r.useState)("");(0,r.useEffect)(()=>{let e=setTimeout(()=>{T(A)},300);return()=>clearTimeout(e)},[A]);let P=(0,r.useMemo)(()=>"session"===k?s||"":C.trim(),[k,s,C]),Z=(0,r.useMemo)(()=>n.length>0&&n.every(e=>!e.isLoading&&e.messages.some(e=>"assistant"===e.role)),[n]);(0,r.useEffect)(()=>{let e=!0;return(async()=>{if(!P){v([]);return}y(!0);try{let s=await (0,h.p)(P);if(!e)return;let a=Array.from(new Set(s.map(e=>e.model_group)));v(a)}catch(s){console.error("CompareUI: failed to fetch models",s),e&&v([])}finally{e&&y(!1)}})(),()=>{e=!1}},[P]),(0,r.useEffect)(()=>{0!==f.length&&g(e=>e.map((e,s)=>{var a,t,r,n,l;return{...e,temperature:null!==(a=e.temperature)&&void 0!==a?a:1,maxTokens:null!==(t=e.maxTokens)&&void 0!==t?t:2048,applyAcrossModels:null!==(r=e.applyAcrossModels)&&void 0!==r&&r,useAdvancedParams:null!==(n=e.useAdvancedParams)&&void 0!==n&&n,...e.model?{}:{model:null!==(l=f[s%f.length])&&void 0!==l?l:""}}}))},[f]);let _=e=>{n.length>1&&g(s=>s.filter(s=>s.id!==e))},L=(e,s,a)=>{g(t=>{var r;if((null==a?void 0:a.applyToAll)&&(null===(r=a.keysToApply)||void 0===r?void 0:r.length)){let r={};a.keysToApply.forEach(e=>{let a=s[e];void 0!==a&&(r[e]=Array.isArray(a)?[...a]:a)});let n=Object.keys(r).length>0;return t.map(a=>a.id===e?{...a,...s}:n?{...a,...r}:a)}return t.map(a=>a.id===e?{...a,...s}:a)})},E=(e,s,a)=>{s&&g(t=>t.map(t=>{if(t.id!==e)return t;let r=[...t.messages],n=r[r.length-1];if(n&&"assistant"===n.role){var l;let e="string"==typeof n.content?n.content:"";r[r.length-1]={...n,content:e+s,model:null!==(l=n.model)&&void 0!==l?l:a}}else r.push({role:"assistant",content:s,model:a});return{...t,messages:r}}))},M=(e,s)=>{s&&g(a=>a.map(a=>{if(a.id!==e)return a;let t=[...a.messages],r=t[t.length-1];return r&&"assistant"===r.role?t[t.length-1]={...r,reasoningContent:(r.reasoningContent||"")+s}:r&&"user"===r.role&&t.push({role:"assistant",content:"",reasoningContent:s}),{...a,messages:t}}))},I=(e,s)=>{g(a=>a.map(a=>{if(a.id!==e)return a;let t=[...a.messages],r=t[t.length-1];return r&&"assistant"===r.role?t[t.length-1]={...r,timeToFirstToken:s}:r&&"user"===r.role&&t.push({role:"assistant",content:"",timeToFirstToken:s}),{...a,messages:t}}))},O=(e,s)=>{g(a=>a.map(a=>{if(a.id!==e)return a;let t=[...a.messages],r=t[t.length-1];return r&&"assistant"===r.role?t[t.length-1]={...r,totalLatency:s}:r&&"user"===r.role&&t.push({role:"assistant",content:"",totalLatency:s}),{...a,messages:t}}))},z=(e,s,a)=>{g(t=>t.map(t=>{if(t.id!==e)return t;let r=[...t.messages],n=r[r.length-1];return n&&"assistant"===n.role&&(r[r.length-1]={...n,usage:s,toolName:a}),{...t,messages:r}}))},U=(e,s)=>{s&&g(a=>a.map(a=>{if(a.id!==e)return a;let t=[...a.messages],r=t[t.length-1];return r&&"assistant"===r.role&&(t[t.length-1]={...r,searchResults:s}),{...a,messages:t}}))},W=!!s,G=e=>{let s=e.trim();if(!s)return;if(!P){x.Z.fromBackend("Please provide an API key or select Current UI Session");return}if(0===n.length)return;if(n.some(e=>!e.model)){x.Z.fromBackend("Select a model before sending a message.");return}let a=new Map;n.forEach(e=>{var t;let r=null!==(t=e.traceId)&&void 0!==t?t:(0,l.Z)();a.set(e.id,{id:e.id,model:e.model,traceId:r,tags:e.tags,vectorStores:e.vectorStores,guardrails:e.guardrails,temperature:e.temperature,maxTokens:e.maxTokens,messages:[...e.messages,{role:"user",content:s}]})}),0!==a.size&&(g(e=>e.map(e=>{let s=a.get(e.id);return s?{...e,traceId:s.traceId,messages:s.messages,isLoading:!0}:e})),a.forEach(e=>{var s;let a=e.messages.map(e=>{let{role:s,content:a}=e;return{role:s,content:"string"==typeof a?a:""}}),t=e.tags.length>0?e.tags:void 0,r=e.vectorStores.length>0?e.vectorStores:void 0,l=e.guardrails.length>0?e.guardrails:void 0,i=n.find(s=>s.id===e.id),o=null!==(s=null==i?void 0:i.useAdvancedParams)&&void 0!==s&&s;(0,p.n)(a,(s,a)=>E(e.id,s,a),e.model,P,t,void 0,s=>M(e.id,s),s=>I(e.id,s),s=>z(e.id,s),e.traceId,r,l,void 0,void 0,s=>U(e.id,s),o?e.temperature:void 0,o?e.maxTokens:void 0,s=>O(e.id,s)).catch(s=>{let a=s instanceof Error?s.message:String(s);console.error("CompareUI: failed to fetch response",s),x.Z.fromBackend(a),g(s=>s.map(s=>{if(s.id!==e.id)return s;let t=[...s.messages],r=t[t.length-1],n=r&&"assistant"===r.role&&"string"==typeof r.content?r.content:"";return r&&"assistant"===r.role?t[t.length-1]={...r,content:n?"".concat(n,"\nError fetching response: ").concat(a):"Error fetching response: ".concat(a)}:t.push({role:"assistant",content:"Error fetching response: ".concat(a)}),{...s,messages:t}}))}).finally(()=>{g(s=>s.map(s=>s.id===e.id?{...s,isLoading:!1}:s))})}))},V=e=>{N(e)},X=n.some(e=>e.messages.length>0),Y=n.some(e=>e.isLoading);return(0,t.jsx)("div",{className:"w-full h-full p-4 bg-white",children:(0,t.jsxs)("div",{className:"rounded-2xl border border-gray-200 bg-white shadow-sm min-h-[calc(100vh-140px)] flex flex-col",children:[(0,t.jsx)("div",{className:"border-b px-4 py-2",children:(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-600",children:"API Key Source"}),(0,t.jsxs)(i.default,{value:k,onChange:e=>w(e),disabled:a,className:"w-48",children:[(0,t.jsx)(i.default.Option,{value:"session",disabled:!W,children:"Current UI Session"}),(0,t.jsx)(i.default.Option,{value:"custom",children:"Virtual Key"})]}),"custom"===k&&(0,t.jsx)(o.default.Password,{value:A,onChange:e=>S(e.target.value),placeholder:"Enter API key",className:"w-56"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-600",children:"Endpoint"}),(0,t.jsx)(d.Z,{title:"Other endpoints will be available soon",children:(0,t.jsx)(i.default,{value:F,disabled:!0,className:"w-56",children:(0,t.jsx)(i.default.Option,{value:F,children:F})})})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)(c.ZP,{onClick:()=>{g(e=>e.map(e=>({...e,messages:[],traceId:void 0,isLoading:!1}))),N("")},disabled:!X,icon:(0,t.jsx)(m.Z,{}),children:"Clear All Chats"}),(0,t.jsx)(d.Z,{title:n.length>=3?"Compare up to 3 models at a time":"Add another comparison",children:(0,t.jsx)(c.ZP,{onClick:()=>{var e;if(n.length>=3)return;let s=null!==(e=f[n.length%(f.length||1)])&&void 0!==e?e:"",a={id:Date.now().toString(),model:s,messages:[],isLoading:!1,tags:[],mcpTools:[],vectorStores:[],guardrails:[],temperature:1,maxTokens:2048,applyAcrossModels:!1,useAdvancedParams:!1};g(e=>[...e,a])},disabled:n.length>=3,icon:(0,t.jsx)(u.Z,{}),children:"Add Comparison"})})]})]})}),(0,t.jsx)("div",{className:"grid flex-1 min-h-0 auto-rows-[minmax(0,1fr)]",style:{gridTemplateColumns:"repeat(".concat(n.length,", minmax(0, 1fr))")},children:n.map(e=>(0,t.jsx)(R,{comparison:e,onUpdate:(s,a)=>L(e.id,s,a),onRemove:()=>_(e.id),canRemove:n.length>1,modelOptions:f,isLoadingModels:j,apiKey:P},e.id))}),(0,t.jsx)("div",{className:"flex justify-center pb-4",children:(0,t.jsx)("div",{className:"w-full max-w-3xl px-4",children:(0,t.jsxs)("div",{className:"border border-gray-200 shadow-lg rounded-xl bg-white p-4",children:[(0,t.jsx)("div",{className:"flex items-center justify-between gap-4 mb-3 min-h-8",children:X||Y?Z?(0,t.jsx)("div",{className:"flex items-center gap-2 overflow-x-auto",children:B.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>V(e),className:"shrink-0 rounded-full border border-gray-200 px-3 py-1 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-100 cursor-pointer",children:e},e))}):Y?(0,t.jsxs)("span",{className:"flex items-center gap-2 text-sm text-gray-500",children:[(0,t.jsx)("span",{className:"h-2 w-2 rounded-full bg-blue-500 animate-pulse","aria-hidden":!0}),"Gathering responses from all models..."]}):(0,t.jsx)("span",{className:"text-sm text-gray-500",children:"Send a prompt to compare models"}):(0,t.jsx)("div",{className:"flex items-center gap-2 overflow-x-auto",children:D.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>V(e),className:"shrink-0 rounded-full border border-gray-200 px-3 py-1 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-100 cursor-pointer",children:e},e))})}),(0,t.jsx)(K,{value:b,onChange:e=>{N(e)},onSend:()=>{G(b),N("")},disabled:0===n.length||n.every(e=>e.isLoading)})]})})})]})})}var G=a(58643),V=a(39760),X=a(91624);function Y(){let{accessToken:e,userRole:s,userId:a,disabledPersonalKeyCreation:l,token:i}=(0,V.Z)(),[o,d]=(0,r.useState)(void 0);return(0,r.useEffect)(()=>{(async()=>{if(e){let s=await (0,X.C)(e);s&&d({PROXY_BASE_URL:s.PROXY_BASE_URL,LITELLM_UI_API_DOC_BASE_URL:s.LITELLM_UI_API_DOC_BASE_URL})}})()},[e]),(0,t.jsxs)(G.v0,{className:"h-full w-full",children:[(0,t.jsxs)(G.td,{className:"mb-0",children:[(0,t.jsx)(G.OK,{children:"Chat"}),(0,t.jsx)(G.OK,{children:"Compare"})]}),(0,t.jsxs)(G.nP,{className:"h-full",children:[(0,t.jsx)(G.x4,{className:"h-full",children:(0,t.jsx)(n.Z,{accessToken:e,token:i,userRole:s,userID:a,disabledPersonalKeyCreation:l,proxySettings:o})}),(0,t.jsx)(G.x4,{className:"h-full",children:(0,t.jsx)(W,{accessToken:e,disabledPersonalKeyCreation:l})})]})]})}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1518],{81518:function(e,s,a){a.r(s),a.d(s,{default:function(){return Y}});var t=a(57437),r=a(2265),n=a(39566),l=a(93837),i=a(37592),o=a(4260),d=a(99981),c=a(5545),m=a(26430),u=a(96473),x=a(9114),h=a(10703),p=a(95459),g=a(32489),f=a(98728),v=a(62831),j=a(17906),y=a(57365),b=a(79862),N=a(82222),k=a(51817),w=a(94331),A=a(38398),S=a(33152);function C(e){let{messages:s,isLoading:a}=e;if(0===s.length)return(0,t.jsx)("div",{className:"h-full"});let r=[],n=0;for(;n(0,t.jsx)("div",{className:"whitespace-pre-wrap break-words",style:{wordWrap:"break-word",overflowWrap:"break-word",wordBreak:"break-word",hyphens:"auto"},children:(0,t.jsx)(v.UG,{components:{code(e){let{node:s,inline:a,className:r,children:n,...l}=e,i=/language-(\w+)/.exec(r||"");return!a&&i?(0,t.jsx)(j.Z,{style:y.Z,language:i[1],PreTag:"div",className:"rounded-md my-2",wrapLines:!0,wrapLongLines:!0,...l,children:String(n).replace(/\n$/,"")}):(0,t.jsx)("code",{className:"".concat(r," px-1.5 py-0.5 rounded bg-gray-100 text-sm font-mono"),...l,children:n})},pre:e=>{let{node:s,...a}=e;return(0,t.jsx)("pre",{style:{overflowX:"auto",maxWidth:"100%"},...a})}},children:"string"==typeof e.content?e.content:""})});return(0,t.jsxs)("div",{className:"flex flex-col gap-6 min-w-0 w-full p-4",children:[r.map((e,s)=>{let n=e.assistant,i=(null==n?void 0:n.model)||"Assistant";return(0,t.jsxs)("div",{className:"space-y-4",children:[e.user&&(0,t.jsxs)("div",{className:"space-y-2 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-blue-100 text-blue-600",children:(0,t.jsx)(b.Z,{size:16})}),(0,t.jsx)("div",{className:"text-sm font-semibold text-gray-700",children:"You"})]}),l(e.user)]}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),n?(0,t.jsxs)("div",{className:"space-y-3 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-gray-100 text-gray-600",children:(0,t.jsx)(N.Z,{size:16})}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-semibold text-gray-700",children:i}),n.toolName&&(0,t.jsx)("span",{className:"rounded bg-gray-100 px-2 py-0.5 text-xs text-gray-600",children:n.toolName})]})]}),n.reasoningContent&&(0,t.jsx)(w.Z,{reasoningContent:n.reasoningContent}),n.searchResults&&(0,t.jsx)(S.J,{searchResults:n.searchResults}),l(n),(n.timeToFirstToken||n.totalLatency||n.usage)&&(0,t.jsx)(A.Z,{timeToFirstToken:n.timeToFirstToken,totalLatency:n.totalLatency,usage:n.usage,toolName:n.toolName})]}):a&&s===r.length-1?(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[(0,t.jsx)(k.Z,{size:18,className:"animate-spin"}),(0,t.jsx)("span",{children:"Generating response..."})]}):(0,t.jsx)("div",{className:"text-sm text-gray-500",children:"Waiting for a response..."})]},s)}),a&&0===r.length&&(0,t.jsxs)("div",{className:"flex items-center gap-2 text-gray-500",children:[(0,t.jsx)(k.Z,{size:18,className:"animate-spin"}),(0,t.jsx)("span",{children:"Generating response..."})]})]})}var T=a(31283);function Z(e){let{value:s,onChange:a,models:n,loading:l,disabled:o}=e,[d,c]=(0,r.useState)(!1),[m,u]=(0,r.useState)(""),x=(0,r.useMemo)(()=>Array.from(new Set(n)).sort(),[n]),h=(0,r.useMemo)(()=>s&&!x.includes(s)?[s,...x]:x,[x,s]),p=d?"__custom__":s||void 0,g=()=>{let e=m.trim();if(!e){c(!1),u("");return}a(e),c(!1),u("")};return(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)(i.default,{value:p,onChange:e=>{if("__custom__"===e){c(!0),s&&!x.includes(s)?u(s):u("");return}c(!1),u(""),a(e)},disabled:o,loading:l,placeholder:l?"Loading models...":"Select a model",className:"w-full rounded-md",showSearch:!0,optionFilterProp:"children",children:[h.map(e=>(0,t.jsx)(i.default.Option,{value:e,children:e},e)),(0,t.jsx)(i.default.Option,{value:"__custom__",children:"+ Add custom model"})]}),d&&(0,t.jsx)(T.o,{className:"mt-2",placeholder:"Custom Model Name (Enter to add)",value:m,onValueChange:u,onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),g())},onBlur:g,autoFocus:!0})]})}var P=a(99020),_=a(97415),L=a(67479),E=a(61994),M=a(23496),I=a(85847),O=a(79326);function R(e){let{comparison:s,onUpdate:a,onRemove:n,canRemove:l,modelOptions:i,isLoadingModels:o,apiKey:d}=e,[c,m]=(0,r.useState)(!1),u=e=>{e?a({applyAcrossModels:!0,temperature:s.temperature,maxTokens:s.maxTokens,tags:[...s.tags],vectorStores:[...s.vectorStores],guardrails:[...s.guardrails],useAdvancedParams:s.useAdvancedParams},{applyToAll:!0,keysToApply:["temperature","maxTokens","tags","vectorStores","guardrails","useAdvancedParams"]}):a({applyAcrossModels:!1})},x=e=>{a({useAdvancedParams:e},s.applyAcrossModels?{applyToAll:!0,keysToApply:["useAdvancedParams"]}:void 0)},h=(e,t)=>{a({[e]:t},s.applyAcrossModels?{applyToAll:!0,keysToApply:[e]}:void 0)},p=s.useAdvancedParams?1:.4,v=s.useAdvancedParams?"text-gray-700":"text-gray-400",j=()=>{m(e=>!e)},y=(0,t.jsxs)("div",{className:"w-[300px] max-h-[65vh] overflow-y-auto relative",children:[(0,t.jsx)("button",{onClick:()=>{m(!1)},className:"absolute top-0 right-0 p-1 hover:bg-gray-100 rounded transition-colors text-gray-500 hover:text-gray-700 z-10",children:(0,t.jsx)(g.Z,{size:14})}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsx)(E.Z,{checked:s.applyAcrossModels,onChange:e=>u(e.target.checked),children:(0,t.jsx)("span",{className:"text-xs font-medium",children:"Sync Settings Across Models"})})}),(0,t.jsx)(M.Z,{className:"border-gray-200"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-xs font-semibold text-gray-700 mb-1.5 uppercase tracking-wide",children:"General Settings"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-600 block mb-0.5",children:"Tags"}),(0,t.jsx)(P.Z,{value:s.tags,onChange:e=>h("tags",e),accessToken:d})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-600 block mb-0.5",children:"Vector Stores"}),(0,t.jsx)(_.Z,{value:s.vectorStores,onChange:e=>h("vectorStores",e),accessToken:d})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-600 block mb-0.5",children:"Guardrails"}),(0,t.jsx)(L.Z,{value:s.guardrails,onChange:e=>h("guardrails",e),accessToken:d})]})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-xs font-semibold text-gray-700 mb-1.5 uppercase tracking-wide",children:"Advanced Settings"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("div",{className:"flex items-center gap-2 pb-1",children:(0,t.jsx)(E.Z,{checked:s.useAdvancedParams,onChange:e=>x(e.target.checked),children:(0,t.jsx)("span",{className:"text-sm font-medium",children:"Use Advanced Parameters"})})}),(0,t.jsxs)("div",{className:"space-y-2 transition-opacity duration-200",style:{opacity:p},children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium ".concat(v),children:"Temperature"}),(0,t.jsx)("span",{className:"text-xs ".concat(v),children:s.temperature.toFixed(2)})]}),(0,t.jsx)(I.Z,{min:0,max:2,step:.01,value:s.temperature,onChange:e=>{h("temperature",Math.min(2,Math.max(0,Number((Array.isArray(e)?e[0]:e).toFixed(2)))))},disabled:!s.useAdvancedParams})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium ".concat(v),children:"Max Tokens"}),(0,t.jsx)("span",{className:"text-xs ".concat(v),children:s.maxTokens})]}),(0,t.jsx)(I.Z,{min:1,max:32768,step:1,value:s.maxTokens,onChange:e=>{h("maxTokens",Math.min(32768,Math.max(1,Math.round(Array.isArray(e)?e[0]:e))))},disabled:!s.useAdvancedParams})]})]})]})]})]})]});return(0,t.jsxs)("div",{className:"bg-white first:border-l-0 border-l border-gray-200 flex flex-col min-h-0",children:[(0,t.jsxs)("div",{className:"border-b flex items-center justify-between gap-3 px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 flex-1",children:[(0,t.jsx)(Z,{value:s.model,models:i,loading:o,onChange:e=>a({model:e})}),(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsx)(O.Z,{content:y,trigger:[],open:c,onOpenChange:()=>{},placement:"bottomRight",destroyTooltipOnHide:!1,children:(0,t.jsx)("button",{onClick:e=>{e.stopPropagation(),j()},className:"p-2 rounded-lg transition-colors ".concat(c?"bg-gray-200 text-gray-700":"hover:bg-gray-100 text-gray-600"),children:(0,t.jsx)(f.Z,{size:18})})})})]}),l&&(0,t.jsx)("button",{onClick:e=>{e.stopPropagation(),n()},className:"p-2 hover:bg-red-50 text-red-600 rounded-lg transition-colors",children:(0,t.jsx)(g.Z,{size:18})})]}),(0,t.jsx)("div",{className:"relative flex-1 flex flex-col min-h-0",children:(0,t.jsx)("div",{className:"flex-1 max-h-[calc(100vh-385px)] overflow-auto rounded-b-2xl",children:(0,t.jsx)(C,{messages:s.messages,isLoading:s.isLoading})})})]})}var z=a(79276);let{TextArea:U}=o.default;function K(e){let{value:s,onChange:a,onSend:r,disabled:n}=e;return(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsxs)("div",{className:"flex items-center flex-1 bg-white border border-gray-300 rounded-xl px-3 py-1 min-h-[44px]",children:[(0,t.jsx)(U,{value:s,onChange:e=>a(e.target.value),onKeyDown:e=>{"Enter"===e.key&&!e.shiftKey&&(e.preventDefault(),!n&&s.trim()&&r())},placeholder:"Type your message... (Shift+Enter for new line)",disabled:n,className:"flex-1",autoSize:{minRows:1,maxRows:4},style:{resize:"none",border:"none",boxShadow:"none",background:"transparent",padding:"4px 0",fontSize:"14px",lineHeight:"20px"}}),(0,t.jsx)(c.ZP,{onClick:r,disabled:n||!s.trim(),icon:(0,t.jsx)(z.Z,{}),shape:"circle"})]})})}let B=["Can you summarize the key points?","What assumptions did you make?","What are the next steps?"],D=["Write me a poem","Explain quantum computing","Draft a polite email requesting a meeting"],F="/v1/chat/completions";function W(e){let{accessToken:s,disabledPersonalKeyCreation:a}=e,[n,g]=(0,r.useState)([{id:"1",model:"",messages:[],isLoading:!1,tags:[],mcpTools:[],vectorStores:[],guardrails:[],temperature:1,maxTokens:2048,applyAcrossModels:!1,useAdvancedParams:!1},{id:"2",model:"",messages:[],isLoading:!1,tags:[],mcpTools:[],vectorStores:[],guardrails:[],temperature:1,maxTokens:2048,applyAcrossModels:!1,useAdvancedParams:!1}]),[f,v]=(0,r.useState)([]),[j,y]=(0,r.useState)(!1),[b,N]=(0,r.useState)(""),[k,w]=(0,r.useState)(a?"custom":"session"),[A,S]=(0,r.useState)(""),[C,T]=(0,r.useState)("");(0,r.useEffect)(()=>{let e=setTimeout(()=>{T(A)},300);return()=>clearTimeout(e)},[A]);let Z=(0,r.useMemo)(()=>"session"===k?s||"":C.trim(),[k,s,C]),P=(0,r.useMemo)(()=>n.length>0&&n.every(e=>!e.isLoading&&e.messages.some(e=>"assistant"===e.role)),[n]);(0,r.useEffect)(()=>{let e=!0;return(async()=>{if(!Z){v([]);return}y(!0);try{let s=await (0,h.p)(Z);if(!e)return;let a=Array.from(new Set(s.map(e=>e.model_group)));v(a)}catch(s){console.error("CompareUI: failed to fetch models",s),e&&v([])}finally{e&&y(!1)}})(),()=>{e=!1}},[Z]),(0,r.useEffect)(()=>{0!==f.length&&g(e=>e.map((e,s)=>{var a,t,r,n,l;return{...e,temperature:null!==(a=e.temperature)&&void 0!==a?a:1,maxTokens:null!==(t=e.maxTokens)&&void 0!==t?t:2048,applyAcrossModels:null!==(r=e.applyAcrossModels)&&void 0!==r&&r,useAdvancedParams:null!==(n=e.useAdvancedParams)&&void 0!==n&&n,...e.model?{}:{model:null!==(l=f[s%f.length])&&void 0!==l?l:""}}}))},[f]);let _=e=>{n.length>1&&g(s=>s.filter(s=>s.id!==e))},L=(e,s,a)=>{g(t=>{var r;if((null==a?void 0:a.applyToAll)&&(null===(r=a.keysToApply)||void 0===r?void 0:r.length)){let r={};a.keysToApply.forEach(e=>{let a=s[e];void 0!==a&&(r[e]=Array.isArray(a)?[...a]:a)});let n=Object.keys(r).length>0;return t.map(a=>a.id===e?{...a,...s}:n?{...a,...r}:a)}return t.map(a=>a.id===e?{...a,...s}:a)})},E=(e,s,a)=>{s&&g(t=>t.map(t=>{if(t.id!==e)return t;let r=[...t.messages],n=r[r.length-1];if(n&&"assistant"===n.role){var l;let e="string"==typeof n.content?n.content:"";r[r.length-1]={...n,content:e+s,model:null!==(l=n.model)&&void 0!==l?l:a}}else r.push({role:"assistant",content:s,model:a});return{...t,messages:r}}))},M=(e,s)=>{s&&g(a=>a.map(a=>{if(a.id!==e)return a;let t=[...a.messages],r=t[t.length-1];return r&&"assistant"===r.role?t[t.length-1]={...r,reasoningContent:(r.reasoningContent||"")+s}:r&&"user"===r.role&&t.push({role:"assistant",content:"",reasoningContent:s}),{...a,messages:t}}))},I=(e,s)=>{g(a=>a.map(a=>{if(a.id!==e)return a;let t=[...a.messages],r=t[t.length-1];return r&&"assistant"===r.role?t[t.length-1]={...r,timeToFirstToken:s}:r&&"user"===r.role&&t.push({role:"assistant",content:"",timeToFirstToken:s}),{...a,messages:t}}))},O=(e,s)=>{g(a=>a.map(a=>{if(a.id!==e)return a;let t=[...a.messages],r=t[t.length-1];return r&&"assistant"===r.role?t[t.length-1]={...r,totalLatency:s}:r&&"user"===r.role&&t.push({role:"assistant",content:"",totalLatency:s}),{...a,messages:t}}))},z=(e,s,a)=>{g(t=>t.map(t=>{if(t.id!==e)return t;let r=[...t.messages],n=r[r.length-1];return n&&"assistant"===n.role&&(r[r.length-1]={...n,usage:s,toolName:a}),{...t,messages:r}}))},U=(e,s)=>{s&&g(a=>a.map(a=>{if(a.id!==e)return a;let t=[...a.messages],r=t[t.length-1];return r&&"assistant"===r.role&&(t[t.length-1]={...r,searchResults:s}),{...a,messages:t}}))},W=!!s,G=e=>{let s=e.trim();if(!s)return;if(!Z){x.Z.fromBackend("Please provide a Virtual Key or select Current UI Session");return}if(0===n.length)return;if(n.some(e=>!e.model)){x.Z.fromBackend("Select a model before sending a message.");return}let a=new Map;n.forEach(e=>{var t;let r=null!==(t=e.traceId)&&void 0!==t?t:(0,l.Z)();a.set(e.id,{id:e.id,model:e.model,traceId:r,tags:e.tags,vectorStores:e.vectorStores,guardrails:e.guardrails,temperature:e.temperature,maxTokens:e.maxTokens,messages:[...e.messages,{role:"user",content:s}]})}),0!==a.size&&(g(e=>e.map(e=>{let s=a.get(e.id);return s?{...e,traceId:s.traceId,messages:s.messages,isLoading:!0}:e})),a.forEach(e=>{var s;let a=e.messages.map(e=>{let{role:s,content:a}=e;return{role:s,content:"string"==typeof a?a:""}}),t=e.tags.length>0?e.tags:void 0,r=e.vectorStores.length>0?e.vectorStores:void 0,l=e.guardrails.length>0?e.guardrails:void 0,i=n.find(s=>s.id===e.id),o=null!==(s=null==i?void 0:i.useAdvancedParams)&&void 0!==s&&s;(0,p.n)(a,(s,a)=>E(e.id,s,a),e.model,Z,t,void 0,s=>M(e.id,s),s=>I(e.id,s),s=>z(e.id,s),e.traceId,r,l,void 0,void 0,s=>U(e.id,s),o?e.temperature:void 0,o?e.maxTokens:void 0,s=>O(e.id,s)).catch(s=>{let a=s instanceof Error?s.message:String(s);console.error("CompareUI: failed to fetch response",s),x.Z.fromBackend(a),g(s=>s.map(s=>{if(s.id!==e.id)return s;let t=[...s.messages],r=t[t.length-1],n=r&&"assistant"===r.role&&"string"==typeof r.content?r.content:"";return r&&"assistant"===r.role?t[t.length-1]={...r,content:n?"".concat(n,"\nError fetching response: ").concat(a):"Error fetching response: ".concat(a)}:t.push({role:"assistant",content:"Error fetching response: ".concat(a)}),{...s,messages:t}}))}).finally(()=>{g(s=>s.map(s=>s.id===e.id?{...s,isLoading:!1}:s))})}))},V=e=>{N(e)},X=n.some(e=>e.messages.length>0),Y=n.some(e=>e.isLoading);return(0,t.jsx)("div",{className:"w-full h-full p-4 bg-white",children:(0,t.jsxs)("div",{className:"rounded-2xl border border-gray-200 bg-white shadow-sm min-h-[calc(100vh-140px)] flex flex-col",children:[(0,t.jsx)("div",{className:"border-b px-4 py-2",children:(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-600",children:"Virtual Key Source"}),(0,t.jsxs)(i.default,{value:k,onChange:e=>w(e),disabled:a,className:"w-48",children:[(0,t.jsx)(i.default.Option,{value:"session",disabled:!W,children:"Current UI Session"}),(0,t.jsx)(i.default.Option,{value:"custom",children:"Virtual Key"})]}),"custom"===k&&(0,t.jsx)(o.default.Password,{value:A,onChange:e=>S(e.target.value),placeholder:"Enter Virtual Key",className:"w-56"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-600",children:"Endpoint"}),(0,t.jsx)(d.Z,{title:"Other endpoints will be available soon",children:(0,t.jsx)(i.default,{value:F,disabled:!0,className:"w-56",children:(0,t.jsx)(i.default.Option,{value:F,children:F})})})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)(c.ZP,{onClick:()=>{g(e=>e.map(e=>({...e,messages:[],traceId:void 0,isLoading:!1}))),N("")},disabled:!X,icon:(0,t.jsx)(m.Z,{}),children:"Clear All Chats"}),(0,t.jsx)(d.Z,{title:n.length>=3?"Compare up to 3 models at a time":"Add another comparison",children:(0,t.jsx)(c.ZP,{onClick:()=>{var e;if(n.length>=3)return;let s=null!==(e=f[n.length%(f.length||1)])&&void 0!==e?e:"",a={id:Date.now().toString(),model:s,messages:[],isLoading:!1,tags:[],mcpTools:[],vectorStores:[],guardrails:[],temperature:1,maxTokens:2048,applyAcrossModels:!1,useAdvancedParams:!1};g(e=>[...e,a])},disabled:n.length>=3,icon:(0,t.jsx)(u.Z,{}),children:"Add Comparison"})})]})]})}),(0,t.jsx)("div",{className:"grid flex-1 min-h-0 auto-rows-[minmax(0,1fr)]",style:{gridTemplateColumns:"repeat(".concat(n.length,", minmax(0, 1fr))")},children:n.map(e=>(0,t.jsx)(R,{comparison:e,onUpdate:(s,a)=>L(e.id,s,a),onRemove:()=>_(e.id),canRemove:n.length>1,modelOptions:f,isLoadingModels:j,apiKey:Z},e.id))}),(0,t.jsx)("div",{className:"flex justify-center pb-4",children:(0,t.jsx)("div",{className:"w-full max-w-3xl px-4",children:(0,t.jsxs)("div",{className:"border border-gray-200 shadow-lg rounded-xl bg-white p-4",children:[(0,t.jsx)("div",{className:"flex items-center justify-between gap-4 mb-3 min-h-8",children:X||Y?P?(0,t.jsx)("div",{className:"flex items-center gap-2 overflow-x-auto",children:B.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>V(e),className:"shrink-0 rounded-full border border-gray-200 px-3 py-1 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-100 cursor-pointer",children:e},e))}):Y?(0,t.jsxs)("span",{className:"flex items-center gap-2 text-sm text-gray-500",children:[(0,t.jsx)("span",{className:"h-2 w-2 rounded-full bg-blue-500 animate-pulse","aria-hidden":!0}),"Gathering responses from all models..."]}):(0,t.jsx)("span",{className:"text-sm text-gray-500",children:"Send a prompt to compare models"}):(0,t.jsx)("div",{className:"flex items-center gap-2 overflow-x-auto",children:D.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>V(e),className:"shrink-0 rounded-full border border-gray-200 px-3 py-1 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-100 cursor-pointer",children:e},e))})}),(0,t.jsx)(K,{value:b,onChange:e=>{N(e)},onSend:()=>{G(b),N("")},disabled:0===n.length||n.every(e=>e.isLoading)})]})})})]})})}var G=a(58643),V=a(39760),X=a(91624);function Y(){let{accessToken:e,userRole:s,userId:a,disabledPersonalKeyCreation:l,token:i}=(0,V.Z)(),[o,d]=(0,r.useState)(void 0);return(0,r.useEffect)(()=>{(async()=>{if(e){let s=await (0,X.C)(e);s&&d({PROXY_BASE_URL:s.PROXY_BASE_URL,LITELLM_UI_API_DOC_BASE_URL:s.LITELLM_UI_API_DOC_BASE_URL})}})()},[e]),(0,t.jsxs)(G.v0,{className:"h-full w-full",children:[(0,t.jsxs)(G.td,{className:"mb-0",children:[(0,t.jsx)(G.OK,{children:"Chat"}),(0,t.jsx)(G.OK,{children:"Compare"})]}),(0,t.jsxs)(G.nP,{className:"h-full",children:[(0,t.jsx)(G.x4,{className:"h-full",children:(0,t.jsx)(n.Z,{accessToken:e,token:i,userRole:s,userID:a,disabledPersonalKeyCreation:l,proxySettings:o})}),(0,t.jsx)(G.x4,{className:"h-full",children:(0,t.jsx)(W,{accessToken:e,disabledPersonalKeyCreation:l})})]})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1529-59ce29afdf8ccc9b.js b/litellm/proxy/_experimental/out/_next/static/chunks/1529-59ce29afdf8ccc9b.js deleted file mode 100644 index c98ed86dee5..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1529-59ce29afdf8ccc9b.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1529],{60440:function(e,n,t){t.d(n,{Z:function(){return a}});var r=t(1119),o=t(2265),i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M176 511a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"ellipsis",theme:"outlined"},l=t(55015),a=o.forwardRef(function(e,n){return o.createElement(l.Z,(0,r.Z)({},e,{ref:n,icon:i}))})},77565:function(e,n,t){t.d(n,{Z:function(){return a}});var r=t(1119),o=t(2265),i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z"}}]},name:"right",theme:"outlined"},l=t(55015),a=o.forwardRef(function(e,n){return o.createElement(l.Z,(0,r.Z)({},e,{ref:n,icon:i}))})},71030:function(e,n,t){t.d(n,{Z:function(){return C}});var r=t(1119),o=t(11993),i=t(26365),l=t(6989),a=t(97821),u=t(36760),c=t.n(u),s=t(28791),f=t(2265),d=t(95814),p=t(53346),v=d.Z.ESC,m=d.Z.TAB,b=(0,f.forwardRef)(function(e,n){var t=e.overlay,r=e.arrow,o=e.prefixCls,i=(0,f.useMemo)(function(){return"function"==typeof t?t():t},[t]),l=(0,s.sQ)(n,(0,s.C4)(i));return f.createElement(f.Fragment,null,r&&f.createElement("div",{className:"".concat(o,"-arrow")}),f.cloneElement(i,{ref:(0,s.Yr)(i)?l:void 0}))}),y={adjustX:1,adjustY:1},h=[0,0],g={topLeft:{points:["bl","tl"],overflow:y,offset:[0,-4],targetOffset:h},top:{points:["bc","tc"],overflow:y,offset:[0,-4],targetOffset:h},topRight:{points:["br","tr"],overflow:y,offset:[0,-4],targetOffset:h},bottomLeft:{points:["tl","bl"],overflow:y,offset:[0,4],targetOffset:h},bottom:{points:["tc","bc"],overflow:y,offset:[0,4],targetOffset:h},bottomRight:{points:["tr","br"],overflow:y,offset:[0,4],targetOffset:h}},Z=["arrow","prefixCls","transitionName","animation","align","placement","placements","getPopupContainer","showAction","hideAction","overlayClassName","overlayStyle","visible","trigger","autoFocus","overlay","children","onVisibleChange"],C=f.forwardRef(function(e,n){var t,u,d,y,h,C,E,w,k,M,R,x,N,P,S=e.arrow,I=void 0!==S&&S,K=e.prefixCls,A=void 0===K?"rc-dropdown":K,O=e.transitionName,T=e.animation,L=e.align,D=e.placement,_=e.placements,V=e.getPopupContainer,z=e.showAction,F=e.hideAction,j=e.overlayClassName,B=e.overlayStyle,W=e.visible,H=e.trigger,Y=void 0===H?["hover"]:H,q=e.autoFocus,X=e.overlay,G=e.children,Q=e.onVisibleChange,U=(0,l.Z)(e,Z),J=f.useState(),$=(0,i.Z)(J,2),ee=$[0],en=$[1],et="visible"in e?W:ee,er=f.useRef(null),eo=f.useRef(null),ei=f.useRef(null);f.useImperativeHandle(n,function(){return er.current});var el=function(e){en(e),null==Q||Q(e)};u=(t={visible:et,triggerRef:ei,onVisibleChange:el,autoFocus:q,overlayRef:eo}).visible,d=t.triggerRef,y=t.onVisibleChange,h=t.autoFocus,C=t.overlayRef,E=f.useRef(!1),w=function(){if(u){var e,n;null===(e=d.current)||void 0===e||null===(n=e.focus)||void 0===n||n.call(e),null==y||y(!1)}},k=function(){var e;return null!==(e=C.current)&&void 0!==e&&!!e.focus&&(C.current.focus(),E.current=!0,!0)},M=function(e){switch(e.keyCode){case v:w();break;case m:var n=!1;E.current||(n=k()),n?e.preventDefault():w()}},f.useEffect(function(){return u?(window.addEventListener("keydown",M),h&&(0,p.Z)(k,3),function(){window.removeEventListener("keydown",M),E.current=!1}):function(){E.current=!1}},[u]);var ea=function(){return f.createElement(b,{ref:eo,overlay:X,prefixCls:A,arrow:I})},eu=f.cloneElement(G,{className:c()(null===(P=G.props)||void 0===P?void 0:P.className,et&&(void 0!==(R=e.openClassName)?R:"".concat(A,"-open"))),ref:(0,s.Yr)(G)?(0,s.sQ)(ei,(0,s.C4)(G)):void 0}),ec=F;return ec||-1===Y.indexOf("contextMenu")||(ec=["click"]),f.createElement(a.Z,(0,r.Z)({builtinPlacements:void 0===_?g:_},U,{prefixCls:A,ref:er,popupClassName:c()(j,(0,o.Z)({},"".concat(A,"-show-arrow"),I)),popupStyle:B,action:Y,showAction:z,hideAction:ec,popupPlacement:void 0===D?"bottomLeft":D,popupAlign:L,popupTransitionName:O,popupAnimation:T,popupVisible:et,stretch:(x=e.minOverlayWidthMatchTrigger,N=e.alignPoint,"minOverlayWidthMatchTrigger"in e?x:!N)?"minWidth":"",popup:"function"==typeof X?ea:ea(),onPopupVisibleChange:el,onPopupClick:function(n){var t=e.onOverlayClick;en(!1),t&&t(n)},getPopupContainer:V}),eu)})},33082:function(e,n,t){t.d(n,{iz:function(){return eA},ck:function(){return ev},BW:function(){return eL},sN:function(){return ev},Wd:function(){return eI},ZP:function(){return ej},Xl:function(){return x}});var r=t(1119),o=t(11993),i=t(31686),l=t(83145),a=t(26365),u=t(6989),c=t(36760),s=t.n(c),f=t(1699),d=t(50506),p=t(16671),v=t(32559),m=t(2265),b=t(54887),y=m.createContext(null);function h(e,n){return void 0===e?null:"".concat(e,"-").concat(n)}function g(e){return h(m.useContext(y),e)}var Z=t(6397),C=["children","locked"],E=m.createContext(null);function w(e){var n=e.children,t=e.locked,r=(0,u.Z)(e,C),o=m.useContext(E),l=(0,Z.Z)(function(){var e;return e=(0,i.Z)({},o),Object.keys(r).forEach(function(n){var t=r[n];void 0!==t&&(e[n]=t)}),e},[o,r],function(e,n){return!t&&(e[0]!==n[0]||!(0,p.Z)(e[1],n[1],!0))});return m.createElement(E.Provider,{value:l},n)}var k=m.createContext(null);function M(){return m.useContext(k)}var R=m.createContext([]);function x(e){var n=m.useContext(R);return m.useMemo(function(){return void 0!==e?[].concat((0,l.Z)(n),[e]):n},[n,e])}var N=m.createContext(null),P=m.createContext({}),S=t(2857);function I(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if((0,S.Z)(e)){var t=e.nodeName.toLowerCase(),r=["input","select","textarea","button"].includes(t)||e.isContentEditable||"a"===t&&!!e.getAttribute("href"),o=e.getAttribute("tabindex"),i=Number(o),l=null;return o&&!Number.isNaN(i)?l=i:r&&null===l&&(l=0),r&&e.disabled&&(l=null),null!==l&&(l>=0||n&&l<0)}return!1}var K=t(95814),A=t(53346),O=K.Z.LEFT,T=K.Z.RIGHT,L=K.Z.UP,D=K.Z.DOWN,_=K.Z.ENTER,V=K.Z.ESC,z=K.Z.HOME,F=K.Z.END,j=[L,D,O,T];function B(e,n){return(function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t=(0,l.Z)(e.querySelectorAll("*")).filter(function(e){return I(e,n)});return I(e,n)&&t.unshift(e),t})(e,!0).filter(function(e){return n.has(e)})}function W(e,n,t){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;if(!e)return null;var o=B(e,n),i=o.length,l=o.findIndex(function(e){return t===e});return r<0?-1===l?l=i-1:l-=1:r>0&&(l+=1),o[l=(l+i)%i]}var H=function(e,n){var t=new Set,r=new Map,o=new Map;return e.forEach(function(e){var i=document.querySelector("[data-menu-id='".concat(h(n,e),"']"));i&&(t.add(i),o.set(i,e),r.set(e,i))}),{elements:t,key2element:r,element2key:o}},Y="__RC_UTIL_PATH_SPLIT__",q=function(e){return e.join(Y)},X="rc-menu-more";function G(e){var n=m.useRef(e);n.current=e;var t=m.useCallback(function(){for(var e,t=arguments.length,r=Array(t),o=0;o1&&(k.motionAppear=!1);var M=k.onVisibleChanged;return(k.onVisibleChanged=function(e){return b.current||e||Z(!0),null==M?void 0:M(e)},g)?null:m.createElement(w,{mode:u,locked:!b.current},m.createElement(eR.ZP,(0,r.Z)({visible:C},k,{forceRender:f,removeOnLeave:!1,leavedClassName:"".concat(s,"-hidden")}),function(e){var t=e.className,r=e.style;return m.createElement(eb,{id:n,className:t,style:r},l)}))}var eN=["style","className","title","eventKey","warnKey","disabled","internalPopupClose","children","itemIcon","expandIcon","popupClassName","popupOffset","popupStyle","onClick","onMouseEnter","onMouseLeave","onTitleClick","onTitleMouseEnter","onTitleMouseLeave"],eP=["active"],eS=m.forwardRef(function(e,n){var t=e.style,l=e.className,c=e.title,d=e.eventKey,p=(e.warnKey,e.disabled),v=e.internalPopupClose,b=e.children,y=e.itemIcon,h=e.expandIcon,Z=e.popupClassName,C=e.popupOffset,k=e.popupStyle,M=e.onClick,R=e.onMouseEnter,S=e.onMouseLeave,I=e.onTitleClick,K=e.onTitleMouseEnter,A=e.onTitleMouseLeave,O=(0,u.Z)(e,eN),T=g(d),L=m.useContext(E),D=L.prefixCls,_=L.mode,V=L.openKeys,z=L.disabled,F=L.overflowDisabled,j=L.activeKey,B=L.selectedKeys,W=L.itemIcon,H=L.expandIcon,Y=L.onItemClick,q=L.onOpenChange,X=L.onActive,Q=m.useContext(P)._internalRenderSubMenuItem,U=m.useContext(N).isSubPathKey,J=x(),$="".concat(D,"-submenu"),ee=z||p,en=m.useRef(),et=m.useRef(),er=null!=h?h:H,ea=V.includes(d),ec=!F&&ea,es=U(B,d),ef=eo(d,ee,K,A),ed=ef.active,ep=(0,u.Z)(ef,eP),ev=m.useState(!1),em=(0,a.Z)(ev,2),ey=em[0],eh=em[1],eg=function(e){ee||eh(e)},eZ=m.useMemo(function(){return ed||"inline"!==_&&(ey||U([j],d))},[_,ed,j,ey,d,U]),eC=ei(J.length),eE=G(function(e){null==M||M(eu(e)),Y(e)}),ew=T&&"".concat(T,"-popup"),ek=m.useMemo(function(){return m.createElement(el,{icon:"horizontal"!==_?er:void 0,props:(0,i.Z)((0,i.Z)({},e),{},{isOpen:ec,isSubMenu:!0})},m.createElement("i",{className:"".concat($,"-arrow")}))},[_,er,e,ec,$]),eR=m.createElement("div",(0,r.Z)({role:"menuitem",style:eC,className:"".concat($,"-title"),tabIndex:ee?null:-1,ref:en,title:"string"==typeof c?c:null,"data-menu-id":F&&T?null:T,"aria-expanded":ec,"aria-haspopup":!0,"aria-controls":ew,"aria-disabled":ee,onClick:function(e){ee||(null==I||I({key:d,domEvent:e}),"inline"===_&&q(d,!ea))},onFocus:function(){X(d)}},ep),c,ek),eS=m.useRef(_);if("inline"!==_&&J.length>1?eS.current="vertical":eS.current=_,!F){var eI=eS.current;eR=m.createElement(eM,{mode:eI,prefixCls:$,visible:!v&&ec&&"inline"!==_,popupClassName:Z,popupOffset:C,popupStyle:k,popup:m.createElement(w,{mode:"horizontal"===eI?"vertical":eI},m.createElement(eb,{id:ew,ref:et},b)),disabled:ee,onVisibleChange:function(e){"inline"!==_&&q(d,e)}},eR)}var eK=m.createElement(f.Z.Item,(0,r.Z)({ref:n,role:"none"},O,{component:"li",style:t,className:s()($,"".concat($,"-").concat(_),l,(0,o.Z)((0,o.Z)((0,o.Z)((0,o.Z)({},"".concat($,"-open"),ec),"".concat($,"-active"),eZ),"".concat($,"-selected"),es),"".concat($,"-disabled"),ee)),onMouseEnter:function(e){eg(!0),null==R||R({key:d,domEvent:e})},onMouseLeave:function(e){eg(!1),null==S||S({key:d,domEvent:e})}}),eR,!F&&m.createElement(ex,{id:ew,open:ec,keyPath:J},b));return Q&&(eK=Q(eK,e,{selected:es,active:eZ,open:ec,disabled:ee})),m.createElement(w,{onItemClick:eE,mode:"horizontal"===_?"vertical":_,itemIcon:null!=y?y:W,expandIcon:er},eK)}),eI=m.forwardRef(function(e,n){var t,o=e.eventKey,i=e.children,l=x(o),a=eh(i,l),u=M();return m.useEffect(function(){if(u)return u.registerPath(o,l),function(){u.unregisterPath(o,l)}},[l]),t=u?a:m.createElement(eS,(0,r.Z)({ref:n},e),a),m.createElement(R.Provider,{value:l},t)}),eK=t(41154);function eA(e){var n=e.className,t=e.style,r=m.useContext(E).prefixCls;return M()?null:m.createElement("li",{role:"separator",className:s()("".concat(r,"-item-divider"),n),style:t})}var eO=["className","title","eventKey","children"],eT=m.forwardRef(function(e,n){var t=e.className,o=e.title,i=(e.eventKey,e.children),l=(0,u.Z)(e,eO),a=m.useContext(E).prefixCls,c="".concat(a,"-item-group");return m.createElement("li",(0,r.Z)({ref:n,role:"presentation"},l,{onClick:function(e){return e.stopPropagation()},className:s()(c,t)}),m.createElement("div",{role:"presentation",className:"".concat(c,"-title"),title:"string"==typeof o?o:void 0},o),m.createElement("ul",{role:"group",className:"".concat(c,"-list")},i))}),eL=m.forwardRef(function(e,n){var t=e.eventKey,o=eh(e.children,x(t));return M()?o:m.createElement(eT,(0,r.Z)({ref:n},(0,et.Z)(e,["warnKey"])),o)}),eD=["label","children","key","type","extra"];function e_(e,n,t,o,l){var a=e,c=(0,i.Z)({divider:eA,item:ev,group:eL,submenu:eI},o);return n&&(a=function e(n,t,o){var i=t.item,l=t.group,a=t.submenu,c=t.divider;return(n||[]).map(function(n,s){if(n&&"object"===(0,eK.Z)(n)){var f=n.label,d=n.children,p=n.key,v=n.type,b=n.extra,y=(0,u.Z)(n,eD),h=null!=p?p:"tmp-".concat(s);return d||"group"===v?"group"===v?m.createElement(l,(0,r.Z)({key:h},y,{title:f}),e(d,t,o)):m.createElement(a,(0,r.Z)({key:h},y,{title:f}),e(d,t,o)):"divider"===v?m.createElement(c,(0,r.Z)({key:h},y)):m.createElement(i,(0,r.Z)({key:h},y,{extra:b}),f,(!!b||0===b)&&m.createElement("span",{className:"".concat(o,"-item-extra")},b))}return null}).filter(function(e){return e})}(n,c,l)),eh(a,t)}var eV=["prefixCls","rootClassName","style","className","tabIndex","items","children","direction","id","mode","inlineCollapsed","disabled","disabledOverflow","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","defaultOpenKeys","openKeys","activeKey","defaultActiveFirst","selectable","multiple","defaultSelectedKeys","selectedKeys","onSelect","onDeselect","inlineIndent","motion","defaultMotions","triggerSubMenuAction","builtinPlacements","itemIcon","expandIcon","overflowedIndicator","overflowedIndicatorPopupClassName","getPopupContainer","onClick","onOpenChange","onKeyDown","openAnimation","openTransitionName","_internalRenderMenuItem","_internalRenderSubMenuItem","_internalComponents"],ez=[],eF=m.forwardRef(function(e,n){var t,c,v,h,g,Z,C,E,M,R,x,S,I,K,J,$,ee,en,et,er,eo,ei,el,ea,ec,es,ef=e.prefixCls,ed=void 0===ef?"rc-menu":ef,ep=e.rootClassName,em=e.style,eb=e.className,ey=e.tabIndex,eh=e.items,eg=e.children,eZ=e.direction,eC=e.id,eE=e.mode,ew=void 0===eE?"vertical":eE,ek=e.inlineCollapsed,eM=e.disabled,eR=e.disabledOverflow,ex=e.subMenuOpenDelay,eN=e.subMenuCloseDelay,eP=e.forceSubMenuRender,eS=e.defaultOpenKeys,eK=e.openKeys,eA=e.activeKey,eO=e.defaultActiveFirst,eT=e.selectable,eL=void 0===eT||eT,eD=e.multiple,eF=void 0!==eD&&eD,ej=e.defaultSelectedKeys,eB=e.selectedKeys,eW=e.onSelect,eH=e.onDeselect,eY=e.inlineIndent,eq=e.motion,eX=e.defaultMotions,eG=e.triggerSubMenuAction,eQ=e.builtinPlacements,eU=e.itemIcon,eJ=e.expandIcon,e$=e.overflowedIndicator,e0=void 0===e$?"...":e$,e1=e.overflowedIndicatorPopupClassName,e6=e.getPopupContainer,e2=e.onClick,e5=e.onOpenChange,e9=e.onKeyDown,e3=(e.openAnimation,e.openTransitionName,e._internalRenderMenuItem),e4=e._internalRenderSubMenuItem,e7=e._internalComponents,e8=(0,u.Z)(e,eV),ne=m.useMemo(function(){return[e_(eg,eh,ez,e7,ed),e_(eg,eh,ez,{},ed)]},[eg,eh,e7]),nn=(0,a.Z)(ne,2),nt=nn[0],nr=nn[1],no=m.useState(!1),ni=(0,a.Z)(no,2),nl=ni[0],na=ni[1],nu=m.useRef(),nc=(t=(0,d.Z)(eC,{value:eC}),v=(c=(0,a.Z)(t,2))[0],h=c[1],m.useEffect(function(){U+=1;var e="".concat(Q,"-").concat(U);h("rc-menu-uuid-".concat(e))},[]),v),ns="rtl"===eZ,nf=(0,d.Z)(eS,{value:eK,postState:function(e){return e||ez}}),nd=(0,a.Z)(nf,2),np=nd[0],nv=nd[1],nm=function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];function t(){nv(e),null==e5||e5(e)}n?(0,b.flushSync)(t):t()},nb=m.useState(np),ny=(0,a.Z)(nb,2),nh=ny[0],ng=ny[1],nZ=m.useRef(!1),nC=m.useMemo(function(){return("inline"===ew||"vertical"===ew)&&ek?["vertical",ek]:[ew,!1]},[ew,ek]),nE=(0,a.Z)(nC,2),nw=nE[0],nk=nE[1],nM="inline"===nw,nR=m.useState(nw),nx=(0,a.Z)(nR,2),nN=nx[0],nP=nx[1],nS=m.useState(nk),nI=(0,a.Z)(nS,2),nK=nI[0],nA=nI[1];m.useEffect(function(){nP(nw),nA(nk),nZ.current&&(nM?nv(nh):nm(ez))},[nw,nk]);var nO=m.useState(0),nT=(0,a.Z)(nO,2),nL=nT[0],nD=nT[1],n_=nL>=nt.length-1||"horizontal"!==nN||eR;m.useEffect(function(){nM&&ng(np)},[np]),m.useEffect(function(){return nZ.current=!0,function(){nZ.current=!1}},[]);var nV=(g=m.useState({}),Z=(0,a.Z)(g,2)[1],C=(0,m.useRef)(new Map),E=(0,m.useRef)(new Map),M=m.useState([]),x=(R=(0,a.Z)(M,2))[0],S=R[1],I=(0,m.useRef)(0),K=(0,m.useRef)(!1),J=function(){K.current||Z({})},$=(0,m.useCallback)(function(e,n){var t,r=q(n);E.current.set(r,e),C.current.set(e,r),I.current+=1;var o=I.current;t=function(){o===I.current&&J()},Promise.resolve().then(t)},[]),ee=(0,m.useCallback)(function(e,n){var t=q(n);E.current.delete(t),C.current.delete(e)},[]),en=(0,m.useCallback)(function(e){S(e)},[]),et=(0,m.useCallback)(function(e,n){var t=(C.current.get(e)||"").split(Y);return n&&x.includes(t[0])&&t.unshift(X),t},[x]),er=(0,m.useCallback)(function(e,n){return e.filter(function(e){return void 0!==e}).some(function(e){return et(e,!0).includes(n)})},[et]),eo=(0,m.useCallback)(function(e){var n="".concat(C.current.get(e)).concat(Y),t=new Set;return(0,l.Z)(E.current.keys()).forEach(function(e){e.startsWith(n)&&t.add(E.current.get(e))}),t},[]),m.useEffect(function(){return function(){K.current=!0}},[]),{registerPath:$,unregisterPath:ee,refreshOverflowKeys:en,isSubPathKey:er,getKeyPath:et,getKeys:function(){var e=(0,l.Z)(C.current.keys());return x.length&&e.push(X),e},getSubPathKeys:eo}),nz=nV.registerPath,nF=nV.unregisterPath,nj=nV.refreshOverflowKeys,nB=nV.isSubPathKey,nW=nV.getKeyPath,nH=nV.getKeys,nY=nV.getSubPathKeys,nq=m.useMemo(function(){return{registerPath:nz,unregisterPath:nF}},[nz,nF]),nX=m.useMemo(function(){return{isSubPathKey:nB}},[nB]);m.useEffect(function(){nj(n_?ez:nt.slice(nL+1).map(function(e){return e.key}))},[nL,n_]);var nG=(0,d.Z)(eA||eO&&(null===(es=nt[0])||void 0===es?void 0:es.key),{value:eA}),nQ=(0,a.Z)(nG,2),nU=nQ[0],nJ=nQ[1],n$=G(function(e){nJ(e)}),n0=G(function(){nJ(void 0)});(0,m.useImperativeHandle)(n,function(){return{list:nu.current,focus:function(e){var n,t,r=H(nH(),nc),o=r.elements,i=r.key2element,l=r.element2key,a=B(nu.current,o),u=null!=nU?nU:a[0]?l.get(a[0]):null===(n=nt.find(function(e){return!e.props.disabled}))||void 0===n?void 0:n.key,c=i.get(u);u&&c&&(null==c||null===(t=c.focus)||void 0===t||t.call(c,e))}}});var n1=(0,d.Z)(ej||[],{value:eB,postState:function(e){return Array.isArray(e)?e:null==e?ez:[e]}}),n6=(0,a.Z)(n1,2),n2=n6[0],n5=n6[1],n9=function(e){if(eL){var n,t=e.key,r=n2.includes(t);n5(n=eF?r?n2.filter(function(e){return e!==t}):[].concat((0,l.Z)(n2),[t]):[t]);var o=(0,i.Z)((0,i.Z)({},e),{},{selectedKeys:n});r?null==eH||eH(o):null==eW||eW(o)}!eF&&np.length&&"inline"!==nN&&nm(ez)},n3=G(function(e){null==e2||e2(eu(e)),n9(e)}),n4=G(function(e,n){var t=np.filter(function(n){return n!==e});if(n)t.push(e);else if("inline"!==nN){var r=nY(e);t=t.filter(function(e){return!r.has(e)})}(0,p.Z)(np,t,!0)||nm(t,!0)}),n7=(ei=function(e,n){var t=null!=n?n:!np.includes(e);n4(e,t)},el=m.useRef(),(ea=m.useRef()).current=nU,ec=function(){A.Z.cancel(el.current)},m.useEffect(function(){return function(){ec()}},[]),function(e){var n=e.which;if([].concat(j,[_,V,z,F]).includes(n)){var t=nH(),r=H(t,nc),i=r,l=i.elements,a=i.key2element,u=i.element2key,c=function(e,n){for(var t=e||document.activeElement;t;){if(n.has(t))return t;t=t.parentElement}return null}(a.get(nU),l),s=u.get(c),f=function(e,n,t,r){var i,l="prev",a="next",u="children",c="parent";if("inline"===e&&r===_)return{inlineTrigger:!0};var s=(0,o.Z)((0,o.Z)({},L,l),D,a),f=(0,o.Z)((0,o.Z)((0,o.Z)((0,o.Z)({},O,t?a:l),T,t?l:a),D,u),_,u),d=(0,o.Z)((0,o.Z)((0,o.Z)((0,o.Z)((0,o.Z)((0,o.Z)({},L,l),D,a),_,u),V,c),O,t?u:c),T,t?c:u);switch(null===(i=({inline:s,horizontal:f,vertical:d,inlineSub:s,horizontalSub:d,verticalSub:d})["".concat(e).concat(n?"":"Sub")])||void 0===i?void 0:i[r]){case l:return{offset:-1,sibling:!0};case a:return{offset:1,sibling:!0};case c:return{offset:-1,sibling:!1};case u:return{offset:1,sibling:!1};default:return null}}(nN,1===nW(s,!0).length,ns,n);if(!f&&n!==z&&n!==F)return;(j.includes(n)||[z,F].includes(n))&&e.preventDefault();var d=function(e){if(e){var n=e,t=e.querySelector("a");null!=t&&t.getAttribute("href")&&(n=t);var r=u.get(e);nJ(r),ec(),el.current=(0,A.Z)(function(){ea.current===r&&n.focus()})}};if([z,F].includes(n)||f.sibling||!c){var p,v=B(p=c&&"inline"!==nN?function(e){for(var n=e;n;){if(n.getAttribute("data-menu-list"))return n;n=n.parentElement}return null}(c):nu.current,l);d(n===z?v[0]:n===F?v[v.length-1]:W(p,l,c,f.offset))}else if(f.inlineTrigger)ei(s);else if(f.offset>0)ei(s,!0),ec(),el.current=(0,A.Z)(function(){r=H(t,nc);var e=c.getAttribute("aria-controls");d(W(document.getElementById(e),r.elements))},5);else if(f.offset<0){var m=nW(s,!0),b=m[m.length-2],y=a.get(b);ei(b,!1),d(y)}}null==e9||e9(e)});m.useEffect(function(){na(!0)},[]);var n8=m.useMemo(function(){return{_internalRenderMenuItem:e3,_internalRenderSubMenuItem:e4}},[e3,e4]),te="horizontal"!==nN||eR?nt:nt.map(function(e,n){return m.createElement(w,{key:e.key,overflowDisabled:n>nL},e)}),tn=m.createElement(f.Z,(0,r.Z)({id:eC,ref:nu,prefixCls:"".concat(ed,"-overflow"),component:"ul",itemComponent:ev,className:s()(ed,"".concat(ed,"-root"),"".concat(ed,"-").concat(nN),eb,(0,o.Z)((0,o.Z)({},"".concat(ed,"-inline-collapsed"),nK),"".concat(ed,"-rtl"),ns),ep),dir:eZ,style:em,role:"menu",tabIndex:void 0===ey?0:ey,data:te,renderRawItem:function(e){return e},renderRawRest:function(e){var n=e.length,t=n?nt.slice(-n):null;return m.createElement(eI,{eventKey:X,title:e0,disabled:n_,internalPopupClose:0===n,popupClassName:e1},t)},maxCount:"horizontal"!==nN||eR?f.Z.INVALIDATE:f.Z.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:function(e){nD(e)},onKeyDown:n7},e8));return m.createElement(P.Provider,{value:n8},m.createElement(y.Provider,{value:nc},m.createElement(w,{prefixCls:ed,rootClassName:ep,mode:nN,openKeys:np,rtl:ns,disabled:eM,motion:nl?eq:null,defaultMotions:nl?eX:null,activeKey:nU,onActive:n$,onInactive:n0,selectedKeys:n2,inlineIndent:void 0===eY?24:eY,subMenuOpenDelay:void 0===ex?.1:ex,subMenuCloseDelay:void 0===eN?.1:eN,forceSubMenuRender:eP,builtinPlacements:eQ,triggerSubMenuAction:void 0===eG?"hover":eG,getPopupContainer:e6,itemIcon:eU,expandIcon:eJ,onItemClick:n3,onOpenChange:n4},m.createElement(N.Provider,{value:nX},tn),m.createElement("div",{style:{display:"none"},"aria-hidden":!0},m.createElement(k.Provider,{value:nq},nr)))))});eF.Item=ev,eF.SubMenu=eI,eF.ItemGroup=eL,eF.Divider=eA;var ej=eF}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1602-dda1d35341543457.js b/litellm/proxy/_experimental/out/_next/static/chunks/1602-158ea5a27f7c5d7c.js similarity index 100% rename from litellm/proxy/_experimental/out/_next/static/chunks/1602-dda1d35341543457.js rename to litellm/proxy/_experimental/out/_next/static/chunks/1602-158ea5a27f7c5d7c.js diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1623-995fddc2b5647961.js b/litellm/proxy/_experimental/out/_next/static/chunks/1623-995fddc2b5647961.js deleted file mode 100644 index 15400abe793..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1623-995fddc2b5647961.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1623],{2894:function(t,e,s){s.d(e,{R:function(){return u},m:function(){return n}});var i=s(18238),a=s(7989),r=s(11255),n=class extends a.F{#t;#e;#s;#i;constructor(t){super(),this.#t=t.client,this.mutationId=t.mutationId,this.#s=t.mutationCache,this.#e=[],this.state=t.state||u(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#e.includes(t)||(this.#e.push(t),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#e=this.#e.filter(e=>e!==t),this.scheduleGc(),this.#s.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#e.length||("pending"===this.state.status?this.scheduleGc():this.#s.remove(this))}continue(){return this.#i?.continue()??this.execute(this.state.variables)}async execute(t){let e=()=>{this.#a({type:"continue"})},s={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#i=(0,r.Mz)({fn:()=>this.options.mutationFn?this.options.mutationFn(t,s):Promise.reject(Error("No mutationFn found")),onFail:(t,e)=>{this.#a({type:"failed",failureCount:t,error:e})},onPause:()=>{this.#a({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#s.canRun(this)});let i="pending"===this.state.status,a=!this.#i.canStart();try{if(i)e();else{this.#a({type:"pending",variables:t,isPaused:a}),await this.#s.config.onMutate?.(t,this,s);let e=await this.options.onMutate?.(t,s);e!==this.state.context&&this.#a({type:"pending",context:e,variables:t,isPaused:a})}let r=await this.#i.start();return await this.#s.config.onSuccess?.(r,t,this.state.context,this,s),await this.options.onSuccess?.(r,t,this.state.context,s),await this.#s.config.onSettled?.(r,null,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(r,null,t,this.state.context,s),this.#a({type:"success",data:r}),r}catch(e){try{throw await this.#s.config.onError?.(e,t,this.state.context,this,s),await this.options.onError?.(e,t,this.state.context,s),await this.#s.config.onSettled?.(void 0,e,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(void 0,e,t,this.state.context,s),e}finally{this.#a({type:"error",error:e})}}finally{this.#s.runNext(this)}}#a(t){this.state=(e=>{switch(t.type){case"failed":return{...e,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...e,isPaused:!0};case"continue":return{...e,isPaused:!1};case"pending":return{...e,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...e,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...e,data:void 0,error:t.error,failureCount:e.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}})(this.state),i.Vr.batch(()=>{this.#e.forEach(e=>{e.onMutationUpdate(t)}),this.#s.notify({mutation:this,type:"updated",action:t})})}};function u(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}},21623:function(t,e,s){s.d(e,{S:function(){return y}});var i=s(45345),a=s(21733),r=s(18238),n=s(24112),u=class extends n.l{constructor(t={}){super(),this.config=t,this.#r=new Map}#r;build(t,e,s){let r=e.queryKey,n=e.queryHash??(0,i.Rm)(r,e),u=this.get(n);return u||(u=new a.A({client:t,queryKey:r,queryHash:n,options:t.defaultQueryOptions(e),state:s,defaultOptions:t.getQueryDefaults(r)}),this.add(u)),u}add(t){this.#r.has(t.queryHash)||(this.#r.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){let e=this.#r.get(t.queryHash);e&&(t.destroy(),e===t&&this.#r.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){r.Vr.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#r.get(t)}getAll(){return[...this.#r.values()]}find(t){let e={exact:!0,...t};return this.getAll().find(t=>(0,i._x)(e,t))}findAll(t={}){let e=this.getAll();return Object.keys(t).length>0?e.filter(e=>(0,i._x)(t,e)):e}notify(t){r.Vr.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){r.Vr.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){r.Vr.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},o=s(2894),h=class extends n.l{constructor(t={}){super(),this.config=t,this.#n=new Set,this.#u=new Map,this.#o=0}#n;#u;#o;build(t,e,s){let i=new o.m({client:t,mutationCache:this,mutationId:++this.#o,options:t.defaultMutationOptions(e),state:s});return this.add(i),i}add(t){this.#n.add(t);let e=l(t);if("string"==typeof e){let s=this.#u.get(e);s?s.push(t):this.#u.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#n.delete(t)){let e=l(t);if("string"==typeof e){let s=this.#u.get(e);if(s){if(s.length>1){let e=s.indexOf(t);-1!==e&&s.splice(e,1)}else s[0]===t&&this.#u.delete(e)}}}this.notify({type:"removed",mutation:t})}canRun(t){let e=l(t);if("string"!=typeof e)return!0;{let s=this.#u.get(e),i=s?.find(t=>"pending"===t.state.status);return!i||i===t}}runNext(t){let e=l(t);if("string"!=typeof e)return Promise.resolve();{let s=this.#u.get(e)?.find(e=>e!==t&&e.state.isPaused);return s?.continue()??Promise.resolve()}}clear(){r.Vr.batch(()=>{this.#n.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#n.clear(),this.#u.clear()})}getAll(){return Array.from(this.#n)}find(t){let e={exact:!0,...t};return this.getAll().find(t=>(0,i.X7)(e,t))}findAll(t={}){return this.getAll().filter(e=>(0,i.X7)(t,e))}notify(t){r.Vr.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){let t=this.getAll().filter(t=>t.state.isPaused);return r.Vr.batch(()=>Promise.all(t.map(t=>t.continue().catch(i.ZT))))}};function l(t){return t.options.scope?.id}var c=s(87045),d=s(57853);function f(t){return{onFetch:(e,s)=>{let a=e.options,r=e.fetchOptions?.meta?.fetchMore?.direction,n=e.state.data?.pages||[],u=e.state.data?.pageParams||[],o={pages:[],pageParams:[]},h=0,l=async()=>{let s=!1,l=t=>{Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(e.signal.aborted?s=!0:e.signal.addEventListener("abort",()=>{s=!0}),e.signal)})},c=(0,i.cG)(e.options,e.fetchOptions),d=async(t,a,r)=>{if(s)return Promise.reject();if(null==a&&t.pages.length)return Promise.resolve(t);let n=(()=>{let t={client:e.client,queryKey:e.queryKey,pageParam:a,direction:r?"backward":"forward",meta:e.options.meta};return l(t),t})(),u=await c(n),{maxPages:o}=e.options,h=r?i.Ht:i.VX;return{pages:h(t.pages,u,o),pageParams:h(t.pageParams,a,o)}};if(r&&n.length){let t="backward"===r,e={pages:n,pageParams:u},s=(t?function(t,{pages:e,pageParams:s}){return e.length>0?t.getPreviousPageParam?.(e[0],e,s[0],s):void 0}:p)(a,e);o=await d(e,s,t)}else{let e=t??n.length;do{let t=0===h?u[0]??a.initialPageParam:p(a,o);if(h>0&&null==t)break;o=await d(o,t),h++}while(he.options.persister?.(l,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},s):e.fetchFn=l}}}function p(t,{pages:e,pageParams:s}){let i=e.length-1;return e.length>0?t.getNextPageParam(e[i],e,s[i],s):void 0}var y=class{#h;#s;#l;#c;#d;#f;#p;#y;constructor(t={}){this.#h=t.queryCache||new u,this.#s=t.mutationCache||new h,this.#l=t.defaultOptions||{},this.#c=new Map,this.#d=new Map,this.#f=0}mount(){this.#f++,1===this.#f&&(this.#p=c.j.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#h.onFocus())}),this.#y=d.N.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#h.onOnline())}))}unmount(){this.#f--,0===this.#f&&(this.#p?.(),this.#p=void 0,this.#y?.(),this.#y=void 0)}isFetching(t){return this.#h.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#s.findAll({...t,status:"pending"}).length}getQueryData(t){let e=this.defaultQueryOptions({queryKey:t});return this.#h.get(e.queryHash)?.state.data}ensureQueryData(t){let e=this.defaultQueryOptions(t),s=this.#h.build(this,e),a=s.state.data;return void 0===a?this.fetchQuery(t):(t.revalidateIfStale&&s.isStaleByTime((0,i.KC)(e.staleTime,s))&&this.prefetchQuery(e),Promise.resolve(a))}getQueriesData(t){return this.#h.findAll(t).map(({queryKey:t,state:e})=>[t,e.data])}setQueryData(t,e,s){let a=this.defaultQueryOptions({queryKey:t}),r=this.#h.get(a.queryHash),n=r?.state.data,u=(0,i.SE)(e,n);if(void 0!==u)return this.#h.build(this,a).setData(u,{...s,manual:!0})}setQueriesData(t,e,s){return r.Vr.batch(()=>this.#h.findAll(t).map(({queryKey:t})=>[t,this.setQueryData(t,e,s)]))}getQueryState(t){let e=this.defaultQueryOptions({queryKey:t});return this.#h.get(e.queryHash)?.state}removeQueries(t){let e=this.#h;r.Vr.batch(()=>{e.findAll(t).forEach(t=>{e.remove(t)})})}resetQueries(t,e){let s=this.#h;return r.Vr.batch(()=>(s.findAll(t).forEach(t=>{t.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){let s={revert:!0,...e};return Promise.all(r.Vr.batch(()=>this.#h.findAll(t).map(t=>t.cancel(s)))).then(i.ZT).catch(i.ZT)}invalidateQueries(t,e={}){return r.Vr.batch(()=>(this.#h.findAll(t).forEach(t=>{t.invalidate()}),t?.refetchType==="none")?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e))}refetchQueries(t,e={}){let s={...e,cancelRefetch:e.cancelRefetch??!0};return Promise.all(r.Vr.batch(()=>this.#h.findAll(t).filter(t=>!t.isDisabled()&&!t.isStatic()).map(t=>{let e=t.fetch(void 0,s);return s.throwOnError||(e=e.catch(i.ZT)),"paused"===t.state.fetchStatus?Promise.resolve():e}))).then(i.ZT)}fetchQuery(t){let e=this.defaultQueryOptions(t);void 0===e.retry&&(e.retry=!1);let s=this.#h.build(this,e);return s.isStaleByTime((0,i.KC)(e.staleTime,s))?s.fetch(e):Promise.resolve(s.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(i.ZT).catch(i.ZT)}fetchInfiniteQuery(t){return t.behavior=f(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(i.ZT).catch(i.ZT)}ensureInfiniteQueryData(t){return t.behavior=f(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return d.N.isOnline()?this.#s.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#h}getMutationCache(){return this.#s}getDefaultOptions(){return this.#l}setDefaultOptions(t){this.#l=t}setQueryDefaults(t,e){this.#c.set((0,i.Ym)(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){let e=[...this.#c.values()],s={};return e.forEach(e=>{(0,i.to)(t,e.queryKey)&&Object.assign(s,e.defaultOptions)}),s}setMutationDefaults(t,e){this.#d.set((0,i.Ym)(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){let e=[...this.#d.values()],s={};return e.forEach(e=>{(0,i.to)(t,e.mutationKey)&&Object.assign(s,e.defaultOptions)}),s}defaultQueryOptions(t){if(t._defaulted)return t;let e={...this.#l.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=(0,i.Rm)(e.queryKey,e)),void 0===e.refetchOnReconnect&&(e.refetchOnReconnect="always"!==e.networkMode),void 0===e.throwOnError&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===i.CN&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#l.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#h.clear(),this.#s.clear()}}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1674-de8248fbd0c554ba.js b/litellm/proxy/_experimental/out/_next/static/chunks/1674-de8248fbd0c554ba.js deleted file mode 100644 index e8fa6e80e42..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1674-de8248fbd0c554ba.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1674],{14042:function(e,t,n){"use strict";n.d(t,{Z:function(){return eM}});var r=n(5853),o=n(7084),i=n(26898),a=n(13241),c=n(1153),l=n(2265),s=n(60474),u=n(47625),p=n(93765),f=n(86757),d=n.n(f),y=n(87602),m=n(9841),v=n(81889),h=n(82944),b=["points","className","baseLinePoints","connectNulls"];function g(){return(g=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&void 0!==arguments[0]?arguments[0]:[],t=[[]];return e.forEach(function(e){k(e)?t[t.length-1].push(e):t[t.length-1].length>0&&t.push([])}),k(e[0])&&t[t.length-1].push(e[0]),t[t.length-1].length<=0&&(t=t.slice(0,-1)),t},j=function(e,t){var n=x(e);t&&(n=[n.reduce(function(e,t){return[].concat(A(e),A(t))},[])]);var r=n.map(function(e){return e.reduce(function(e,t,n){return"".concat(e).concat(0===n?"M":"L").concat(t.x,",").concat(t.y)},"")}).join("");return 1===n.length?"".concat(r,"Z"):r},w=function(e,t,n){var r=j(e,n);return"".concat("Z"===r.slice(-1)?r.slice(0,-1):r,"L").concat(j(t.reverse(),n).slice(1))},P=function(e){var t=e.points,n=e.className,r=e.baseLinePoints,o=e.connectNulls,i=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,b);if(!t||!t.length)return null;var a=(0,y.Z)("recharts-polygon",n);if(r&&r.length){var c=i.stroke&&"none"!==i.stroke,s=w(t,r,o);return l.createElement("g",{className:a},l.createElement("path",g({},(0,h.L6)(i,!0),{fill:"Z"===s.slice(-1)?i.fill:"none",stroke:"none",d:s})),c?l.createElement("path",g({},(0,h.L6)(i,!0),{fill:"none",d:j(t,o)})):null,c?l.createElement("path",g({},(0,h.L6)(i,!0),{fill:"none",d:j(r,o)})):null)}var u=j(t,o);return l.createElement("path",g({},(0,h.L6)(i,!0),{fill:"Z"===u.slice(-1)?i.fill:"none",className:a,d:u}))},E=n(58811),S=n(41637),T=n(39206);function L(e){return(L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function R(){return(R=Object.assign?Object.assign.bind():function(e){for(var t=1;t1e-5?"outer"===t?"start":"end":n<-.00001?"outer"===t?"end":"start":"middle"}},{key:"renderAxisLine",value:function(){var e=this.props,t=e.cx,n=e.cy,r=e.radius,o=e.axisLine,i=e.axisLineType,a=I(I({},(0,h.L6)(this.props,!1)),{},{fill:"none"},(0,h.L6)(o,!1));if("circle"===i)return l.createElement(v.o,R({className:"recharts-polar-angle-axis-line"},a,{cx:t,cy:n,r:r}));var c=this.props.ticks.map(function(e){return(0,T.op)(t,n,r,e.coordinate)});return l.createElement(P,R({className:"recharts-polar-angle-axis-line"},a,{points:c}))}},{key:"renderTicks",value:function(){var e=this,t=this.props,n=t.ticks,o=t.tick,i=t.tickLine,a=t.tickFormatter,c=t.stroke,s=(0,h.L6)(this.props,!1),u=(0,h.L6)(o,!1),p=I(I({},s),{},{fill:"none"},(0,h.L6)(i,!1)),f=n.map(function(t,n){var f=e.getTickLineCoord(t),d=I(I(I({textAnchor:e.getTickTextAnchor(t)},s),{},{stroke:"none",fill:c},u),{},{index:n,payload:t,x:f.x2,y:f.y2});return l.createElement(m.m,R({className:(0,y.Z)("recharts-polar-angle-axis-tick",(0,T.$S)(o)),key:"tick-".concat(t.coordinate)},(0,S.bw)(e.props,t,n)),i&&l.createElement("line",R({className:"recharts-polar-angle-axis-tick-line"},p,f)),o&&r.renderTickItem(o,d,a?a(t.value,n):t.value))});return l.createElement(m.m,{className:"recharts-polar-angle-axis-ticks"},f)}},{key:"render",value:function(){var e=this.props,t=e.ticks,n=e.radius,r=e.axisLine;return!(n<=0)&&t&&t.length?l.createElement(m.m,{className:(0,y.Z)("recharts-polar-angle-axis",this.props.className)},r&&this.renderAxisLine(),this.renderTicks()):null}}],n=[{key:"renderTickItem",value:function(e,t,n){return l.isValidElement(e)?l.cloneElement(e,t):d()(e)?e(t):l.createElement(E.x,R({},t,{className:"recharts-polar-angle-axis-tick-value"}),n)}}],t&&C(r.prototype,t),n&&C(r,n),Object.defineProperty(r,"prototype",{writable:!1}),r}(l.PureComponent);Z(M,"displayName","PolarAngleAxis"),Z(M,"axisType","angleAxis"),Z(M,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var V=n(35802),$=n.n(V),q=n(37891),z=n.n(q),G=n(26680),W=["cx","cy","angle","ticks","axisLine"],Y=["ticks","tick","angle","tickFormatter","stroke"];function H(e){return(H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function U(){return(U=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function ee(e,t){for(var n=0;n0?es()(e,"paddingAngle",0):0;if(n){var c=(0,eb.k4)(n.endAngle-n.startAngle,e.endAngle-e.startAngle),l=ew(ew({},e),{},{startAngle:i+a,endAngle:i+c(r)+a});o.push(l),i=l.endAngle}else{var s=e.endAngle,p=e.startAngle,f=(0,eb.k4)(0,s-p)(r),d=ew(ew({},e),{},{startAngle:i+a,endAngle:i+f+a});o.push(d),i=d.endAngle}}),l.createElement(m.m,null,e.renderSectorsStatically(o))})}},{key:"attachKeyboardHandlers",value:function(e){var t=this;e.onkeydown=function(e){if(!e.altKey)switch(e.key){case"ArrowLeft":var n=++t.state.sectorToFocus%t.sectorRefs.length;t.sectorRefs[n].focus(),t.setState({sectorToFocus:n});break;case"ArrowRight":var r=--t.state.sectorToFocus<0?t.sectorRefs.length-1:t.state.sectorToFocus%t.sectorRefs.length;t.sectorRefs[r].focus(),t.setState({sectorToFocus:r});break;case"Escape":t.sectorRefs[t.state.sectorToFocus].blur(),t.setState({sectorToFocus:0})}}}},{key:"renderSectors",value:function(){var e=this.props,t=e.sectors,n=e.isAnimationActive,r=this.state.prevSectors;return n&&t&&t.length&&(!r||!ep()(r,t))?this.renderSectorsWithAnimation():this.renderSectorsStatically(t)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var e=this,t=this.props,n=t.hide,r=t.sectors,o=t.className,i=t.label,a=t.cx,c=t.cy,s=t.innerRadius,u=t.outerRadius,p=t.isAnimationActive,f=this.state.isAnimationFinished;if(n||!r||!r.length||!(0,eb.hj)(a)||!(0,eb.hj)(c)||!(0,eb.hj)(s)||!(0,eb.hj)(u))return null;var d=(0,y.Z)("recharts-pie",o);return l.createElement(m.m,{tabIndex:this.props.rootTabIndex,className:d,ref:function(t){e.pieRef=t}},this.renderSectors(),i&&this.renderLabels(r),G._.renderCallByParent(this.props,null,!1),(!p||f)&&em.e.renderCallByParent(this.props,r,!1))}}],n=[{key:"getDerivedStateFromProps",value:function(e,t){return t.prevIsAnimationActive!==e.isAnimationActive?{prevIsAnimationActive:e.isAnimationActive,prevAnimationId:e.animationId,curSectors:e.sectors,prevSectors:[],isAnimationFinished:!0}:e.isAnimationActive&&e.animationId!==t.prevAnimationId?{prevAnimationId:e.animationId,curSectors:e.sectors,prevSectors:t.curSectors,isAnimationFinished:!0}:e.sectors!==t.curSectors?{curSectors:e.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(e,t){return e>t?"start":e=360?A:A-1)*u,k=a.reduce(function(e,t){var n=(0,eg.F$)(t,g,0);return e+((0,eb.hj)(n)?n:0)},0);return k>0&&(t=a.map(function(e,t){var r,o=(0,eg.F$)(e,g,0),i=(0,eg.F$)(e,f,t),a=((0,eb.hj)(o)?o:0)/k,s=(r=t?n.endAngle+(0,eb.uY)(h)*u*(0!==o?1:0):l)+(0,eb.uY)(h)*((0!==o?m:0)+a*O),p=(r+s)/2,d=(v.innerRadius+v.outerRadius)/2,b=[{name:i,value:o,payload:e,dataKey:g,type:y}],A=(0,T.op)(v.cx,v.cy,d,p);return n=ew(ew(ew({percent:a,cornerRadius:c,name:i,tooltipPayload:b,midAngle:p,middleRadius:d,tooltipPosition:A},e),v),{},{value:(0,eg.F$)(e,g),startAngle:r,endAngle:s,payload:e,paddingAngle:(0,eb.uY)(h)*u})})),ew(ew({},v),{},{sectors:t,data:a})});var eI=(0,p.z)({chartName:"PieChart",GraphicalChild:eN,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:M},{axisType:"radiusAxis",AxisComp:ea}],formatAxisMap:T.t9,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}}),eC=n(8147),eD=n(92666),eF=n(98593);let e_=e=>{let{active:t,payload:n,valueFormatter:r}=e;if(t&&(null==n?void 0:n[0])){let e=null==n?void 0:n[0];return l.createElement(eF.$B,null,l.createElement("div",{className:(0,a.q)("px-4 py-2")},l.createElement(eF.zX,{value:r(e.value),name:e.name,color:e.payload.color})))}return null},eZ=(e,t)=>e.map((e,n)=>{let r=ne||t((0,c.vP)(n.map(e=>e[r]))),eK=e=>{let{cx:t,cy:n,innerRadius:r,outerRadius:o,startAngle:i,endAngle:a,className:c}=e;return l.createElement("g",null,l.createElement(s.L,{cx:t,cy:n,innerRadius:r,outerRadius:o,startAngle:i,endAngle:a,className:c,fill:"",opacity:.3,style:{outline:"none"}}))},eM=l.forwardRef((e,t)=>{let{data:n=[],category:s="value",index:p="name",colors:f=i.s,variant:d="donut",valueFormatter:y=c.Cj,label:m,showLabel:v=!0,animationDuration:h=900,showAnimation:b=!1,showTooltip:g=!0,noDataText:A,onValueChange:O,customTooltip:k,className:x}=e,j=(0,r._T)(e,["data","category","index","colors","variant","valueFormatter","label","showLabel","animationDuration","showAnimation","showTooltip","noDataText","onValueChange","customTooltip","className"]),w="donut"==d,P=eB(m,y,n,s),[E,S]=l.useState(void 0),T=!!O;return(0,l.useEffect)(()=>{let e=document.querySelectorAll(".recharts-pie-sector");e&&e.forEach(e=>{e.setAttribute("style","outline: none")})},[E]),l.createElement("div",Object.assign({ref:t,className:(0,a.q)("w-full h-40",x)},j),l.createElement(u.h,{className:"h-full w-full"},(null==n?void 0:n.length)?l.createElement(eI,{onClick:T&&E?()=>{S(void 0),null==O||O(null)}:void 0,margin:{top:0,left:0,right:0,bottom:0}},v&&w?l.createElement("text",{className:(0,a.q)("fill-tremor-content-emphasis","dark:fill-dark-tremor-content-emphasis"),x:"50%",y:"50%",textAnchor:"middle",dominantBaseline:"middle"},P):null,l.createElement(eN,{className:(0,a.q)("stroke-tremor-background dark:stroke-dark-tremor-background",O?"cursor-pointer":"cursor-default"),data:eZ(n,f),cx:"50%",cy:"50%",startAngle:90,endAngle:-270,innerRadius:w?"75%":"0%",outerRadius:"100%",stroke:"",strokeLinejoin:"round",dataKey:s,nameKey:p,isAnimationActive:b,animationDuration:h,onClick:function(e,t,n){n.stopPropagation(),T&&(E===t?(S(void 0),null==O||O(null)):(S(t),null==O||O(Object.assign({eventType:"slice"},e.payload.payload))))},activeIndex:E,inactiveShape:eK,style:{outline:"none"}}),l.createElement(eC.u,{wrapperStyle:{outline:"none"},isAnimationActive:!1,content:g?e=>{var t;let{active:n,payload:r}=e;return k?l.createElement(k,{payload:null==r?void 0:r.map(e=>{var t,n,i;return Object.assign(Object.assign({},e),{color:null!==(i=null===(n=null===(t=null==r?void 0:r[0])||void 0===t?void 0:t.payload)||void 0===n?void 0:n.color)&&void 0!==i?i:o.fr.Gray})}),active:n,label:null===(t=null==r?void 0:r[0])||void 0===t?void 0:t.name}):l.createElement(e_,{active:n,payload:r,valueFormatter:y})}:l.createElement(l.Fragment,null)})):l.createElement(eD.Z,{noDataText:A})))});eM.displayName="DonutChart"},35802:function(e,t,n){var r=n(67646),o=n(58905),i=n(88157);e.exports=function(e,t){return e&&e.length?r(e,i(t,2),o):void 0}},37891:function(e,t,n){var r=n(67646),o=n(88157),i=n(20121);e.exports=function(e,t){return e&&e.length?r(e,o(t,2),i):void 0}},44633:function(e,t,n){"use strict";var r=n(2265);let o=r.forwardRef(function(e,t){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"}))});t.Z=o},58710:function(e,t,n){"use strict";var r=n(2265);let o=r.forwardRef(function(e,t){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=o},92668:function(e,t,n){"use strict";n.d(t,{I:function(){return c}});var r=n(59121),o=n(31091),i=n(63497),a=n(99649);function c(e,t){let{years:n=0,months:c=0,weeks:l=0,days:s=0,hours:u=0,minutes:p=0,seconds:f=0}=t,d=(0,a.Q)(e),y=c||n?(0,o.z)(d,c+12*n):d,m=s||l?(0,r.E)(y,s+7*l):y;return(0,i.L)(e,m.getTime()+1e3*(f+60*(p+60*u)))}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1713-ce16d8a0e658a15d.js b/litellm/proxy/_experimental/out/_next/static/chunks/1713-ce16d8a0e658a15d.js new file mode 100644 index 00000000000..6aae7a1e1e9 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1713-ce16d8a0e658a15d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1713],{87045:function(t,e,r){r.d(e,{j:function(){return n}});var s=r(24112),i=r(45345),n=new class extends s.l{#t;#e;#r;constructor(){super(),this.#r=t=>{if(!i.sk&&window.addEventListener){let e=()=>t();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#e||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#r=t,this.#e?.(),this.#e=t(t=>{"boolean"==typeof t?this.setFocused(t):this.onFocus()})}setFocused(t){this.#t!==t&&(this.#t=t,this.onFocus())}onFocus(){let t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){return"boolean"==typeof this.#t?this.#t:globalThis.document?.visibilityState!=="hidden"}}},18238:function(t,e,r){r.d(e,{Vr:function(){return i}});var s=r(84554).Hp,i=function(){let t=[],e=0,r=t=>{t()},i=t=>{t()},n=s,u=s=>{e?t.push(s):n(()=>{r(s)})},o=()=>{let e=t;t=[],e.length&&n(()=>{i(()=>{e.forEach(t=>{r(t)})})})};return{batch:t=>{let r;e++;try{r=t()}finally{--e||o()}return r},batchCalls:t=>(...e)=>{u(()=>{t(...e)})},schedule:u,setNotifyFunction:t=>{r=t},setBatchNotifyFunction:t=>{i=t},setScheduler:t=>{n=t}}}()},57853:function(t,e,r){r.d(e,{N:function(){return n}});var s=r(24112),i=r(45345),n=new class extends s.l{#s=!0;#e;#r;constructor(){super(),this.#r=t=>{if(!i.sk&&window.addEventListener){let e=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#e||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#r=t,this.#e?.(),this.#e=t(this.setOnline.bind(this))}setOnline(t){this.#s!==t&&(this.#s=t,this.listeners.forEach(e=>{e(t)}))}isOnline(){return this.#s}}},21733:function(t,e,r){r.d(e,{A:function(){return o},z:function(){return a}});var s=r(45345),i=r(18238),n=r(11255),u=r(7989),o=class extends u.F{#i;#n;#u;#o;#a;#c;#h;constructor(t){super(),this.#h=!1,this.#c=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#o=t.client,this.#u=this.#o.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#i=h(this.options),this.state=t.state??this.#i,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#a?.promise}setOptions(t){if(this.options={...this.#c,...t},this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){let t=h(this.options);void 0!==t.data&&(this.setState(c(t.data,t.dataUpdatedAt)),this.#i=t)}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#u.remove(this)}setData(t,e){let r=(0,s.oE)(this.state.data,t,this.options);return this.#l({data:r,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),r}setState(t,e){this.#l({type:"setState",state:t,setStateOptions:e})}cancel(t){let e=this.#a?.promise;return this.#a?.cancel(t),e?e.then(s.ZT).catch(s.ZT):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#i)}isActive(){return this.observers.some(t=>!1!==(0,s.Nc)(t.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===s.CN||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0&&this.observers.some(t=>"static"===(0,s.KC)(t.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(t=0){return void 0===this.state.data||"static"!==t&&(!!this.state.isInvalidated||!(0,s.Kp)(this.state.dataUpdatedAt,t))}onFocus(){let t=this.observers.find(t=>t.shouldFetchOnWindowFocus());t?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){let t=this.observers.find(t=>t.shouldFetchOnReconnect());t?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),this.#u.notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(this.#a&&(this.#h?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#u.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#l({type:"invalidate"})}async fetch(t,e){if("idle"!==this.state.fetchStatus&&this.#a?.status()!=="rejected"){if(void 0!==this.state.data&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(t&&this.setOptions(t),!this.options.queryFn){let t=this.observers.find(t=>t.options.queryFn);t&&this.setOptions(t.options)}let r=new AbortController,i=t=>{Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(this.#h=!0,r.signal)})},u=()=>{let t=(0,s.cG)(this.options,e),r=(()=>{let t={client:this.#o,queryKey:this.queryKey,meta:this.meta};return i(t),t})();return(this.#h=!1,this.options.persister)?this.options.persister(t,r,this):t(r)},o=(()=>{let t={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#o,state:this.state,fetchFn:u};return i(t),t})();this.options.behavior?.onFetch(o,this),this.#n=this.state,("idle"===this.state.fetchStatus||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#l({type:"fetch",meta:o.fetchOptions?.meta}),this.#a=(0,n.Mz)({initialPromise:e?.initialPromise,fn:o.fetchFn,onCancel:t=>{t instanceof n.p8&&t.revert&&this.setState({...this.#n,fetchStatus:"idle"}),r.abort()},onFail:(t,e)=>{this.#l({type:"failed",failureCount:t,error:e})},onPause:()=>{this.#l({type:"pause"})},onContinue:()=>{this.#l({type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0});try{let t=await this.#a.start();if(void 0===t)throw Error(`${this.queryHash} data is undefined`);return this.setData(t),this.#u.config.onSuccess?.(t,this),this.#u.config.onSettled?.(t,this.state.error,this),t}catch(t){if(t instanceof n.p8){if(t.silent)return this.#a.promise;if(t.revert){if(void 0===this.state.data)throw t;return this.state.data}}throw this.#l({type:"error",error:t}),this.#u.config.onError?.(t,this),this.#u.config.onSettled?.(this.state.data,t,this),t}finally{this.scheduleGc()}}#l(t){this.state=(e=>{switch(t.type){case"failed":return{...e,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...e,fetchStatus:"paused"};case"continue":return{...e,fetchStatus:"fetching"};case"fetch":return{...e,...a(e.data,this.options),fetchMeta:t.meta??null};case"success":let r={...e,...c(t.data,t.dataUpdatedAt),dataUpdateCount:e.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#n=t.manual?r:void 0,r;case"error":let s=t.error;return{...e,error:s,errorUpdateCount:e.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:e.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...e,isInvalidated:!0};case"setState":return{...e,...t.state}}})(this.state),i.Vr.batch(()=>{this.observers.forEach(t=>{t.onQueryUpdate()}),this.#u.notify({query:this,type:"updated",action:t})})}};function a(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:(0,n.Kw)(e.networkMode)?"fetching":"paused",...void 0===t&&{error:null,status:"pending"}}}function c(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function h(t){let e="function"==typeof t.initialData?t.initialData():t.initialData,r=void 0!==e,s=r?"function"==typeof t.initialDataUpdatedAt?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:r?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}},7989:function(t,e,r){r.d(e,{F:function(){return n}});var s=r(84554),i=r(45345),n=class{#d;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),(0,i.PN)(this.gcTime)&&(this.#d=s.mr.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(i.sk?1/0:3e5))}clearGcTimeout(){this.#d&&(s.mr.clearTimeout(this.#d),this.#d=void 0)}}},11255:function(t,e,r){r.d(e,{Kw:function(){return a},Mz:function(){return h},p8:function(){return c}});var s=r(87045),i=r(57853),n=r(16803),u=r(45345);function o(t){return Math.min(1e3*2**t,3e4)}function a(t){return(t??"online")!=="online"||i.N.isOnline()}var c=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function h(t){let e,r=!1,h=0,l=(0,n.O)(),d=()=>"pending"!==l.status,f=()=>s.j.isFocused()&&("always"===t.networkMode||i.N.isOnline())&&t.canRun(),p=()=>a(t.networkMode)&&t.canRun(),y=t=>{d()||(e?.(),l.resolve(t))},v=t=>{d()||(e?.(),l.reject(t))},b=()=>new Promise(r=>{e=t=>{(d()||f())&&r(t)},t.onPause?.()}).then(()=>{e=void 0,d()||t.onContinue?.()}),m=()=>{let e;if(d())return;let s=0===h?t.initialPromise:void 0;try{e=s??t.fn()}catch(t){e=Promise.reject(t)}Promise.resolve(e).then(y).catch(e=>{if(d())return;let s=t.retry??(u.sk?0:3),i=t.retryDelay??o,n="function"==typeof i?i(h,e):i,a=!0===s||"number"==typeof s&&hf()?void 0:b()).then(()=>{r?v(e):m()})})};return{promise:l,status:()=>l.status,cancel:e=>{if(!d()){let r=new c(e);v(r),t.onCancel?.(r)}},continue:()=>(e?.(),l),cancelRetry:()=>{r=!0},continueRetry:()=>{r=!1},canStart:p,start:()=>(p()?m():b().then(m),l)}}},24112:function(t,e,r){r.d(e,{l:function(){return s}});var s=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}}},16803:function(t,e,r){r.d(e,{O:function(){return s}});function s(){let t,e;let r=new Promise((r,s)=>{t=r,e=s});function s(t){Object.assign(r,t),delete r.resolve,delete r.reject}return r.status="pending",r.catch(()=>{}),r.resolve=e=>{s({status:"fulfilled",value:e}),t(e)},r.reject=t=>{s({status:"rejected",reason:t}),e(t)},r}},84554:function(t,e,r){r.d(e,{Hp:function(){return n},mr:function(){return i}});var s={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},i=new class{#f=s;#p=!1;setTimeoutProvider(t){this.#f=t}setTimeout(t,e){return this.#f.setTimeout(t,e)}clearTimeout(t){this.#f.clearTimeout(t)}setInterval(t,e){return this.#f.setInterval(t,e)}clearInterval(t){this.#f.clearInterval(t)}};function n(t){setTimeout(t,0)}},45345:function(t,e,r){r.d(e,{CN:function(){return T},Ht:function(){return w},KC:function(){return c},Kp:function(){return a},L3:function(){return F},Nc:function(){return h},PN:function(){return o},Rm:function(){return f},SE:function(){return u},VS:function(){return b},VX:function(){return C},X7:function(){return d},Ym:function(){return p},ZT:function(){return n},_v:function(){return O},_x:function(){return l},cG:function(){return Q},oE:function(){return S},sk:function(){return i},to:function(){return y}});var s=r(84554),i="undefined"==typeof window||"Deno"in globalThis;function n(){}function u(t,e){return"function"==typeof t?t(e):t}function o(t){return"number"==typeof t&&t>=0&&t!==1/0}function a(t,e){return Math.max(t+(e||0)-Date.now(),0)}function c(t,e){return"function"==typeof t?t(e):t}function h(t,e){return"function"==typeof t?t(e):t}function l(t,e){let{type:r="all",exact:s,fetchStatus:i,predicate:n,queryKey:u,stale:o}=t;if(u){if(s){if(e.queryHash!==f(u,e.options))return!1}else if(!y(e.queryKey,u))return!1}if("all"!==r){let t=e.isActive();if("active"===r&&!t||"inactive"===r&&t)return!1}return("boolean"!=typeof o||e.isStale()===o)&&(!i||i===e.state.fetchStatus)&&(!n||!!n(e))}function d(t,e){let{exact:r,status:s,predicate:i,mutationKey:n}=t;if(n){if(!e.options.mutationKey)return!1;if(r){if(p(e.options.mutationKey)!==p(n))return!1}else if(!y(e.options.mutationKey,n))return!1}return(!s||e.state.status===s)&&(!i||!!i(e))}function f(t,e){return(e?.queryKeyHashFn||p)(t)}function p(t){return JSON.stringify(t,(t,e)=>g(e)?Object.keys(e).sort().reduce((t,r)=>(t[r]=e[r],t),{}):e)}function y(t,e){return t===e||typeof t==typeof e&&!!t&&!!e&&"object"==typeof t&&"object"==typeof e&&Object.keys(e).every(r=>y(t[r],e[r]))}var v=Object.prototype.hasOwnProperty;function b(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(let r in t)if(t[r]!==e[r])return!1;return!0}function m(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function g(t){if(!R(t))return!1;let e=t.constructor;if(void 0===e)return!0;let r=e.prototype;return!!(R(r)&&r.hasOwnProperty("isPrototypeOf"))&&Object.getPrototypeOf(t)===Object.prototype}function R(t){return"[object Object]"===Object.prototype.toString.call(t)}function O(t){return new Promise(e=>{s.mr.setTimeout(e,t)})}function S(t,e,r){return"function"==typeof r.structuralSharing?r.structuralSharing(t,e):!1!==r.structuralSharing?function t(e,r){if(e===r)return e;let s=m(e)&&m(r);if(!s&&!(g(e)&&g(r)))return r;let i=(s?e:Object.keys(e)).length,n=s?r:Object.keys(r),u=n.length,o=s?Array(u):{},a=0;for(let c=0;cr?s.slice(1):s}function w(t,e,r=0){let s=[e,...t];return r&&s.length>r?s.slice(0,-1):s}var T=Symbol();function Q(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:t.queryFn&&t.queryFn!==T?t.queryFn:()=>Promise.reject(Error(`Missing queryFn: '${t.queryHash}'`))}function F(t,e){return"function"==typeof t?t(...e):!!t}},29827:function(t,e,r){r.d(e,{NL:function(){return u},aH:function(){return o}});var s=r(2265),i=r(57437),n=s.createContext(void 0),u=t=>{let e=s.useContext(n);if(t)return t;if(!e)throw Error("No QueryClient set, use QueryClientProvider to set one");return e},o=t=>{let{client:e,children:r}=t;return s.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,i.jsx)(n.Provider,{value:e,children:r})}},11713:function(t,e,r){let s;r.d(e,{a:function(){return E}});var i=r(87045),n=r(18238),u=r(21733),o=r(24112),a=r(16803),c=r(45345),h=r(84554),l=class extends o.l{constructor(t,e){super(),this.options=e,this.#o=t,this.#y=null,this.#v=(0,a.O)(),this.bindMethods(),this.setOptions(e)}#o;#b=void 0;#m=void 0;#g=void 0;#R;#O;#v;#y;#S;#C;#w;#T;#Q;#F;#I=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#b.addObserver(this),d(this.#b,this.options)?this.#E():this.updateResult(),this.#U())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return f(this.#b,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return f(this.#b,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#k(),this.#P(),this.#b.removeObserver(this)}setOptions(t){let e=this.options,r=this.#b;if(this.options=this.#o.defaultQueryOptions(t),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof(0,c.Nc)(this.options.enabled,this.#b))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#j(),this.#b.setOptions(this.options),e._defaulted&&!(0,c.VS)(this.options,e)&&this.#o.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#b,observer:this});let s=this.hasListeners();s&&p(this.#b,r,this.options,e)&&this.#E(),this.updateResult(),s&&(this.#b!==r||(0,c.Nc)(this.options.enabled,this.#b)!==(0,c.Nc)(e.enabled,this.#b)||(0,c.KC)(this.options.staleTime,this.#b)!==(0,c.KC)(e.staleTime,this.#b))&&this.#q();let i=this.#D();s&&(this.#b!==r||(0,c.Nc)(this.options.enabled,this.#b)!==(0,c.Nc)(e.enabled,this.#b)||i!==this.#F)&&this.#x(i)}getOptimisticResult(t){let e=this.#o.getQueryCache().build(this.#o,t),r=this.createResult(e,t);return(0,c.VS)(this.getCurrentResult(),r)||(this.#g=r,this.#O=this.options,this.#R=this.#b.state),r}getCurrentResult(){return this.#g}trackResult(t,e){return new Proxy(t,{get:(t,r)=>(this.trackProp(r),e?.(r),"promise"!==r||(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#v.status||this.#v.reject(Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(t,r))})}trackProp(t){this.#I.add(t)}getCurrentQuery(){return this.#b}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let e=this.#o.defaultQueryOptions(t),r=this.#o.getQueryCache().build(this.#o,e);return r.fetch().then(()=>this.createResult(r,e))}fetch(t){return this.#E({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#g))}#E(t){this.#j();let e=this.#b.fetch(this.options,t);return t?.throwOnError||(e=e.catch(c.ZT)),e}#q(){this.#k();let t=(0,c.KC)(this.options.staleTime,this.#b);if(c.sk||this.#g.isStale||!(0,c.PN)(t))return;let e=(0,c.Kp)(this.#g.dataUpdatedAt,t);this.#T=h.mr.setTimeout(()=>{this.#g.isStale||this.updateResult()},e+1)}#D(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#b):this.options.refetchInterval)??!1}#x(t){this.#P(),this.#F=t,!c.sk&&!1!==(0,c.Nc)(this.options.enabled,this.#b)&&(0,c.PN)(this.#F)&&0!==this.#F&&(this.#Q=h.mr.setInterval(()=>{(this.options.refetchIntervalInBackground||i.j.isFocused())&&this.#E()},this.#F))}#U(){this.#q(),this.#x(this.#D())}#k(){this.#T&&(h.mr.clearTimeout(this.#T),this.#T=void 0)}#P(){this.#Q&&(h.mr.clearInterval(this.#Q),this.#Q=void 0)}createResult(t,e){let r;let s=this.#b,i=this.options,n=this.#g,o=this.#R,h=this.#O,l=t!==s?t.state:this.#m,{state:f}=t,v={...f},b=!1;if(e._optimisticResults){let r=this.hasListeners(),n=!r&&d(t,e),o=r&&p(t,s,e,i);(n||o)&&(v={...v,...(0,u.z)(f.data,t.options)}),"isRestoring"===e._optimisticResults&&(v.fetchStatus="idle")}let{error:m,errorUpdatedAt:g,status:R}=v;r=v.data;let O=!1;if(void 0!==e.placeholderData&&void 0===r&&"pending"===R){let t;n?.isPlaceholderData&&e.placeholderData===h?.placeholderData?(t=n.data,O=!0):t="function"==typeof e.placeholderData?e.placeholderData(this.#w?.state.data,this.#w):e.placeholderData,void 0!==t&&(R="success",r=(0,c.oE)(n?.data,t,e),b=!0)}if(e.select&&void 0!==r&&!O){if(n&&r===o?.data&&e.select===this.#S)r=this.#C;else try{this.#S=e.select,r=e.select(r),r=(0,c.oE)(n?.data,r,e),this.#C=r,this.#y=null}catch(t){this.#y=t}}this.#y&&(m=this.#y,r=this.#C,g=Date.now(),R="error");let S="fetching"===v.fetchStatus,C="pending"===R,w="error"===R,T=C&&S,Q=void 0!==r,F={status:R,fetchStatus:v.fetchStatus,isPending:C,isSuccess:"success"===R,isError:w,isInitialLoading:T,isLoading:T,data:r,dataUpdatedAt:v.dataUpdatedAt,error:m,errorUpdatedAt:g,failureCount:v.fetchFailureCount,failureReason:v.fetchFailureReason,errorUpdateCount:v.errorUpdateCount,isFetched:v.dataUpdateCount>0||v.errorUpdateCount>0,isFetchedAfterMount:v.dataUpdateCount>l.dataUpdateCount||v.errorUpdateCount>l.errorUpdateCount,isFetching:S,isRefetching:S&&!C,isLoadingError:w&&!Q,isPaused:"paused"===v.fetchStatus,isPlaceholderData:b,isRefetchError:w&&Q,isStale:y(t,e),refetch:this.refetch,promise:this.#v,isEnabled:!1!==(0,c.Nc)(e.enabled,t)};if(this.options.experimental_prefetchInRender){let e=t=>{"error"===F.status?t.reject(F.error):void 0!==F.data&&t.resolve(F.data)},r=()=>{e(this.#v=F.promise=(0,a.O)())},i=this.#v;switch(i.status){case"pending":t.queryHash===s.queryHash&&e(i);break;case"fulfilled":("error"===F.status||F.data!==i.value)&&r();break;case"rejected":("error"!==F.status||F.error!==i.reason)&&r()}}return F}updateResult(){let t=this.#g,e=this.createResult(this.#b,this.options);this.#R=this.#b.state,this.#O=this.options,void 0!==this.#R.data&&(this.#w=this.#b),(0,c.VS)(e,t)||(this.#g=e,this.#N({listeners:(()=>{if(!t)return!0;let{notifyOnChangeProps:e}=this.options,r="function"==typeof e?e():e;if("all"===r||!r&&!this.#I.size)return!0;let s=new Set(r??this.#I);return this.options.throwOnError&&s.add("error"),Object.keys(this.#g).some(e=>this.#g[e]!==t[e]&&s.has(e))})()}))}#j(){let t=this.#o.getQueryCache().build(this.#o,this.options);if(t===this.#b)return;let e=this.#b;this.#b=t,this.#m=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#U()}#N(t){n.Vr.batch(()=>{t.listeners&&this.listeners.forEach(t=>{t(this.#g)}),this.#o.getQueryCache().notify({query:this.#b,type:"observerResultsUpdated"})})}};function d(t,e){return!1!==(0,c.Nc)(e.enabled,t)&&void 0===t.state.data&&!("error"===t.state.status&&!1===e.retryOnMount)||void 0!==t.state.data&&f(t,e,e.refetchOnMount)}function f(t,e,r){if(!1!==(0,c.Nc)(e.enabled,t)&&"static"!==(0,c.KC)(e.staleTime,t)){let s="function"==typeof r?r(t):r;return"always"===s||!1!==s&&y(t,e)}return!1}function p(t,e,r,s){return(t!==e||!1===(0,c.Nc)(s.enabled,t))&&(!r.suspense||"error"!==t.state.status)&&y(t,r)}function y(t,e){return!1!==(0,c.Nc)(e.enabled,t)&&t.isStaleByTime((0,c.KC)(e.staleTime,t))}var v=r(2265),b=r(29827);r(57437);var m=v.createContext((s=!1,{clearReset:()=>{s=!1},reset:()=>{s=!0},isReset:()=>s})),g=()=>v.useContext(m),R=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&!e.isReset()&&(t.retryOnMount=!1)},O=t=>{v.useEffect(()=>{t.clearReset()},[t])},S=t=>{let{result:e,errorResetBoundary:r,throwOnError:s,query:i,suspense:n}=t;return e.isError&&!r.isReset()&&!e.isFetching&&i&&(n&&void 0===e.data||(0,c.L3)(s,[e.error,i]))},C=v.createContext(!1),w=()=>v.useContext(C);C.Provider;var T=t=>{if(t.suspense){let e=t=>"static"===t?t:Math.max(t??1e3,1e3),r=t.staleTime;t.staleTime="function"==typeof r?(...t)=>e(r(...t)):e(r),"number"==typeof t.gcTime&&(t.gcTime=Math.max(t.gcTime,1e3))}},Q=(t,e)=>t.isLoading&&t.isFetching&&!e,F=(t,e)=>t?.suspense&&e.isPending,I=(t,e,r)=>e.fetchOptimistic(t).catch(()=>{r.clearReset()});function E(t,e){return function(t,e,r){var s,i,u,o,a;let h=w(),l=g(),d=(0,b.NL)(r),f=d.defaultQueryOptions(t);null===(i=d.getDefaultOptions().queries)||void 0===i||null===(s=i._experimental_beforeQuery)||void 0===s||s.call(i,f),f._optimisticResults=h?"isRestoring":"optimistic",T(f),R(f,l),O(l);let p=!d.getQueryCache().get(f.queryHash),[y]=v.useState(()=>new e(d,f)),m=y.getOptimisticResult(f),C=!h&&!1!==t.subscribed;if(v.useSyncExternalStore(v.useCallback(t=>{let e=C?y.subscribe(n.Vr.batchCalls(t)):c.ZT;return y.updateResult(),e},[y,C]),()=>y.getCurrentResult(),()=>y.getCurrentResult()),v.useEffect(()=>{y.setOptions(f)},[f,y]),F(f,m))throw I(f,y,l);if(S({result:m,errorResetBoundary:l,throwOnError:f.throwOnError,query:d.getQueryCache().get(f.queryHash),suspense:f.suspense}))throw m.error;if(null===(o=d.getDefaultOptions().queries)||void 0===o||null===(u=o._experimental_afterQuery)||void 0===u||u.call(o,f,m),f.experimental_prefetchInRender&&!c.sk&&Q(m,h)){let t=p?I(f,y,l):null===(a=d.getQueryCache().get(f.queryHash))||void 0===a?void 0:a.promise;null==t||t.catch(c.ZT).finally(()=>{y.updateResult()})}return f.notifyOnChangeProps?m:y.trackResult(m)}(t,l,e)}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1739-23e7361486c2cc74.js b/litellm/proxy/_experimental/out/_next/static/chunks/1739-1616f1e28b151332.js similarity index 55% rename from litellm/proxy/_experimental/out/_next/static/chunks/1739-23e7361486c2cc74.js rename to litellm/proxy/_experimental/out/_next/static/chunks/1739-1616f1e28b151332.js index c1e1814d049..0a8b97880da 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1739-23e7361486c2cc74.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1739-1616f1e28b151332.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1739],{25512:function(e,t,l){l.d(t,{P:function(){return s.Z},Q:function(){return a.Z}});var s=l(27281),a=l(57365)},12011:function(e,t,l){l.r(t),l.d(t,{default:function(){return w}});var s=l(57437),a=l(2265),r=l(99376),n=l(78489),i=l(94789),o=l(12514),c=l(49804),d=l(67101),u=l(84264),m=l(49566),g=l(96761),x=l(84566),h=l(19250),y=l(14474),f=l(10032),p=l(5545),j=l(3914);function w(){let[e]=f.Z.useForm(),t=(0,r.useSearchParams)();(0,j.e)("token");let l=t.get("invitation_id"),w=t.get("action"),[b,v]=(0,a.useState)(null),[k,S]=(0,a.useState)(""),[_,N]=(0,a.useState)(""),[C,I]=(0,a.useState)(null),[D,Z]=(0,a.useState)(""),[A,K]=(0,a.useState)(""),[E,T]=(0,a.useState)(!0);return(0,a.useEffect)(()=>{(0,h.getUiConfig)().then(e=>{console.log("ui config in onboarding.tsx:",e),T(!1)})},[]),(0,a.useEffect)(()=>{l&&!E&&(0,h.getOnboardingCredentials)(l).then(e=>{let t=e.login_url;console.log("login_url:",t),Z(t);let l=e.token,s=(0,y.o)(l);K(l),console.log("decoded:",s),v(s.key),console.log("decoded user email:",s.user_email),N(s.user_email),I(s.user_id)})},[l,E]),(0,s.jsx)("div",{className:"mx-auto w-full max-w-md mt-10",children:(0,s.jsxs)(o.Z,{children:[(0,s.jsx)(g.Z,{className:"text-sm mb-5 text-center",children:"\uD83D\uDE85 LiteLLM"}),(0,s.jsx)(g.Z,{className:"text-xl",children:"reset_password"===w?"Reset Password":"Sign up"}),(0,s.jsx)(u.Z,{children:"reset_password"===w?"Reset your password to access Admin UI.":"Claim your user account to login to Admin UI."}),"reset_password"!==w&&(0,s.jsx)(i.Z,{className:"mt-4",title:"SSO",icon:x.GH$,color:"sky",children:(0,s.jsxs)(d.Z,{numItems:2,className:"flex justify-between items-center",children:[(0,s.jsx)(c.Z,{children:"SSO is under the Enterprise Tier."}),(0,s.jsx)(c.Z,{children:(0,s.jsx)(n.Z,{variant:"primary",className:"mb-2",children:(0,s.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get Free Trial"})})})]})}),(0,s.jsxs)(f.Z,{className:"mt-10 mb-5 mx-auto",layout:"vertical",onFinish:e=>{console.log("in handle submit. accessToken:",b,"token:",A,"formValues:",e),b&&A&&(e.user_email=_,C&&l&&(0,h.claimOnboardingToken)(b,l,C,e.password).then(e=>{document.cookie="token="+A;let t=(0,h.getProxyBaseUrl)();console.log("proxyBaseUrl:",t);let l=t?"".concat(t,"/ui/?login=success"):"/ui/?login=success";console.log("redirecting to:",l),window.location.href=l}))},children:[(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(f.Z.Item,{label:"Email Address",name:"user_email",children:(0,s.jsx)(m.Z,{type:"email",disabled:!0,value:_,defaultValue:_,className:"max-w-md"})}),(0,s.jsx)(f.Z.Item,{label:"Password",name:"password",rules:[{required:!0,message:"password required to sign up"}],help:"reset_password"===w?"Enter your new password":"Create a password for your account",children:(0,s.jsx)(m.Z,{placeholder:"",type:"password",className:"max-w-md"})})]}),(0,s.jsx)("div",{className:"mt-10",children:(0,s.jsx)(p.ZP,{htmlType:"submit",children:"reset_password"===w?"Reset Password":"Sign Up"})})]})]})})}},39210:function(e,t,l){l.d(t,{Z:function(){return a}});var s=l(19250);let a=async(e,t,l,a,r)=>{let n;n="Admin"!=l&&"Admin Viewer"!=l?await (0,s.teamListCall)(e,(null==a?void 0:a.organization_id)||null,t):await (0,s.teamListCall)(e,(null==a?void 0:a.organization_id)||null),console.log("givenTeams: ".concat(n)),r(n)}},49924:function(e,t,l){var s=l(2265),a=l(19250);t.Z=e=>{let{selectedTeam:t,currentOrg:l,selectedKeyAlias:r,accessToken:n,createClicked:i}=e,[o,c]=(0,s.useState)({keys:[],total_count:0,current_page:1,total_pages:0}),[d,u]=(0,s.useState)(!0),[m,g]=(0,s.useState)(null),x=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{if(console.log("calling fetchKeys"),!n){console.log("accessToken",n);return}u(!0);let t="number"==typeof e.page?e.page:1,l="number"==typeof e.pageSize?e.pageSize:100,s=await (0,a.keyListCall)(n,null,null,null,null,null,t,l);console.log("data",s),c(s),g(null)}catch(e){g(e instanceof Error?e:Error("An error occurred"))}finally{u(!1)}};return(0,s.useEffect)(()=>{x(),console.log("selectedTeam",t,"currentOrg",l,"accessToken",n,"selectedKeyAlias",r)},[t,l,n,r,i]),{keys:o.keys,isLoading:d,error:m,pagination:{currentPage:o.current_page,totalPages:o.total_pages,totalCount:o.total_count},refresh:x,setKeys:e=>{c(t=>{let l="function"==typeof e?e(t.keys):e;return{...t,keys:l}})}}}},21739:function(e,t,l){l.d(t,{Z:function(){return B}});var s=l(57437),a=l(2265),r=l(19250),n=l(39210),i=l(49804),o=l(67101),c=l(30874),d=l(92668),u=l(16721),m=l(46468),g=l(10032),x=l(22116),h=l(19015),y=l(29233),f=l(49924);l(25512);var p=l(16312),j=l(94292),w=l(99981),b=l(23048),v=l(11713),k=l(30841),S=l(7310),_=l.n(S),N=l(12363),C=l(59872),I=l(71594),D=l(24525),Z=l(10178),A=l(86462),K=l(47686),E=l(44633),T=l(49084),O=l(40728);function P(e){let{keys:t,setKeys:l,isLoading:n=!1,pagination:i,onPageChange:o,pageSize:c=50,teams:d,selectedTeam:u,setSelectedTeam:g,selectedKeyAlias:x,setSelectedKeyAlias:h,accessToken:y,userID:f,userRole:S,organizations:P,setCurrentOrg:L,refresh:U,onSortChange:z,currentSort:V,premiumUser:R,setAccessToken:F}=e,[M,B]=(0,a.useState)(null),[J,W]=(0,a.useState)([]),[H,q]=a.useState(()=>V?[{id:V.sortBy,desc:"desc"===V.sortOrder}]:[{id:"created_at",desc:!0}]),[G,X]=(0,a.useState)({}),{filters:$,filteredKeys:Q,allKeyAliases:Y,allTeams:ee,allOrganizations:et,handleFilterChange:el,handleFilterReset:es}=function(e){let{keys:t,teams:l,organizations:s,accessToken:n}=e,i={"Team ID":"","Organization ID":"","Key Alias":"","User ID":"","Sort By":"created_at","Sort Order":"desc"},[o,c]=(0,a.useState)(i),[d,u]=(0,a.useState)(l||[]),[m,g]=(0,a.useState)(s||[]),[x,h]=(0,a.useState)(t),y=(0,a.useRef)(0),f=(0,a.useCallback)(_()(async e=>{if(!n)return;let t=Date.now();y.current=t;try{let l=await (0,r.keyListCall)(n,e["Organization ID"]||null,e["Team ID"]||null,e["Key Alias"]||null,e["User ID"]||null,e["Key Hash"]||null,1,N.d,e["Sort By"]||null,e["Sort Order"]||null);t===y.current&&l&&(h(l.keys),console.log("called from debouncedSearch filters:",JSON.stringify(e)),console.log("called from debouncedSearch data:",JSON.stringify(l)))}catch(e){console.error("Error searching users:",e)}},300),[n]);(0,a.useEffect)(()=>{if(!t){h([]);return}let e=[...t];o["Team ID"]&&(e=e.filter(e=>e.team_id===o["Team ID"])),o["Organization ID"]&&(e=e.filter(e=>e.organization_id===o["Organization ID"])),h(e)},[t,o]),(0,a.useEffect)(()=>{let e=async()=>{let e=await (0,k.IE)(n);e.length>0&&u(e);let t=await (0,k.cT)(n);t.length>0&&g(t)};n&&e()},[n]);let p=(0,v.a)({queryKey:["allKeys"],queryFn:async()=>{if(!n)throw Error("Access token required");return await (0,k.LO)(n)},enabled:!!n}).data||[];return(0,a.useEffect)(()=>{l&&l.length>0&&u(e=>e.length{s&&s.length>0&&g(e=>e.length{c({"Team ID":e["Team ID"]||"","Organization ID":e["Organization ID"]||"","Key Alias":e["Key Alias"]||"","User ID":e["User ID"]||"","Sort By":e["Sort By"]||"created_at","Sort Order":e["Sort Order"]||"desc"}),f({...o,...e})},handleFilterReset:()=>{c(i),f(i)}}}({keys:t,teams:d,organizations:P,accessToken:y});(0,a.useEffect)(()=>{if(y){let e=t.map(e=>e.user_id).filter(e=>null!==e);(async()=>{W((await (0,r.userListCall)(y,e,1,100)).users)})()}},[y,t]),(0,a.useEffect)(()=>{if(U){let e=()=>{U()};return window.addEventListener("storage",e),()=>{window.removeEventListener("storage",e)}}},[U]);let ea=[{id:"expander",header:()=>null,cell:e=>{let{row:t}=e;return t.getCanExpand()?(0,s.jsx)("button",{onClick:t.getToggleExpandedHandler(),style:{cursor:"pointer"},children:t.getIsExpanded()?"ā–¼":"ā–¶"}):null}},{id:"token",accessorKey:"token",header:"Key ID",cell:e=>(0,s.jsx)("div",{className:"overflow-hidden",children:(0,s.jsx)(w.Z,{title:e.getValue(),children:(0,s.jsx)(p.z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate max-w-[200px]",onClick:()=>B(e.getValue()),children:e.getValue()?"".concat(e.getValue().slice(0,7),"..."):"-"})})})},{id:"key_alias",accessorKey:"key_alias",header:"Key Alias",cell:e=>{let t=e.getValue();return(0,s.jsx)(w.Z,{title:t,children:t?t.length>20?"".concat(t.slice(0,20),"..."):t:"-"})}},{id:"key_name",accessorKey:"key_name",header:"Secret Key",cell:e=>(0,s.jsx)("span",{className:"font-mono text-xs",children:e.getValue()})},{id:"team_alias",accessorKey:"team_id",header:"Team Alias",cell:e=>{let{row:t,getValue:l}=e,s=l(),a=null==d?void 0:d.find(e=>e.team_id===s);return(null==a?void 0:a.team_alias)||"Unknown"}},{id:"team_id",accessorKey:"team_id",header:"Team ID",cell:e=>(0,s.jsx)(w.Z,{title:e.getValue(),children:e.getValue()?"".concat(e.getValue().slice(0,7),"..."):"-"})},{id:"organization_id",accessorKey:"organization_id",header:"Organization ID",cell:e=>e.getValue()?e.renderValue():"-"},{id:"user_email",accessorKey:"user_id",header:"User Email",cell:e=>{let t=e.getValue(),l=J.find(e=>e.user_id===t);return(null==l?void 0:l.user_email)?(0,s.jsx)(w.Z,{title:null==l?void 0:l.user_email,children:(0,s.jsxs)("span",{children:[null==l?void 0:l.user_email.slice(0,20),"..."]})}):"-"}},{id:"user_id",accessorKey:"user_id",header:"User ID",cell:e=>{let t=e.getValue();return t&&t.length>15?(0,s.jsx)(w.Z,{title:t,children:(0,s.jsxs)("span",{children:[t.slice(0,7),"..."]})}):t||"-"}},{id:"created_at",accessorKey:"created_at",header:"Created At",cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleDateString():"-"}},{id:"created_by",accessorKey:"created_by",header:"Created By",cell:e=>{let t=e.getValue();return t&&t.length>15?(0,s.jsx)(w.Z,{title:t,children:(0,s.jsxs)("span",{children:[t.slice(0,7),"..."]})}):t}},{id:"updated_at",accessorKey:"updated_at",header:"Updated At",cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleDateString():"Never"}},{id:"expires",accessorKey:"expires",header:"Expires",cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleDateString():"Never"}},{id:"spend",accessorKey:"spend",header:"Spend (USD)",cell:e=>(0,C.pw)(e.getValue(),4)},{id:"max_budget",accessorKey:"max_budget",header:"Budget (USD)",cell:e=>{let t=e.getValue();return null===t?"Unlimited":"$".concat((0,C.pw)(t))}},{id:"budget_reset_at",accessorKey:"budget_reset_at",header:"Budget Reset",cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleString():"Never"}},{id:"models",accessorKey:"models",header:"Models",cell:e=>{let t=e.getValue();return(0,s.jsx)("div",{className:"flex flex-col py-2",children:Array.isArray(t)?(0,s.jsx)("div",{className:"flex flex-col",children:0===t.length?(0,s.jsx)(O.C,{size:"xs",className:"mb-1",color:"red",children:(0,s.jsx)(O.x,{children:"All Proxy Models"})}):(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{className:"flex items-start",children:[t.length>3&&(0,s.jsx)("div",{children:(0,s.jsx)(Z.JO,{icon:G[e.row.id]?A.Z:K.Z,className:"cursor-pointer",size:"xs",onClick:()=>{X(t=>({...t,[e.row.id]:!t[e.row.id]}))}})}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-1",children:[t.slice(0,3).map((e,t)=>"all-proxy-models"===e?(0,s.jsx)(O.C,{size:"xs",color:"red",children:(0,s.jsx)(O.x,{children:"All Proxy Models"})},t):(0,s.jsx)(O.C,{size:"xs",color:"blue",children:(0,s.jsx)(O.x,{children:e.length>30?"".concat((0,m.W0)(e).slice(0,30),"..."):(0,m.W0)(e)})},t)),t.length>3&&!G[e.row.id]&&(0,s.jsx)(O.C,{size:"xs",color:"gray",className:"cursor-pointer",children:(0,s.jsxs)(O.x,{children:["+",t.length-3," ",t.length-3==1?"more model":"more models"]})}),G[e.row.id]&&(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:t.slice(3).map((e,t)=>"all-proxy-models"===e?(0,s.jsx)(O.C,{size:"xs",color:"red",children:(0,s.jsx)(O.x,{children:"All Proxy Models"})},t+3):(0,s.jsx)(O.C,{size:"xs",color:"blue",children:(0,s.jsx)(O.x,{children:e.length>30?"".concat((0,m.W0)(e).slice(0,30),"..."):(0,m.W0)(e)})},t+3))})]})]})})}):null})}},{id:"rate_limits",header:"Rate Limits",cell:e=>{let{row:t}=e,l=t.original;return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{children:["TPM: ",null!==l.tpm_limit?l.tpm_limit:"Unlimited"]}),(0,s.jsxs)("div",{children:["RPM: ",null!==l.rpm_limit?l.rpm_limit:"Unlimited"]})]})}}];console.log("keys: ".concat(JSON.stringify(t)));let er=(0,I.b7)({data:Q,columns:ea.filter(e=>"expander"!==e.id),state:{sorting:H},onSortingChange:e=>{let t="function"==typeof e?e(H):e;if(console.log("newSorting: ".concat(JSON.stringify(t))),q(t),t&&t.length>0){let e=t[0],l=e.id,s=e.desc?"desc":"asc";console.log("sortBy: ".concat(l,", sortOrder: ").concat(s)),el({...$,"Sort By":l,"Sort Order":s}),null==z||z(l,s)}},getCoreRowModel:(0,D.sC)(),getSortedRowModel:(0,D.tj)(),enableSorting:!0,manualSorting:!1});return a.useEffect(()=>{V&&q([{id:V.sortBy,desc:"desc"===V.sortOrder}])},[V]),(0,s.jsx)("div",{className:"w-full h-full overflow-hidden",children:M?(0,s.jsx)(j.Z,{keyId:M,onClose:()=>B(null),keyData:Q.find(e=>e.token===M),onKeyDataUpdate:e=>{l(t=>t.map(t=>t.token===e.token?(0,C.nl)(t,e):t)),U&&U()},onDelete:()=>{l(e=>e.filter(e=>e.token!==M)),U&&U()},accessToken:y,userID:f,userRole:S,teams:ee,premiumUser:R,setAccessToken:F}):(0,s.jsxs)("div",{className:"border-b py-4 flex-1 overflow-hidden",children:[(0,s.jsx)("div",{className:"w-full mb-6",children:(0,s.jsx)(b.Z,{options:[{name:"Team ID",label:"Team ID",isSearchable:!0,searchFn:async e=>ee&&0!==ee.length?ee.filter(t=>t.team_id.toLowerCase().includes(e.toLowerCase())||t.team_alias&&t.team_alias.toLowerCase().includes(e.toLowerCase())).map(e=>({label:"".concat(e.team_alias||e.team_id," (").concat(e.team_id,")"),value:e.team_id})):[]},{name:"Organization ID",label:"Organization ID",isSearchable:!0,searchFn:async e=>et&&0!==et.length?et.filter(t=>{var l,s;return null!==(s=null===(l=t.organization_id)||void 0===l?void 0:l.toLowerCase().includes(e.toLowerCase()))&&void 0!==s&&s}).filter(e=>null!==e.organization_id&&void 0!==e.organization_id).map(e=>({label:"".concat(e.organization_id||"Unknown"," (").concat(e.organization_id,")"),value:e.organization_id})):[]},{name:"Key Alias",label:"Key Alias",isSearchable:!0,searchFn:async e=>Y.filter(t=>t.toLowerCase().includes(e.toLowerCase())).map(e=>({label:e,value:e}))},{name:"User ID",label:"User ID",isSearchable:!1},{name:"Key Hash",label:"Key Hash",isSearchable:!1}],onApplyFilters:el,initialValues:$,onResetFilters:es})}),(0,s.jsxs)("div",{className:"flex items-center justify-between w-full mb-4",children:[(0,s.jsxs)("span",{className:"inline-flex text-sm text-gray-700",children:["Showing"," ",n?"...":"".concat((i.currentPage-1)*c+1," - ").concat(Math.min(i.currentPage*c,i.totalCount))," ","of ",n?"...":i.totalCount," results"]}),(0,s.jsxs)("div",{className:"inline-flex items-center gap-2",children:[(0,s.jsxs)("span",{className:"text-sm text-gray-700",children:["Page ",n?"...":i.currentPage," of ",n?"...":i.totalPages]}),(0,s.jsx)("button",{onClick:()=>o(i.currentPage-1),disabled:n||1===i.currentPage,className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),(0,s.jsx)("button",{onClick:()=>o(i.currentPage+1),disabled:n||i.currentPage===i.totalPages,className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]}),(0,s.jsx)("div",{className:"h-[75vh] overflow-auto",children:(0,s.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsxs)(Z.iA,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,s.jsx)(Z.ss,{children:er.getHeaderGroups().map(e=>(0,s.jsx)(Z.SC,{children:e.headers.map(e=>(0,s.jsx)(Z.xs,{className:"py-1 h-8 ".concat("actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""),onClick:e.column.getToggleSortingHandler(),children:(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,I.ie)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&(0,s.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,s.jsx)(E.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,s.jsx)(A.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,s.jsx)(T.Z,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,s.jsx)(Z.RM,{children:n?(0,s.jsx)(Z.SC,{children:(0,s.jsx)(Z.pj,{colSpan:ea.length,className:"h-8 text-center",children:(0,s.jsx)("div",{className:"text-center text-gray-500",children:(0,s.jsx)("p",{children:"\uD83D\uDE85 Loading keys..."})})})}):Q.length>0?er.getRowModel().rows.map(e=>(0,s.jsx)(Z.SC,{className:"h-8",children:e.getVisibleCells().map(e=>(0,s.jsx)(Z.pj,{style:{maxWidth:"8-x",whiteSpace:"pre-wrap",overflow:"hidden"},className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap ".concat("models"===e.column.id&&e.getValue().length>3?"px-0":""),children:(0,I.ie)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,s.jsx)(Z.SC,{children:(0,s.jsx)(Z.pj,{colSpan:ea.length,className:"h-8 text-center",children:(0,s.jsx)("div",{className:"text-center text-gray-500",children:(0,s.jsx)("p",{children:"No keys found"})})})})})]})})})})]})})}var L=l(9114),U=e=>{let{userID:t,userRole:l,accessToken:n,selectedTeam:i,setSelectedTeam:o,data:c,setData:p,teams:j,premiumUser:w,currentOrg:b,organizations:v,setCurrentOrg:k,selectedKeyAlias:S,setSelectedKeyAlias:_,createClicked:N,setAccessToken:C}=e,[I,D]=(0,a.useState)(!1),[Z,A]=(0,a.useState)(!1),[K,E]=(0,a.useState)(null),[T,O]=(0,a.useState)(""),[U,z]=(0,a.useState)(null),[V,R]=(0,a.useState)(null),[F,M]=(0,a.useState)((null==i?void 0:i.team_id)||"");(0,a.useEffect)(()=>{M((null==i?void 0:i.team_id)||"")},[i]);let{keys:B,isLoading:J,error:W,pagination:H,refresh:q,setKeys:G}=(0,f.Z)({selectedTeam:i||void 0,currentOrg:b,selectedKeyAlias:S,accessToken:n||"",createClicked:N}),[X,$]=(0,a.useState)(!1),[Q,Y]=(0,a.useState)(!1),[ee,et]=(0,a.useState)(null),[el,es]=(0,a.useState)([]),ea=new Set,[er,en]=(0,a.useState)(!1),[ei,eo]=(0,a.useState)(!1),[ec,ed]=(0,a.useState)(null),[eu,em]=(0,a.useState)(null),[eg]=g.Z.useForm(),[ex,eh]=(0,a.useState)(null),[ey,ef]=(0,a.useState)(ea),[ep,ej]=(0,a.useState)([]);(0,a.useEffect)(()=>{console.log("in calculateNewExpiryTime for selectedToken",ee),(null==eu?void 0:eu.duration)?eh((e=>{if(!e)return null;try{let t;let l=new Date;if(e.endsWith("s"))t=(0,d.I)(l,{seconds:parseInt(e)});else if(e.endsWith("h"))t=(0,d.I)(l,{hours:parseInt(e)});else if(e.endsWith("d"))t=(0,d.I)(l,{days:parseInt(e)});else throw Error("Invalid duration format");return t.toLocaleString("en-US",{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!0})}catch(e){return null}})(eu.duration)):eh(null),console.log("calculateNewExpiryTime:",ex)},[ee,null==eu?void 0:eu.duration]),(0,a.useEffect)(()=>{(async()=>{try{if(null===t||null===l||null===n)return;let e=await (0,m.K2)(t,l,n);e&&es(e)}catch(e){L.Z.error({description:"Error fetching user models"})}})()},[n,t,l]),(0,a.useEffect)(()=>{if(j){let e=new Set;j.forEach((t,l)=>{let s=t.team_id;e.add(s)}),ef(e)}},[j]);let ew=async()=>{if(null!=K&&null!=B){try{if(!n)return;await (0,r.keyDeleteCall)(n,K);let e=B.filter(e=>e.token!==K);G(e)}catch(e){L.Z.error({description:"Error deleting the key"})}A(!1),E(null),O("")}},eb=()=>{A(!1),E(null),O("")},ev=(e,t)=>{em(l=>({...l,[e]:t}))},ek=async()=>{if(!w){L.Z.warning({description:"Regenerate API Key is an Enterprise feature. Please upgrade to use this feature."});return}if(null!=ee)try{let e=await eg.validateFields();if(!n)return;let t=await (0,r.regenerateKeyCall)(n,ee.token||ee.token_id,e);if(ed(t.key),c){let l=c.map(l=>l.token===(null==ee?void 0:ee.token)?{...l,key_name:t.key_name,...e}:l);p(l)}eo(!1),eg.resetFields(),L.Z.success({description:"API Key regenerated successfully"})}catch(e){console.error("Error regenerating key:",e),L.Z.error({description:"Failed to regenerate API Key"})}};return(0,s.jsxs)("div",{children:[(0,s.jsx)(P,{keys:B,setKeys:G,isLoading:J,pagination:H,onPageChange:e=>{q({page:e})},pageSize:100,teams:j,selectedTeam:i,setSelectedTeam:o,accessToken:n,userID:t,userRole:l,organizations:v,setCurrentOrg:k,refresh:q,selectedKeyAlias:S,setSelectedKeyAlias:_,premiumUser:w,setAccessToken:C}),Z&&(()=>{let e=null==B?void 0:B.find(e=>e.token===K),t=(null==e?void 0:e.key_alias)||(null==e?void 0:e.token_id)||K,l=T===t;return(0,s.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:(0,s.jsxs)("div",{className:"bg-white rounded-lg shadow-xl w-full max-w-2xl min-h-[380px] py-6 overflow-hidden transform transition-all flex flex-col justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200",children:[(0,s.jsx)("h3",{className:"text-lg font-semibold text-gray-900",children:"Delete Key"}),(0,s.jsx)("button",{onClick:()=>{eb(),O("")},className:"text-gray-400 hover:text-gray-500 focus:outline-none",children:(0,s.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,s.jsxs)("div",{className:"px-6 py-4",children:[(0,s.jsxs)("div",{className:"flex items-start gap-3 p-4 bg-red-50 border border-red-100 rounded-md mb-5",children:[(0,s.jsx)("div",{className:"text-red-500 mt-0.5",children:(0,s.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.082 16.5c-.77.833.192 2.5 1.732 2.5z"})})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-base font-medium text-red-600",children:"Warning: You are about to delete this API key."}),(0,s.jsx)("p",{className:"text-base text-red-600 mt-2",children:"This action is irreversible and will immediately revoke access for any applications using this key."})]})]}),(0,s.jsx)("p",{className:"text-base text-gray-600 mb-5",children:"Are you sure you want to delete this API key?"}),(0,s.jsxs)("div",{className:"mb-5",children:[(0,s.jsxs)("label",{className:"block text-base font-medium text-gray-700 mb-2",children:["Type ",(0,s.jsx)("span",{className:"underline",children:t})," to confirm deletion:"]}),(0,s.jsx)("input",{type:"text",value:T,onChange:e=>O(e.target.value),placeholder:"Enter key name exactly",className:"w-full px-4 py-3 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-base",autoFocus:!0})]})]})]}),(0,s.jsxs)("div",{className:"px-6 py-4 bg-gray-50 flex justify-end gap-4",children:[(0,s.jsx)("button",{onClick:()=>{eb(),O("")},className:"px-5 py-3 bg-white border border-gray-300 rounded-md text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:"Cancel"}),(0,s.jsx)("button",{onClick:ew,disabled:!l,className:"px-5 py-3 rounded-md text-base font-medium text-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 ".concat(l?"bg-red-600 hover:bg-red-700":"bg-red-300 cursor-not-allowed"),children:"Delete Key"})]})]})})})(),(0,s.jsx)(x.Z,{title:"Regenerate API Key",visible:ei,onCancel:()=>{eo(!1),eg.resetFields()},footer:[(0,s.jsx)(u.zx,{onClick:()=>{eo(!1),eg.resetFields()},className:"mr-2",children:"Cancel"},"cancel"),(0,s.jsx)(u.zx,{onClick:ek,disabled:!w,children:w?"Regenerate":"Upgrade to Regenerate"},"regenerate")],children:w?(0,s.jsxs)(g.Z,{form:eg,layout:"vertical",onValuesChange:(e,t)=>{"duration"in e&&ev("duration",e.duration)},children:[(0,s.jsx)(g.Z.Item,{name:"key_alias",label:"Key Alias",children:(0,s.jsx)(u.oi,{disabled:!0})}),(0,s.jsx)(g.Z.Item,{name:"max_budget",label:"Max Budget (USD)",children:(0,s.jsx)(h.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,s.jsx)(g.Z.Item,{name:"tpm_limit",label:"TPM Limit",children:(0,s.jsx)(h.Z,{style:{width:"100%"}})}),(0,s.jsx)(g.Z.Item,{name:"rpm_limit",label:"RPM Limit",children:(0,s.jsx)(h.Z,{style:{width:"100%"}})}),(0,s.jsx)(g.Z.Item,{name:"duration",label:"Expire Key (eg: 30s, 30h, 30d)",className:"mt-8",children:(0,s.jsx)(u.oi,{placeholder:""})}),(0,s.jsxs)("div",{className:"mt-2 text-sm text-gray-500",children:["Current expiry:"," ",(null==ee?void 0:ee.expires)!=null?new Date(ee.expires).toLocaleString():"Never"]}),ex&&(0,s.jsxs)("div",{className:"mt-2 text-sm text-green-600",children:["New expiry: ",ex]})]}):(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-gray-500 italic text-[12px]",children:"Upgrade to use this feature"}),(0,s.jsx)(u.zx,{variant:"primary",className:"mb-2",children:(0,s.jsx)("a",{href:"https://calendly.com/d/4mp-gd3-k5k/litellm-1-1-onboarding-chat",target:"_blank",children:"Get Free Trial"})})]})}),ec&&(0,s.jsx)(x.Z,{visible:!!ec,onCancel:()=>ed(null),footer:[(0,s.jsx)(u.zx,{onClick:()=>ed(null),children:"Close"},"close")],children:(0,s.jsxs)(u.rj,{numItems:1,className:"gap-2 w-full",children:[(0,s.jsx)(u.Dx,{children:"Regenerated Key"}),(0,s.jsx)(u.JX,{numColSpan:1,children:(0,s.jsxs)("p",{children:["Please replace your old key with the new key generated. For security reasons,"," ",(0,s.jsx)("b",{children:"you will not be able to view it again"})," through your LiteLLM account. If you lose this secret key, you will need to generate a new one."]})}),(0,s.jsxs)(u.JX,{numColSpan:1,children:[(0,s.jsx)(u.xv,{className:"mt-3",children:"Key Alias:"}),(0,s.jsx)("div",{style:{background:"#f8f8f8",padding:"10px",borderRadius:"5px",marginBottom:"10px"},children:(0,s.jsx)("pre",{style:{wordWrap:"break-word",whiteSpace:"normal"},children:(null==ee?void 0:ee.key_alias)||"No alias set"})}),(0,s.jsx)(u.xv,{className:"mt-3",children:"New API Key:"}),(0,s.jsx)("div",{style:{background:"#f8f8f8",padding:"10px",borderRadius:"5px",marginBottom:"10px"},children:(0,s.jsx)("pre",{style:{wordWrap:"break-word",whiteSpace:"normal"},children:ec})}),(0,s.jsx)(y.CopyToClipboard,{text:ec,onCopy:()=>L.Z.success({description:"API Key copied to clipboard"}),children:(0,s.jsx)(u.zx,{className:"mt-3",children:"Copy API Key"})})]})]})})]})},z=l(12011),V=l(99376),R=l(14474),F=l(57840),M=l(3914),B=e=>{let{userID:t,userRole:l,teams:d,keys:u,setUserRole:m,userEmail:g,setUserEmail:x,setTeams:h,setKeys:y,premiumUser:f,organizations:p,addKey:j,createClicked:w}=e,[b,v]=(0,a.useState)(null),[k,S]=(0,a.useState)(null),_=(0,V.useSearchParams)(),N=function(e){console.log("COOKIES",document.cookie);let t=document.cookie.split("; ").find(t=>t.startsWith(e+"="));return t?t.split("=")[1]:null}("token"),C=_.get("invitation_id"),[I,D]=(0,a.useState)(null),[Z,A]=(0,a.useState)(null),[K,E]=(0,a.useState)([]),[T,O]=(0,a.useState)(null),[P,L]=(0,a.useState)(null),[B,J]=(0,a.useState)(null);if(window.addEventListener("beforeunload",function(){sessionStorage.clear()}),(0,a.useEffect)(()=>{if(N){let e=(0,R.o)(N);if(e){if(console.log("Decoded token:",e),console.log("Decoded key:",e.key),D(e.key),e.user_role){let t=function(e){if(!e)return"Undefined Role";switch(console.log("Received user role: ".concat(e)),e.toLowerCase()){case"app_owner":case"demo_app_owner":return"App Owner";case"app_admin":case"proxy_admin":return"Admin";case"proxy_admin_viewer":return"Admin Viewer";case"app_user":return"App User";case"internal_user":return"Internal User";case"internal_user_viewer":return"Internal Viewer";default:return"Unknown Role"}}(e.user_role);console.log("Decoded user_role:",t),m(t)}else console.log("User role not defined");e.user_email?x(e.user_email):console.log("User Email is not set ".concat(e))}}if(t&&I&&l&&!u&&!b){let e=sessionStorage.getItem("userModels"+t);e?E(JSON.parse(e)):(console.log("currentOrg: ".concat(JSON.stringify(k))),(async()=>{try{let e=await (0,r.getProxyUISettings)(I);O(e);let s=await (0,r.userInfoCall)(I,t,l,!1,null,null);v(s.user_info),console.log("userSpendData: ".concat(JSON.stringify(b))),(null==s?void 0:s.teams[0].keys)?y(s.keys.concat(s.teams.filter(e=>"Admin"===l||e.user_id===t).flatMap(e=>e.keys))):y(s.keys),sessionStorage.setItem("userData"+t,JSON.stringify(s.keys)),sessionStorage.setItem("userSpendData"+t,JSON.stringify(s.user_info));let a=(await (0,r.modelAvailableCall)(I,t,l)).data.map(e=>e.id);console.log("available_model_names:",a),E(a),console.log("userModels:",K),sessionStorage.setItem("userModels"+t,JSON.stringify(a))}catch(e){console.error("There was an error fetching the data",e),e.message.includes("Invalid proxy server token passed")&&W()}})(),(0,n.Z)(I,t,l,k,h))}},[t,N,I,u,l]),(0,a.useEffect)(()=>{I&&(async()=>{try{let e=await (0,r.keyInfoCall)(I,[I]);console.log("keyInfo: ",e)}catch(e){e.message.includes("Invalid proxy server token passed")&&W()}})()},[I]),(0,a.useEffect)(()=>{console.log("currentOrg: ".concat(JSON.stringify(k),", accessToken: ").concat(I,", userID: ").concat(t,", userRole: ").concat(l)),I&&(console.log("fetching teams"),(0,n.Z)(I,t,l,k,h))},[k]),(0,a.useEffect)(()=>{if(null!==u&&null!=P&&null!==P.team_id){let e=0;for(let t of(console.log("keys: ".concat(JSON.stringify(u))),u))P.hasOwnProperty("team_id")&&null!==t.team_id&&t.team_id===P.team_id&&(e+=t.spend);console.log("sum: ".concat(e)),A(e)}else if(null!==u){let e=0;for(let t of u)e+=t.spend;A(e)}},[P]),null!=C)return(0,s.jsx)(z.default,{});function W(){(0,M.b)();let e=(0,r.getProxyBaseUrl)();console.log("proxyBaseUrl:",e);let t=e?"".concat(e,"/sso/key/generate"):"/sso/key/generate";return console.log("Full URL:",t),window.location.href=t,null}if(null==N)return console.log("All cookies before redirect:",document.cookie),W(),null;try{let e=(0,R.o)(N);console.log("Decoded token:",e);let t=e.exp,l=Math.floor(Date.now()/1e3);if(t&&l>=t)return console.log("Token expired, redirecting to login"),W(),null}catch(e){return console.error("Error decoding token:",e),(0,M.b)(),W(),null}if(null==I)return null;if(null==t)return(0,s.jsx)("h1",{children:"User ID is not set"});if(null==l&&m("App Owner"),l&&"Admin Viewer"==l){let{Title:e,Paragraph:t}=F.default;return(0,s.jsxs)("div",{children:[(0,s.jsx)(e,{level:1,children:"Access Denied"}),(0,s.jsx)(t,{children:"Ask your proxy admin for access to create keys"})]})}return console.log("inside user dashboard, selected team",P),console.log("All cookies after redirect:",document.cookie),(0,s.jsx)("div",{className:"w-full mx-4 h-[75vh]",children:(0,s.jsx)(o.Z,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:(0,s.jsxs)(i.Z,{numColSpan:1,className:"flex flex-col gap-2",children:[(0,s.jsx)(c.ZP,{userID:t,team:P,teams:d,userRole:l,accessToken:I,data:u,addKey:j,premiumUser:f},P?P.team_id:null),(0,s.jsx)(U,{userID:t,userRole:l,accessToken:I,selectedTeam:P||null,setSelectedTeam:L,selectedKeyAlias:B,setSelectedKeyAlias:J,data:u,setData:y,premiumUser:f,teams:d,currentOrg:k,setCurrentOrg:S,organizations:p,createClicked:w,setAccessToken:D})]})})})}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1739],{25512:function(e,t,l){l.d(t,{P:function(){return s.Z},Q:function(){return a.Z}});var s=l(27281),a=l(43227)},12011:function(e,t,l){l.r(t),l.d(t,{default:function(){return w}});var s=l(57437),a=l(2265),r=l(99376),n=l(78489),i=l(94789),o=l(12514),c=l(49804),d=l(67101),u=l(84264),m=l(49566),g=l(96761),x=l(84566),h=l(19250),y=l(14474),f=l(10032),p=l(5545),j=l(3914);function w(){let[e]=f.Z.useForm(),t=(0,r.useSearchParams)();(0,j.e)("token");let l=t.get("invitation_id"),w=t.get("action"),[b,v]=(0,a.useState)(null),[k,S]=(0,a.useState)(""),[_,N]=(0,a.useState)(""),[C,D]=(0,a.useState)(null),[I,Z]=(0,a.useState)(""),[K,E]=(0,a.useState)(""),[A,T]=(0,a.useState)(!0);return(0,a.useEffect)(()=>{(0,h.getUiConfig)().then(e=>{console.log("ui config in onboarding.tsx:",e),T(!1)})},[]),(0,a.useEffect)(()=>{l&&!A&&(0,h.getOnboardingCredentials)(l).then(e=>{let t=e.login_url;console.log("login_url:",t),Z(t);let l=e.token,s=(0,y.o)(l);E(l),console.log("decoded:",s),v(s.key),console.log("decoded user email:",s.user_email),N(s.user_email),D(s.user_id)})},[l,A]),(0,s.jsx)("div",{className:"mx-auto w-full max-w-md mt-10",children:(0,s.jsxs)(o.Z,{children:[(0,s.jsx)(g.Z,{className:"text-sm mb-5 text-center",children:"\uD83D\uDE85 LiteLLM"}),(0,s.jsx)(g.Z,{className:"text-xl",children:"reset_password"===w?"Reset Password":"Sign up"}),(0,s.jsx)(u.Z,{children:"reset_password"===w?"Reset your password to access Admin UI.":"Claim your user account to login to Admin UI."}),"reset_password"!==w&&(0,s.jsx)(i.Z,{className:"mt-4",title:"SSO",icon:x.GH$,color:"sky",children:(0,s.jsxs)(d.Z,{numItems:2,className:"flex justify-between items-center",children:[(0,s.jsx)(c.Z,{children:"SSO is under the Enterprise Tier."}),(0,s.jsx)(c.Z,{children:(0,s.jsx)(n.Z,{variant:"primary",className:"mb-2",children:(0,s.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get Free Trial"})})})]})}),(0,s.jsxs)(f.Z,{className:"mt-10 mb-5 mx-auto",layout:"vertical",onFinish:e=>{console.log("in handle submit. accessToken:",b,"token:",K,"formValues:",e),b&&K&&(e.user_email=_,C&&l&&(0,h.claimOnboardingToken)(b,l,C,e.password).then(e=>{document.cookie="token="+K;let t=(0,h.getProxyBaseUrl)();console.log("proxyBaseUrl:",t);let l=t?"".concat(t,"/ui/?login=success"):"/ui/?login=success";console.log("redirecting to:",l),window.location.href=l}))},children:[(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(f.Z.Item,{label:"Email Address",name:"user_email",children:(0,s.jsx)(m.Z,{type:"email",disabled:!0,value:_,defaultValue:_,className:"max-w-md"})}),(0,s.jsx)(f.Z.Item,{label:"Password",name:"password",rules:[{required:!0,message:"password required to sign up"}],help:"reset_password"===w?"Enter your new password":"Create a password for your account",children:(0,s.jsx)(m.Z,{placeholder:"",type:"password",className:"max-w-md"})})]}),(0,s.jsx)("div",{className:"mt-10",children:(0,s.jsx)(p.ZP,{htmlType:"submit",children:"reset_password"===w?"Reset Password":"Sign Up"})})]})]})})}},39210:function(e,t,l){l.d(t,{Z:function(){return a}});var s=l(19250);let a=async(e,t,l,a,r)=>{let n;n="Admin"!=l&&"Admin Viewer"!=l?await (0,s.teamListCall)(e,(null==a?void 0:a.organization_id)||null,t):await (0,s.teamListCall)(e,(null==a?void 0:a.organization_id)||null),console.log("givenTeams: ".concat(n)),r(n)}},49924:function(e,t,l){var s=l(2265),a=l(19250);t.Z=e=>{let{selectedTeam:t,currentOrg:l,selectedKeyAlias:r,accessToken:n,createClicked:i}=e,[o,c]=(0,s.useState)({keys:[],total_count:0,current_page:1,total_pages:0}),[d,u]=(0,s.useState)(!0),[m,g]=(0,s.useState)(null),x=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{if(console.log("calling fetchKeys"),!n){console.log("accessToken",n);return}u(!0);let t="number"==typeof e.page?e.page:1,l="number"==typeof e.pageSize?e.pageSize:100,s=await (0,a.keyListCall)(n,null,null,null,null,null,t,l);console.log("data",s),c(s),g(null)}catch(e){g(e instanceof Error?e:Error("An error occurred"))}finally{u(!1)}};return(0,s.useEffect)(()=>{x(),console.log("selectedTeam",t,"currentOrg",l,"accessToken",n,"selectedKeyAlias",r)},[t,l,n,r,i]),{keys:o.keys,isLoading:d,error:m,pagination:{currentPage:o.current_page,totalPages:o.total_pages,totalCount:o.total_count},refresh:x,setKeys:e=>{c(t=>{let l="function"==typeof e?e(t.keys):e;return{...t,keys:l}})}}}},21739:function(e,t,l){l.d(t,{Z:function(){return B}});var s=l(57437),a=l(2265),r=l(19250),n=l(39210),i=l(49804),o=l(67101),c=l(30874),d=l(92668),u=l(16721),m=l(46468),g=l(10032),x=l(22116),h=l(19015),y=l(29233),f=l(49924);l(25512);var p=l(16312),j=l(94292),w=l(99981),b=l(23048),v=l(11713),k=l(30841),S=l(7310),_=l.n(S),N=l(12363),C=l(59872),D=l(71594),I=l(24525),Z=l(10178),K=l(86462),E=l(47686),A=l(44633),T=l(49084),O=l(40728);function L(e){let{keys:t,setKeys:l,isLoading:n=!1,pagination:i,onPageChange:o,pageSize:c=50,teams:d,selectedTeam:u,setSelectedTeam:g,selectedKeyAlias:x,setSelectedKeyAlias:h,accessToken:y,userID:f,userRole:S,organizations:L,setCurrentOrg:U,refresh:z,onSortChange:V,currentSort:P,premiumUser:R,setAccessToken:F}=e,[M,B]=(0,a.useState)(null),[J,W]=(0,a.useState)([]),[H,q]=a.useState(()=>P?[{id:P.sortBy,desc:"desc"===P.sortOrder}]:[{id:"created_at",desc:!0}]),[G,X]=(0,a.useState)({}),{filters:$,filteredKeys:Q,allKeyAliases:Y,allTeams:ee,allOrganizations:et,handleFilterChange:el,handleFilterReset:es}=function(e){let{keys:t,teams:l,organizations:s,accessToken:n}=e,i={"Team ID":"","Organization ID":"","Key Alias":"","User ID":"","Sort By":"created_at","Sort Order":"desc"},[o,c]=(0,a.useState)(i),[d,u]=(0,a.useState)(l||[]),[m,g]=(0,a.useState)(s||[]),[x,h]=(0,a.useState)(t),y=(0,a.useRef)(0),f=(0,a.useCallback)(_()(async e=>{if(!n)return;let t=Date.now();y.current=t;try{let l=await (0,r.keyListCall)(n,e["Organization ID"]||null,e["Team ID"]||null,e["Key Alias"]||null,e["User ID"]||null,e["Key Hash"]||null,1,N.d,e["Sort By"]||null,e["Sort Order"]||null);t===y.current&&l&&(h(l.keys),console.log("called from debouncedSearch filters:",JSON.stringify(e)),console.log("called from debouncedSearch data:",JSON.stringify(l)))}catch(e){console.error("Error searching users:",e)}},300),[n]);(0,a.useEffect)(()=>{if(!t){h([]);return}let e=[...t];o["Team ID"]&&(e=e.filter(e=>e.team_id===o["Team ID"])),o["Organization ID"]&&(e=e.filter(e=>e.organization_id===o["Organization ID"])),h(e)},[t,o]),(0,a.useEffect)(()=>{let e=async()=>{let e=await (0,k.IE)(n);e.length>0&&u(e);let t=await (0,k.cT)(n);t.length>0&&g(t)};n&&e()},[n]);let p=(0,v.a)({queryKey:["allKeys"],queryFn:async()=>{if(!n)throw Error("Access token required");return await (0,k.LO)(n)},enabled:!!n}).data||[];return(0,a.useEffect)(()=>{l&&l.length>0&&u(e=>e.length{s&&s.length>0&&g(e=>e.length{c({"Team ID":e["Team ID"]||"","Organization ID":e["Organization ID"]||"","Key Alias":e["Key Alias"]||"","User ID":e["User ID"]||"","Sort By":e["Sort By"]||"created_at","Sort Order":e["Sort Order"]||"desc"}),f({...o,...e})},handleFilterReset:()=>{c(i),f(i)}}}({keys:t,teams:d,organizations:L,accessToken:y});(0,a.useEffect)(()=>{if(y){let e=t.map(e=>e.user_id).filter(e=>null!==e);(async()=>{W((await (0,r.userListCall)(y,e,1,100)).users)})()}},[y,t]),(0,a.useEffect)(()=>{if(z){let e=()=>{z()};return window.addEventListener("storage",e),()=>{window.removeEventListener("storage",e)}}},[z]);let ea=[{id:"expander",header:()=>null,cell:e=>{let{row:t}=e;return t.getCanExpand()?(0,s.jsx)("button",{onClick:t.getToggleExpandedHandler(),style:{cursor:"pointer"},children:t.getIsExpanded()?"ā–¼":"ā–¶"}):null}},{id:"token",accessorKey:"token",header:"Key ID",cell:e=>(0,s.jsx)("div",{className:"overflow-hidden",children:(0,s.jsx)(w.Z,{title:e.getValue(),children:(0,s.jsx)(p.z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate max-w-[200px]",onClick:()=>B(e.getValue()),children:e.getValue()?"".concat(e.getValue().slice(0,7),"..."):"-"})})})},{id:"key_alias",accessorKey:"key_alias",header:"Key Alias",cell:e=>{let t=e.getValue();return(0,s.jsx)(w.Z,{title:t,children:t?t.length>20?"".concat(t.slice(0,20),"..."):t:"-"})}},{id:"key_name",accessorKey:"key_name",header:"Secret Key",cell:e=>(0,s.jsx)("span",{className:"font-mono text-xs",children:e.getValue()})},{id:"team_alias",accessorKey:"team_id",header:"Team Alias",cell:e=>{let{row:t,getValue:l}=e,s=l(),a=null==d?void 0:d.find(e=>e.team_id===s);return(null==a?void 0:a.team_alias)||"Unknown"}},{id:"team_id",accessorKey:"team_id",header:"Team ID",cell:e=>(0,s.jsx)(w.Z,{title:e.getValue(),children:e.getValue()?"".concat(e.getValue().slice(0,7),"..."):"-"})},{id:"organization_id",accessorKey:"organization_id",header:"Organization ID",cell:e=>e.getValue()?e.renderValue():"-"},{id:"user_email",accessorKey:"user_id",header:"User Email",cell:e=>{let t=e.getValue(),l=J.find(e=>e.user_id===t);return(null==l?void 0:l.user_email)?(0,s.jsx)(w.Z,{title:null==l?void 0:l.user_email,children:(0,s.jsxs)("span",{children:[null==l?void 0:l.user_email.slice(0,20),"..."]})}):"-"}},{id:"user_id",accessorKey:"user_id",header:"User ID",cell:e=>{let t=e.getValue();return t&&t.length>15?(0,s.jsx)(w.Z,{title:t,children:(0,s.jsxs)("span",{children:[t.slice(0,7),"..."]})}):t||"-"}},{id:"created_at",accessorKey:"created_at",header:"Created At",cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleDateString():"-"}},{id:"created_by",accessorKey:"created_by",header:"Created By",cell:e=>{let t=e.getValue();return t&&t.length>15?(0,s.jsx)(w.Z,{title:t,children:(0,s.jsxs)("span",{children:[t.slice(0,7),"..."]})}):t}},{id:"updated_at",accessorKey:"updated_at",header:"Updated At",cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleDateString():"Never"}},{id:"expires",accessorKey:"expires",header:"Expires",cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleDateString():"Never"}},{id:"spend",accessorKey:"spend",header:"Spend (USD)",cell:e=>(0,C.pw)(e.getValue(),4)},{id:"max_budget",accessorKey:"max_budget",header:"Budget (USD)",cell:e=>{let t=e.getValue();return null===t?"Unlimited":"$".concat((0,C.pw)(t))}},{id:"budget_reset_at",accessorKey:"budget_reset_at",header:"Budget Reset",cell:e=>{let t=e.getValue();return t?new Date(t).toLocaleString():"Never"}},{id:"models",accessorKey:"models",header:"Models",cell:e=>{let t=e.getValue();return(0,s.jsx)("div",{className:"flex flex-col py-2",children:Array.isArray(t)?(0,s.jsx)("div",{className:"flex flex-col",children:0===t.length?(0,s.jsx)(O.C,{size:"xs",className:"mb-1",color:"red",children:(0,s.jsx)(O.x,{children:"All Proxy Models"})}):(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{className:"flex items-start",children:[t.length>3&&(0,s.jsx)("div",{children:(0,s.jsx)(Z.JO,{icon:G[e.row.id]?K.Z:E.Z,className:"cursor-pointer",size:"xs",onClick:()=>{X(t=>({...t,[e.row.id]:!t[e.row.id]}))}})}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-1",children:[t.slice(0,3).map((e,t)=>"all-proxy-models"===e?(0,s.jsx)(O.C,{size:"xs",color:"red",children:(0,s.jsx)(O.x,{children:"All Proxy Models"})},t):(0,s.jsx)(O.C,{size:"xs",color:"blue",children:(0,s.jsx)(O.x,{children:e.length>30?"".concat((0,m.W0)(e).slice(0,30),"..."):(0,m.W0)(e)})},t)),t.length>3&&!G[e.row.id]&&(0,s.jsx)(O.C,{size:"xs",color:"gray",className:"cursor-pointer",children:(0,s.jsxs)(O.x,{children:["+",t.length-3," ",t.length-3==1?"more model":"more models"]})}),G[e.row.id]&&(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:t.slice(3).map((e,t)=>"all-proxy-models"===e?(0,s.jsx)(O.C,{size:"xs",color:"red",children:(0,s.jsx)(O.x,{children:"All Proxy Models"})},t+3):(0,s.jsx)(O.C,{size:"xs",color:"blue",children:(0,s.jsx)(O.x,{children:e.length>30?"".concat((0,m.W0)(e).slice(0,30),"..."):(0,m.W0)(e)})},t+3))})]})]})})}):null})}},{id:"rate_limits",header:"Rate Limits",cell:e=>{let{row:t}=e,l=t.original;return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{children:["TPM: ",null!==l.tpm_limit?l.tpm_limit:"Unlimited"]}),(0,s.jsxs)("div",{children:["RPM: ",null!==l.rpm_limit?l.rpm_limit:"Unlimited"]})]})}}];console.log("keys: ".concat(JSON.stringify(t)));let er=(0,D.b7)({data:Q,columns:ea.filter(e=>"expander"!==e.id),state:{sorting:H},onSortingChange:e=>{let t="function"==typeof e?e(H):e;if(console.log("newSorting: ".concat(JSON.stringify(t))),q(t),t&&t.length>0){let e=t[0],l=e.id,s=e.desc?"desc":"asc";console.log("sortBy: ".concat(l,", sortOrder: ").concat(s)),el({...$,"Sort By":l,"Sort Order":s}),null==V||V(l,s)}},getCoreRowModel:(0,I.sC)(),getSortedRowModel:(0,I.tj)(),enableSorting:!0,manualSorting:!1});return a.useEffect(()=>{P&&q([{id:P.sortBy,desc:"desc"===P.sortOrder}])},[P]),(0,s.jsx)("div",{className:"w-full h-full overflow-hidden",children:M?(0,s.jsx)(j.Z,{keyId:M,onClose:()=>B(null),keyData:Q.find(e=>e.token===M),onKeyDataUpdate:e=>{l(t=>t.map(t=>t.token===e.token?(0,C.nl)(t,e):t)),z&&z()},onDelete:()=>{l(e=>e.filter(e=>e.token!==M)),z&&z()},accessToken:y,userID:f,userRole:S,teams:ee,premiumUser:R,setAccessToken:F}):(0,s.jsxs)("div",{className:"border-b py-4 flex-1 overflow-hidden",children:[(0,s.jsx)("div",{className:"w-full mb-6",children:(0,s.jsx)(b.Z,{options:[{name:"Team ID",label:"Team ID",isSearchable:!0,searchFn:async e=>ee&&0!==ee.length?ee.filter(t=>t.team_id.toLowerCase().includes(e.toLowerCase())||t.team_alias&&t.team_alias.toLowerCase().includes(e.toLowerCase())).map(e=>({label:"".concat(e.team_alias||e.team_id," (").concat(e.team_id,")"),value:e.team_id})):[]},{name:"Organization ID",label:"Organization ID",isSearchable:!0,searchFn:async e=>et&&0!==et.length?et.filter(t=>{var l,s;return null!==(s=null===(l=t.organization_id)||void 0===l?void 0:l.toLowerCase().includes(e.toLowerCase()))&&void 0!==s&&s}).filter(e=>null!==e.organization_id&&void 0!==e.organization_id).map(e=>({label:"".concat(e.organization_id||"Unknown"," (").concat(e.organization_id,")"),value:e.organization_id})):[]},{name:"Key Alias",label:"Key Alias",isSearchable:!0,searchFn:async e=>Y.filter(t=>t.toLowerCase().includes(e.toLowerCase())).map(e=>({label:e,value:e}))},{name:"User ID",label:"User ID",isSearchable:!1},{name:"Key Hash",label:"Key Hash",isSearchable:!1}],onApplyFilters:el,initialValues:$,onResetFilters:es})}),(0,s.jsxs)("div",{className:"flex items-center justify-between w-full mb-4",children:[(0,s.jsxs)("span",{className:"inline-flex text-sm text-gray-700",children:["Showing"," ",n?"...":"".concat((i.currentPage-1)*c+1," - ").concat(Math.min(i.currentPage*c,i.totalCount))," ","of ",n?"...":i.totalCount," results"]}),(0,s.jsxs)("div",{className:"inline-flex items-center gap-2",children:[(0,s.jsxs)("span",{className:"text-sm text-gray-700",children:["Page ",n?"...":i.currentPage," of ",n?"...":i.totalPages]}),(0,s.jsx)("button",{onClick:()=>o(i.currentPage-1),disabled:n||1===i.currentPage,className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),(0,s.jsx)("button",{onClick:()=>o(i.currentPage+1),disabled:n||i.currentPage===i.totalPages,className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]}),(0,s.jsx)("div",{className:"h-[75vh] overflow-auto",children:(0,s.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsxs)(Z.iA,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,s.jsx)(Z.ss,{children:er.getHeaderGroups().map(e=>(0,s.jsx)(Z.SC,{children:e.headers.map(e=>(0,s.jsx)(Z.xs,{className:"py-1 h-8 ".concat("actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""),onClick:e.column.getToggleSortingHandler(),children:(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,D.ie)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&(0,s.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,s.jsx)(A.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,s.jsx)(K.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,s.jsx)(T.Z,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,s.jsx)(Z.RM,{children:n?(0,s.jsx)(Z.SC,{children:(0,s.jsx)(Z.pj,{colSpan:ea.length,className:"h-8 text-center",children:(0,s.jsx)("div",{className:"text-center text-gray-500",children:(0,s.jsx)("p",{children:"\uD83D\uDE85 Loading keys..."})})})}):Q.length>0?er.getRowModel().rows.map(e=>(0,s.jsx)(Z.SC,{className:"h-8",children:e.getVisibleCells().map(e=>(0,s.jsx)(Z.pj,{style:{maxWidth:"8-x",whiteSpace:"pre-wrap",overflow:"hidden"},className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap ".concat("models"===e.column.id&&e.getValue().length>3?"px-0":""),children:(0,D.ie)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,s.jsx)(Z.SC,{children:(0,s.jsx)(Z.pj,{colSpan:ea.length,className:"h-8 text-center",children:(0,s.jsx)("div",{className:"text-center text-gray-500",children:(0,s.jsx)("p",{children:"No keys found"})})})})})]})})})})]})})}var U=l(9114),z=e=>{let{userID:t,userRole:l,accessToken:n,selectedTeam:i,setSelectedTeam:o,data:c,setData:p,teams:j,premiumUser:w,currentOrg:b,organizations:v,setCurrentOrg:k,selectedKeyAlias:S,setSelectedKeyAlias:_,createClicked:N,setAccessToken:C}=e,[D,I]=(0,a.useState)(!1),[Z,K]=(0,a.useState)(!1),[E,A]=(0,a.useState)(null),[T,O]=(0,a.useState)(""),[z,V]=(0,a.useState)(null),[P,R]=(0,a.useState)(null),[F,M]=(0,a.useState)((null==i?void 0:i.team_id)||"");(0,a.useEffect)(()=>{M((null==i?void 0:i.team_id)||"")},[i]);let{keys:B,isLoading:J,error:W,pagination:H,refresh:q,setKeys:G}=(0,f.Z)({selectedTeam:i||void 0,currentOrg:b,selectedKeyAlias:S,accessToken:n||"",createClicked:N}),[X,$]=(0,a.useState)(!1),[Q,Y]=(0,a.useState)(!1),[ee,et]=(0,a.useState)(null),[el,es]=(0,a.useState)([]),ea=new Set,[er,en]=(0,a.useState)(!1),[ei,eo]=(0,a.useState)(!1),[ec,ed]=(0,a.useState)(null),[eu,em]=(0,a.useState)(null),[eg]=g.Z.useForm(),[ex,eh]=(0,a.useState)(null),[ey,ef]=(0,a.useState)(ea),[ep,ej]=(0,a.useState)([]);(0,a.useEffect)(()=>{console.log("in calculateNewExpiryTime for selectedToken",ee),(null==eu?void 0:eu.duration)?eh((e=>{if(!e)return null;try{let t;let l=new Date;if(e.endsWith("s"))t=(0,d.I)(l,{seconds:parseInt(e)});else if(e.endsWith("h"))t=(0,d.I)(l,{hours:parseInt(e)});else if(e.endsWith("d"))t=(0,d.I)(l,{days:parseInt(e)});else throw Error("Invalid duration format");return t.toLocaleString("en-US",{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!0})}catch(e){return null}})(eu.duration)):eh(null),console.log("calculateNewExpiryTime:",ex)},[ee,null==eu?void 0:eu.duration]),(0,a.useEffect)(()=>{(async()=>{try{if(null===t||null===l||null===n)return;let e=await (0,m.K2)(t,l,n);e&&es(e)}catch(e){U.Z.error({description:"Error fetching user models"})}})()},[n,t,l]),(0,a.useEffect)(()=>{if(j){let e=new Set;j.forEach((t,l)=>{let s=t.team_id;e.add(s)}),ef(e)}},[j]);let ew=async()=>{if(null!=E&&null!=B){try{if(!n)return;await (0,r.keyDeleteCall)(n,E);let e=B.filter(e=>e.token!==E);G(e)}catch(e){U.Z.error({description:"Error deleting the key"})}K(!1),A(null),O("")}},eb=()=>{K(!1),A(null),O("")},ev=(e,t)=>{em(l=>({...l,[e]:t}))},ek=async()=>{if(!w){U.Z.warning({description:"Regenerate Virtual Key is an Enterprise feature. Please upgrade to use this feature."});return}if(null!=ee)try{let e=await eg.validateFields();if(!n)return;let t=await (0,r.regenerateKeyCall)(n,ee.token||ee.token_id,e);if(ed(t.key),c){let l=c.map(l=>l.token===(null==ee?void 0:ee.token)?{...l,key_name:t.key_name,...e}:l);p(l)}eo(!1),eg.resetFields(),U.Z.success({description:"Virtual Key regenerated successfully"})}catch(e){console.error("Error regenerating key:",e),U.Z.error({description:"Failed to regenerate Virtual Key"})}};return(0,s.jsxs)("div",{children:[(0,s.jsx)(L,{keys:B,setKeys:G,isLoading:J,pagination:H,onPageChange:e=>{q({page:e})},pageSize:100,teams:j,selectedTeam:i,setSelectedTeam:o,accessToken:n,userID:t,userRole:l,organizations:v,setCurrentOrg:k,refresh:q,selectedKeyAlias:S,setSelectedKeyAlias:_,premiumUser:w,setAccessToken:C}),Z&&(()=>{let e=null==B?void 0:B.find(e=>e.token===E),t=(null==e?void 0:e.key_alias)||(null==e?void 0:e.token_id)||E,l=T===t;return(0,s.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:(0,s.jsxs)("div",{className:"bg-white rounded-lg shadow-xl w-full max-w-2xl min-h-[380px] py-6 overflow-hidden transform transition-all flex flex-col justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200",children:[(0,s.jsx)("h3",{className:"text-lg font-semibold text-gray-900",children:"Delete Key"}),(0,s.jsx)("button",{onClick:()=>{eb(),O("")},className:"text-gray-400 hover:text-gray-500 focus:outline-none",children:(0,s.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,s.jsxs)("div",{className:"px-6 py-4",children:[(0,s.jsxs)("div",{className:"flex items-start gap-3 p-4 bg-red-50 border border-red-100 rounded-md mb-5",children:[(0,s.jsx)("div",{className:"text-red-500 mt-0.5",children:(0,s.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.082 16.5c-.77.833.192 2.5 1.732 2.5z"})})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-base font-medium text-red-600",children:"Warning: You are about to delete this Virtual Key."}),(0,s.jsx)("p",{className:"text-base text-red-600 mt-2",children:"This action is irreversible and will immediately revoke access for any applications using this key."})]})]}),(0,s.jsx)("p",{className:"text-base text-gray-600 mb-5",children:"Are you sure you want to delete this Virtual Key?"}),(0,s.jsxs)("div",{className:"mb-5",children:[(0,s.jsxs)("label",{className:"block text-base font-medium text-gray-700 mb-2",children:["Type ",(0,s.jsx)("span",{className:"underline",children:t})," to confirm deletion:"]}),(0,s.jsx)("input",{type:"text",value:T,onChange:e=>O(e.target.value),placeholder:"Enter key name exactly",className:"w-full px-4 py-3 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-base",autoFocus:!0})]})]})]}),(0,s.jsxs)("div",{className:"px-6 py-4 bg-gray-50 flex justify-end gap-4",children:[(0,s.jsx)("button",{onClick:()=>{eb(),O("")},className:"px-5 py-3 bg-white border border-gray-300 rounded-md text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:"Cancel"}),(0,s.jsx)("button",{onClick:ew,disabled:!l,className:"px-5 py-3 rounded-md text-base font-medium text-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 ".concat(l?"bg-red-600 hover:bg-red-700":"bg-red-300 cursor-not-allowed"),children:"Delete Virtual Key"})]})]})})})(),(0,s.jsx)(x.Z,{title:"Regenerate Virtual Key",visible:ei,onCancel:()=>{eo(!1),eg.resetFields()},footer:[(0,s.jsx)(u.zx,{onClick:()=>{eo(!1),eg.resetFields()},className:"mr-2",children:"Cancel"},"cancel"),(0,s.jsx)(u.zx,{onClick:ek,disabled:!w,children:w?"Regenerate":"Upgrade to Regenerate"},"regenerate")],children:w?(0,s.jsxs)(g.Z,{form:eg,layout:"vertical",onValuesChange:(e,t)=>{"duration"in e&&ev("duration",e.duration)},children:[(0,s.jsx)(g.Z.Item,{name:"key_alias",label:"Key Alias",children:(0,s.jsx)(u.oi,{disabled:!0})}),(0,s.jsx)(g.Z.Item,{name:"max_budget",label:"Max Budget (USD)",children:(0,s.jsx)(h.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,s.jsx)(g.Z.Item,{name:"tpm_limit",label:"TPM Limit",children:(0,s.jsx)(h.Z,{style:{width:"100%"}})}),(0,s.jsx)(g.Z.Item,{name:"rpm_limit",label:"RPM Limit",children:(0,s.jsx)(h.Z,{style:{width:"100%"}})}),(0,s.jsx)(g.Z.Item,{name:"duration",label:"Expire Key (eg: 30s, 30h, 30d)",className:"mt-8",children:(0,s.jsx)(u.oi,{placeholder:""})}),(0,s.jsxs)("div",{className:"mt-2 text-sm text-gray-500",children:["Current expiry:"," ",(null==ee?void 0:ee.expires)!=null?new Date(ee.expires).toLocaleString():"Never"]}),ex&&(0,s.jsxs)("div",{className:"mt-2 text-sm text-green-600",children:["New expiry: ",ex]})]}):(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-gray-500 italic text-[12px]",children:"Upgrade to use this feature"}),(0,s.jsx)(u.zx,{variant:"primary",className:"mb-2",children:(0,s.jsx)("a",{href:"https://calendly.com/d/4mp-gd3-k5k/litellm-1-1-onboarding-chat",target:"_blank",children:"Get Free Trial"})})]})}),ec&&(0,s.jsx)(x.Z,{visible:!!ec,onCancel:()=>ed(null),footer:[(0,s.jsx)(u.zx,{onClick:()=>ed(null),children:"Close"},"close")],children:(0,s.jsxs)(u.rj,{numItems:1,className:"gap-2 w-full",children:[(0,s.jsx)(u.Dx,{children:"Regenerated Key"}),(0,s.jsx)(u.JX,{numColSpan:1,children:(0,s.jsxs)("p",{children:["Please replace your old key with the new key generated. For security reasons,"," ",(0,s.jsx)("b",{children:"you will not be able to view it again"})," through your LiteLLM account. If you lose this secret key, you will need to generate a new one."]})}),(0,s.jsxs)(u.JX,{numColSpan:1,children:[(0,s.jsx)(u.xv,{className:"mt-3",children:"Key Alias:"}),(0,s.jsx)("div",{style:{background:"#f8f8f8",padding:"10px",borderRadius:"5px",marginBottom:"10px"},children:(0,s.jsx)("pre",{style:{wordWrap:"break-word",whiteSpace:"normal"},children:(null==ee?void 0:ee.key_alias)||"No alias set"})}),(0,s.jsx)(u.xv,{className:"mt-3",children:"New Virtual Key:"}),(0,s.jsx)("div",{style:{background:"#f8f8f8",padding:"10px",borderRadius:"5px",marginBottom:"10px"},children:(0,s.jsx)("pre",{style:{wordWrap:"break-word",whiteSpace:"normal"},children:ec})}),(0,s.jsx)(y.CopyToClipboard,{text:ec,onCopy:()=>U.Z.success({description:"Virtual Key copied to clipboard"}),children:(0,s.jsx)(u.zx,{className:"mt-3",children:"Copy Virtual Key"})})]})]})})]})},V=l(12011),P=l(99376),R=l(14474),F=l(57840),M=l(3914),B=e=>{let{userID:t,userRole:l,teams:d,keys:u,setUserRole:m,userEmail:g,setUserEmail:x,setTeams:h,setKeys:y,premiumUser:f,organizations:p,addKey:j,createClicked:w}=e,[b,v]=(0,a.useState)(null),[k,S]=(0,a.useState)(null),_=(0,P.useSearchParams)(),N=function(e){console.log("COOKIES",document.cookie);let t=document.cookie.split("; ").find(t=>t.startsWith(e+"="));return t?t.split("=")[1]:null}("token"),C=_.get("invitation_id"),[D,I]=(0,a.useState)(null),[Z,K]=(0,a.useState)(null),[E,A]=(0,a.useState)([]),[T,O]=(0,a.useState)(null),[L,U]=(0,a.useState)(null),[B,J]=(0,a.useState)(null);if(window.addEventListener("beforeunload",function(){sessionStorage.clear()}),(0,a.useEffect)(()=>{if(N){let e=(0,R.o)(N);if(e){if(console.log("Decoded token:",e),console.log("Decoded key:",e.key),I(e.key),e.user_role){let t=function(e){if(!e)return"Undefined Role";switch(console.log("Received user role: ".concat(e)),e.toLowerCase()){case"app_owner":case"demo_app_owner":return"App Owner";case"app_admin":case"proxy_admin":return"Admin";case"proxy_admin_viewer":return"Admin Viewer";case"app_user":return"App User";case"internal_user":return"Internal User";case"internal_user_viewer":return"Internal Viewer";default:return"Unknown Role"}}(e.user_role);console.log("Decoded user_role:",t),m(t)}else console.log("User role not defined");e.user_email?x(e.user_email):console.log("User Email is not set ".concat(e))}}if(t&&D&&l&&!u&&!b){let e=sessionStorage.getItem("userModels"+t);e?A(JSON.parse(e)):(console.log("currentOrg: ".concat(JSON.stringify(k))),(async()=>{try{let e=await (0,r.getProxyUISettings)(D);O(e);let s=await (0,r.userInfoCall)(D,t,l,!1,null,null);v(s.user_info),console.log("userSpendData: ".concat(JSON.stringify(b))),(null==s?void 0:s.teams[0].keys)?y(s.keys.concat(s.teams.filter(e=>"Admin"===l||e.user_id===t).flatMap(e=>e.keys))):y(s.keys),sessionStorage.setItem("userData"+t,JSON.stringify(s.keys)),sessionStorage.setItem("userSpendData"+t,JSON.stringify(s.user_info));let a=(await (0,r.modelAvailableCall)(D,t,l)).data.map(e=>e.id);console.log("available_model_names:",a),A(a),console.log("userModels:",E),sessionStorage.setItem("userModels"+t,JSON.stringify(a))}catch(e){console.error("There was an error fetching the data",e),e.message.includes("Invalid proxy server token passed")&&W()}})(),(0,n.Z)(D,t,l,k,h))}},[t,N,D,u,l]),(0,a.useEffect)(()=>{D&&(async()=>{try{let e=await (0,r.keyInfoCall)(D,[D]);console.log("keyInfo: ",e)}catch(e){e.message.includes("Invalid proxy server token passed")&&W()}})()},[D]),(0,a.useEffect)(()=>{console.log("currentOrg: ".concat(JSON.stringify(k),", accessToken: ").concat(D,", userID: ").concat(t,", userRole: ").concat(l)),D&&(console.log("fetching teams"),(0,n.Z)(D,t,l,k,h))},[k]),(0,a.useEffect)(()=>{if(null!==u&&null!=L&&null!==L.team_id){let e=0;for(let t of(console.log("keys: ".concat(JSON.stringify(u))),u))L.hasOwnProperty("team_id")&&null!==t.team_id&&t.team_id===L.team_id&&(e+=t.spend);console.log("sum: ".concat(e)),K(e)}else if(null!==u){let e=0;for(let t of u)e+=t.spend;K(e)}},[L]),null!=C)return(0,s.jsx)(V.default,{});function W(){(0,M.b)();let e=(0,r.getProxyBaseUrl)();console.log("proxyBaseUrl:",e);let t=e?"".concat(e,"/sso/key/generate"):"/sso/key/generate";return console.log("Full URL:",t),window.location.href=t,null}if(null==N)return console.log("All cookies before redirect:",document.cookie),W(),null;try{let e=(0,R.o)(N);console.log("Decoded token:",e);let t=e.exp,l=Math.floor(Date.now()/1e3);if(t&&l>=t)return console.log("Token expired, redirecting to login"),W(),null}catch(e){return console.error("Error decoding token:",e),(0,M.b)(),W(),null}if(null==D)return null;if(null==t)return(0,s.jsx)("h1",{children:"User ID is not set"});if(null==l&&m("App Owner"),l&&"Admin Viewer"==l){let{Title:e,Paragraph:t}=F.default;return(0,s.jsxs)("div",{children:[(0,s.jsx)(e,{level:1,children:"Access Denied"}),(0,s.jsx)(t,{children:"Ask your proxy admin for access to create keys"})]})}return console.log("inside user dashboard, selected team",L),console.log("All cookies after redirect:",document.cookie),(0,s.jsx)("div",{className:"w-full mx-4 h-[75vh]",children:(0,s.jsx)(o.Z,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:(0,s.jsxs)(i.Z,{numColSpan:1,className:"flex flex-col gap-2",children:[(0,s.jsx)(c.ZP,{userID:t,team:L,teams:d,userRole:l,accessToken:D,data:u,addKey:j,premiumUser:f},L?L.team_id:null),(0,s.jsx)(z,{userID:t,userRole:l,accessToken:D,selectedTeam:L||null,setSelectedTeam:U,selectedKeyAlias:B,setSelectedKeyAlias:J,data:u,setData:y,premiumUser:f,teams:d,currentOrg:k,setCurrentOrg:S,organizations:p,createClicked:w,setAccessToken:I})]})})})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1971-00859360d0630018.js b/litellm/proxy/_experimental/out/_next/static/chunks/1971-00859360d0630018.js new file mode 100644 index 00000000000..65bd9b529a2 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1971-00859360d0630018.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1971,5945],{58747:function(e,t,r){r.d(t,{Z:function(){return o}});var n=r(5853),a=r(2265);let o=e=>{var t=(0,n._T)(e,[]);return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),a.createElement("path",{d:"M11.9999 13.1714L16.9497 8.22168L18.3639 9.63589L11.9999 15.9999L5.63599 9.63589L7.0502 8.22168L11.9999 13.1714Z"}))}},4537:function(e,t,r){r.d(t,{Z:function(){return o}});var n=r(5853),a=r(2265);let o=e=>{var t=(0,n._T)(e,[]);return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),a.createElement("path",{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 10.5858L9.17157 7.75736L7.75736 9.17157L10.5858 12L7.75736 14.8284L9.17157 16.2426L12 13.4142L14.8284 16.2426L16.2426 14.8284L13.4142 12L16.2426 9.17157L14.8284 7.75736L12 10.5858Z"}))}},30150:function(e,t,r){r.d(t,{Z:function(){return h}});var n=r(5853),a=r(2265);let o=e=>{var t=(0,n._T)(e,[]);return a.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),a.createElement("path",{d:"M12 4v16m8-8H4"}))},i=e=>{var t=(0,n._T)(e,[]);return a.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),a.createElement("path",{d:"M20 12H4"}))};var s=r(13241),l=r(1153),c=r(69262);let u="flex mx-auto text-tremor-content-subtle dark:text-dark-tremor-content-subtle",d="cursor-pointer hover:text-tremor-content dark:hover:text-dark-tremor-content",h=a.forwardRef((e,t)=>{let{onSubmit:r,enableStepper:h=!0,disabled:m,onValueChange:f,onChange:p}=e,b=(0,n._T)(e,["onSubmit","enableStepper","disabled","onValueChange","onChange"]),g=(0,a.useRef)(null),[v,y]=a.useState(!1),w=a.useCallback(()=>{y(!0)},[]),x=a.useCallback(()=>{y(!1)},[]),[E,C]=a.useState(!1),O=a.useCallback(()=>{C(!0)},[]),k=a.useCallback(()=>{C(!1)},[]);return a.createElement(c.Z,Object.assign({type:"number",ref:(0,l.lq)([g,t]),disabled:m,makeInputClassName:(0,l.fn)("NumberInput"),onKeyDown:e=>{var t;if("Enter"===e.key&&!e.ctrlKey&&!e.altKey&&!e.shiftKey){let e=null===(t=g.current)||void 0===t?void 0:t.value;null==r||r(parseFloat(null!=e?e:""))}"ArrowDown"===e.key&&w(),"ArrowUp"===e.key&&O()},onKeyUp:e=>{"ArrowDown"===e.key&&x(),"ArrowUp"===e.key&&k()},onChange:e=>{m||(null==f||f(parseFloat(e.target.value)),null==p||p(e))},stepper:h?a.createElement("div",{className:(0,s.q)("flex justify-center align-middle")},a.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;m||(null===(e=g.current)||void 0===e||e.stepDown(),null===(t=g.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,s.q)(!m&&d,u,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},a.createElement(i,{"data-testid":"step-down",className:(v?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"})),a.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;m||(null===(e=g.current)||void 0===e||e.stepUp(),null===(t=g.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,s.q)(!m&&d,u,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},a.createElement(o,{"data-testid":"step-up",className:(E?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"}))):null},b))});h.displayName="NumberInput"},27281:function(e,t,r){r.d(t,{Z:function(){return f}});var n=r(5853),a=r(58747),o=r(2265),i=r(4537),s=r(13241),l=r(1153),c=r(96398),u=r(51975),d=r(85238),h=r(44140);let m=(0,l.fn)("Select"),f=o.forwardRef((e,t)=>{let{defaultValue:r="",value:l,onValueChange:f,placeholder:p="Select...",disabled:b=!1,icon:g,enableClear:v=!1,required:y,children:w,name:x,error:E=!1,errorMessage:C,className:O,id:k}=e,S=(0,n._T)(e,["defaultValue","value","onValueChange","placeholder","disabled","icon","enableClear","required","children","name","error","errorMessage","className","id"]),P=(0,o.useRef)(null),N=o.Children.toArray(w),[T,q]=(0,h.Z)(r,l),M=(0,o.useMemo)(()=>{let e=o.Children.toArray(w).filter(o.isValidElement);return(0,c.sl)(e)},[w]);return o.createElement("div",{className:(0,s.q)("w-full min-w-[10rem] text-tremor-default",O)},o.createElement("div",{className:"relative"},o.createElement("select",{title:"select-hidden",required:y,className:(0,s.q)("h-full w-full absolute left-0 top-0 -z-10 opacity-0"),value:T,onChange:e=>{e.preventDefault()},name:x,disabled:b,id:k,onFocus:()=>{let e=P.current;e&&e.focus()}},o.createElement("option",{className:"hidden",value:"",disabled:!0,hidden:!0},p),N.map(e=>{let t=e.props.value,r=e.props.children;return o.createElement("option",{className:"hidden",key:t,value:t},r)})),o.createElement(u.Ri,Object.assign({as:"div",ref:t,defaultValue:T,value:T,onChange:e=>{null==f||f(e),q(e)},disabled:b,id:k},S),e=>{var t;let{value:r}=e;return o.createElement(o.Fragment,null,o.createElement(u.Y4,{ref:P,className:(0,s.q)("w-full outline-none text-left whitespace-nowrap truncate rounded-tremor-default focus:ring-2 transition duration-100 border pr-8 py-2","border-tremor-border shadow-tremor-input focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:border-dark-tremor-border dark:shadow-dark-tremor-input dark:focus:border-dark-tremor-brand-subtle dark:focus:ring-dark-tremor-brand-muted",g?"pl-10":"pl-3",(0,c.um)((0,c.Uh)(r),b,E))},g&&o.createElement("span",{className:(0,s.q)("absolute inset-y-0 left-0 flex items-center ml-px pl-2.5")},o.createElement(g,{className:(0,s.q)(m("Icon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})),o.createElement("span",{className:"w-[90%] block truncate"},r&&null!==(t=M.get(r))&&void 0!==t?t:p),o.createElement("span",{className:(0,s.q)("absolute inset-y-0 right-0 flex items-center mr-3")},o.createElement(a.Z,{className:(0,s.q)(m("arrowDownIcon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}))),v&&T?o.createElement("button",{type:"button",className:(0,s.q)("absolute inset-y-0 right-0 flex items-center mr-8"),onClick:e=>{e.preventDefault(),q(""),null==f||f("")}},o.createElement(i.Z,{className:(0,s.q)(m("clearIcon"),"flex-none h-4 w-4","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})):null,o.createElement(d.u,{enter:"transition ease duration-100 transform",enterFrom:"opacity-0 -translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"transition ease duration-100 transform",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-4"},o.createElement(u.O_,{anchor:"bottom start",className:(0,s.q)("z-10 w-[var(--button-width)] divide-y overflow-y-auto outline-none rounded-tremor-default max-h-[228px] border [--anchor-gap:4px]","bg-tremor-background border-tremor-border divide-tremor-border shadow-tremor-dropdown","dark:bg-dark-tremor-background dark:border-dark-tremor-border dark:divide-dark-tremor-border dark:shadow-dark-tremor-dropdown")},w)))})),E&&C?o.createElement("p",{className:(0,s.q)("errorMessage","text-sm text-rose-500 mt-1")},C):null)});f.displayName="Select"},16853:function(e,t,r){r.d(t,{Z:function(){return u}});var n=r(5853),a=r(96398),o=r(44140),i=r(2265),s=r(13241),l=r(1153);let c=(0,l.fn)("Textarea"),u=i.forwardRef((e,t)=>{let{value:r,defaultValue:u="",placeholder:d="Type...",error:h=!1,errorMessage:m,disabled:f=!1,className:p,onChange:b,onValueChange:g,autoHeight:v=!1}=e,y=(0,n._T)(e,["value","defaultValue","placeholder","error","errorMessage","disabled","className","onChange","onValueChange","autoHeight"]),[w,x]=(0,o.Z)(u,r),E=(0,i.useRef)(null),C=(0,a.Uh)(w);return(0,i.useEffect)(()=>{let e=E.current;if(v&&e){e.style.height="60px";let t=e.scrollHeight;e.style.height=t+"px"}},[v,E,w]),i.createElement(i.Fragment,null,i.createElement("textarea",Object.assign({ref:(0,l.lq)([E,t]),value:w,placeholder:d,disabled:f,className:(0,s.q)(c("Textarea"),"w-full flex items-center outline-none rounded-tremor-default px-3 py-2 text-tremor-default focus:ring-2 transition duration-100 border","shadow-tremor-input focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:shadow-dark-tremor-input focus:dark:border-dark-tremor-brand-subtle focus:dark:ring-dark-tremor-brand-muted",(0,a.um)(C,f,h),f?"placeholder:text-tremor-content-subtle dark:placeholder:text-dark-tremor-content-subtle":"placeholder:text-tremor-content dark:placeholder:text-dark-tremor-content",p),"data-testid":"text-area",onChange:e=>{null==b||b(e),x(e.target.value),null==g||g(e.target.value)}},y)),h&&m?i.createElement("p",{className:(0,s.q)(c("errorMessage"),"text-sm text-red-500 mt-1")},m):null)});u.displayName="Textarea"},87452:function(e,t,r){r.d(t,{Z:function(){return d},r:function(){return u}});var n=r(5853),a=r(91054);r(42698),r(64016);var o=r(8710);r(33232);var i=r(13241),s=r(1153),l=r(2265);let c=(0,s.fn)("Accordion"),u=(0,l.createContext)({isOpen:!1}),d=l.forwardRef((e,t)=>{var r;let{defaultOpen:s=!1,children:d,className:h}=e,m=(0,n._T)(e,["defaultOpen","children","className"]),f=null!==(r=(0,l.useContext)(o.Z))&&void 0!==r?r:(0,i.q)("rounded-tremor-default border");return l.createElement(a.pJ,Object.assign({as:"div",ref:t,className:(0,i.q)(c("root"),"overflow-hidden","bg-tremor-background border-tremor-border","dark:bg-dark-tremor-background dark:border-dark-tremor-border",f,h),defaultOpen:s},m),e=>{let{open:t}=e;return l.createElement(u.Provider,{value:{isOpen:t}},d)})});d.displayName="Accordion"},88829:function(e,t,r){r.d(t,{Z:function(){return l}});var n=r(5853),a=r(2265),o=r(91054),i=r(13241);let s=(0,r(1153).fn)("AccordionBody"),l=a.forwardRef((e,t)=>{let{children:r,className:l}=e,c=(0,n._T)(e,["children","className"]);return a.createElement(o.pJ.Panel,Object.assign({ref:t,className:(0,i.q)(s("root"),"w-full text-tremor-default px-4 pb-3","text-tremor-content","dark:text-dark-tremor-content",l)},c),r)});l.displayName="AccordionBody"},72208:function(e,t,r){r.d(t,{Z:function(){return u}});var n=r(5853),a=r(2265),o=r(91054);let i=e=>{var t=(0,n._T)(e,[]);return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),a.createElement("path",{d:"M11.9999 10.8284L7.0502 15.7782L5.63599 14.364L11.9999 8L18.3639 14.364L16.9497 15.7782L11.9999 10.8284Z"}))};var s=r(87452),l=r(13241);let c=(0,r(1153).fn)("AccordionHeader"),u=a.forwardRef((e,t)=>{let{children:r,className:u}=e,d=(0,n._T)(e,["children","className"]),{isOpen:h}=(0,a.useContext)(s.r);return a.createElement(o.pJ.Button,Object.assign({ref:t,className:(0,l.q)(c("root"),"w-full flex items-center justify-between px-4 py-3","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis",u)},d),a.createElement("div",{className:(0,l.q)(c("children"),"flex flex-1 text-inherit mr-4")},r),a.createElement("div",null,a.createElement(i,{className:(0,l.q)(c("arrowIcon"),"h-5 w-5 -mr-1","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle",h?"transition-all":"transition-all -rotate-180")})))});u.displayName="AccordionHeader"},67982:function(e,t,r){r.d(t,{Z:function(){return l}});var n=r(5853),a=r(13241),o=r(1153),i=r(2265);let s=(0,o.fn)("Divider"),l=i.forwardRef((e,t)=>{let{className:r,children:o}=e,l=(0,n._T)(e,["className","children"]);return i.createElement("div",Object.assign({ref:t,className:(0,a.q)(s("root"),"w-full mx-auto my-6 flex justify-between gap-3 items-center text-tremor-default","text-tremor-content","dark:text-dark-tremor-content",r)},l),o?i.createElement(i.Fragment,null,i.createElement("div",{className:(0,a.q)("w-full h-[1px] bg-tremor-border dark:bg-dark-tremor-border")}),i.createElement("div",{className:(0,a.q)("text-inherit whitespace-nowrap")},o),i.createElement("div",{className:(0,a.q)("w-full h-[1px] bg-tremor-border dark:bg-dark-tremor-border")})):i.createElement("div",{className:(0,a.q)("w-full h-[1px] bg-tremor-border dark:bg-dark-tremor-border")}))});l.displayName="Divider"},44140:function(e,t,r){r.d(t,{Z:function(){return a}});var n=r(2265);let a=(e,t)=>{let r=void 0!==t,[a,o]=(0,n.useState)(e);return[r?t:a,e=>{r||o(e)}]}},5945:function(e,t,r){r.d(t,{Z:function(){return M}});var n=r(2265),a=r(36760),o=r.n(a),i=r(18694),s=r(71744),l=r(33759),c=r(50337),u=r(65869),d=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,n=Object.getOwnPropertySymbols(e);at.indexOf(n[a])&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r},h=e=>{var{prefixCls:t,className:r,hoverable:a=!0}=e,i=d(e,["prefixCls","className","hoverable"]);let{getPrefixCls:l}=n.useContext(s.E_),c=l("card",t),u=o()("".concat(c,"-grid"),r,{["".concat(c,"-grid-hoverable")]:a});return n.createElement("div",Object.assign({},i,{className:u}))},m=r(93463),f=r(12918),p=r(99320),b=r(71140);let g=e=>{let{antCls:t,componentCls:r,headerHeight:n,headerPadding:a,tabsMarginBottom:o}=e;return Object.assign(Object.assign({display:"flex",justifyContent:"center",flexDirection:"column",minHeight:n,marginBottom:-1,padding:"0 ".concat((0,m.bf)(a)),color:e.colorTextHeading,fontWeight:e.fontWeightStrong,fontSize:e.headerFontSize,background:e.headerBg,borderBottom:"".concat((0,m.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorderSecondary),borderRadius:"".concat((0,m.bf)(e.borderRadiusLG)," ").concat((0,m.bf)(e.borderRadiusLG)," 0 0")},(0,f.dF)()),{"&-wrapper":{width:"100%",display:"flex",alignItems:"center"},"&-title":Object.assign(Object.assign({display:"inline-block",flex:1},f.vS),{["\n > ".concat(r,"-typography,\n > ").concat(r,"-typography-edit-content\n ")]:{insetInlineStart:0,marginTop:0,marginBottom:0}}),["".concat(t,"-tabs-top")]:{clear:"both",marginBottom:o,color:e.colorText,fontWeight:"normal",fontSize:e.fontSize,"&-bar":{borderBottom:"".concat((0,m.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorderSecondary)}}})},v=e=>{let{cardPaddingBase:t,colorBorderSecondary:r,cardShadow:n,lineWidth:a}=e;return{width:"33.33%",padding:t,border:0,borderRadius:0,boxShadow:"\n ".concat((0,m.bf)(a)," 0 0 0 ").concat(r,",\n 0 ").concat((0,m.bf)(a)," 0 0 ").concat(r,",\n ").concat((0,m.bf)(a)," ").concat((0,m.bf)(a)," 0 0 ").concat(r,",\n ").concat((0,m.bf)(a)," 0 0 0 ").concat(r," inset,\n 0 ").concat((0,m.bf)(a)," 0 0 ").concat(r," inset;\n "),transition:"all ".concat(e.motionDurationMid),"&-hoverable:hover":{position:"relative",zIndex:1,boxShadow:n}}},y=e=>{let{componentCls:t,iconCls:r,actionsLiMargin:n,cardActionsIconSize:a,colorBorderSecondary:o,actionsBg:i}=e;return Object.assign(Object.assign({margin:0,padding:0,listStyle:"none",background:i,borderTop:"".concat((0,m.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(o),display:"flex",borderRadius:"0 0 ".concat((0,m.bf)(e.borderRadiusLG)," ").concat((0,m.bf)(e.borderRadiusLG))},(0,f.dF)()),{"& > li":{margin:n,color:e.colorTextDescription,textAlign:"center","> span":{position:"relative",display:"block",minWidth:e.calc(e.cardActionsIconSize).mul(2).equal(),fontSize:e.fontSize,lineHeight:e.lineHeight,cursor:"pointer","&:hover":{color:e.colorPrimary,transition:"color ".concat(e.motionDurationMid)},["a:not(".concat(t,"-btn), > ").concat(r)]:{display:"inline-block",width:"100%",color:e.colorIcon,lineHeight:(0,m.bf)(e.fontHeight),transition:"color ".concat(e.motionDurationMid),"&:hover":{color:e.colorPrimary}},["> ".concat(r)]:{fontSize:a,lineHeight:(0,m.bf)(e.calc(a).mul(e.lineHeight).equal())}},"&:not(:last-child)":{borderInlineEnd:"".concat((0,m.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(o)}}})},w=e=>Object.assign(Object.assign({margin:"".concat((0,m.bf)(e.calc(e.marginXXS).mul(-1).equal())," 0"),display:"flex"},(0,f.dF)()),{"&-avatar":{paddingInlineEnd:e.padding},"&-detail":{overflow:"hidden",flex:1,"> div:not(:last-child)":{marginBottom:e.marginXS}},"&-title":Object.assign({color:e.colorTextHeading,fontWeight:e.fontWeightStrong,fontSize:e.fontSizeLG},f.vS),"&-description":{color:e.colorTextDescription}}),x=e=>{let{componentCls:t,colorFillAlter:r,headerPadding:n,bodyPadding:a}=e;return{["".concat(t,"-head")]:{padding:"0 ".concat((0,m.bf)(n)),background:r,"&-title":{fontSize:e.fontSize}},["".concat(t,"-body")]:{padding:"".concat((0,m.bf)(e.padding)," ").concat((0,m.bf)(a))}}},E=e=>{let{componentCls:t}=e;return{overflow:"hidden",["".concat(t,"-body")]:{userSelect:"none"}}},C=e=>{let{componentCls:t,cardShadow:r,cardHeadPadding:n,colorBorderSecondary:a,boxShadowTertiary:o,bodyPadding:i,extraColor:s}=e;return{[t]:Object.assign(Object.assign({},(0,f.Wf)(e)),{position:"relative",background:e.colorBgContainer,borderRadius:e.borderRadiusLG,["&:not(".concat(t,"-bordered)")]:{boxShadow:o},["".concat(t,"-head")]:g(e),["".concat(t,"-extra")]:{marginInlineStart:"auto",color:s,fontWeight:"normal",fontSize:e.fontSize},["".concat(t,"-body")]:{padding:i,borderRadius:"0 0 ".concat((0,m.bf)(e.borderRadiusLG)," ").concat((0,m.bf)(e.borderRadiusLG))},["".concat(t,"-grid")]:v(e),["".concat(t,"-cover")]:{"> *":{display:"block",width:"100%",borderRadius:"".concat((0,m.bf)(e.borderRadiusLG)," ").concat((0,m.bf)(e.borderRadiusLG)," 0 0")}},["".concat(t,"-actions")]:y(e),["".concat(t,"-meta")]:w(e)}),["".concat(t,"-bordered")]:{border:"".concat((0,m.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(a),["".concat(t,"-cover")]:{marginTop:-1,marginInlineStart:-1,marginInlineEnd:-1}},["".concat(t,"-hoverable")]:{cursor:"pointer",transition:"box-shadow ".concat(e.motionDurationMid,", border-color ").concat(e.motionDurationMid),"&:hover":{borderColor:"transparent",boxShadow:r}},["".concat(t,"-contain-grid")]:{borderRadius:"".concat((0,m.bf)(e.borderRadiusLG)," ").concat((0,m.bf)(e.borderRadiusLG)," 0 0 "),["".concat(t,"-body")]:{display:"flex",flexWrap:"wrap"},["&:not(".concat(t,"-loading) ").concat(t,"-body")]:{marginBlockStart:e.calc(e.lineWidth).mul(-1).equal(),marginInlineStart:e.calc(e.lineWidth).mul(-1).equal(),padding:0}},["".concat(t,"-contain-tabs")]:{["> div".concat(t,"-head")]:{minHeight:0,["".concat(t,"-head-title, ").concat(t,"-extra")]:{paddingTop:n}}},["".concat(t,"-type-inner")]:x(e),["".concat(t,"-loading")]:E(e),["".concat(t,"-rtl")]:{direction:"rtl"}}},O=e=>{let{componentCls:t,bodyPaddingSM:r,headerPaddingSM:n,headerHeightSM:a,headerFontSizeSM:o}=e;return{["".concat(t,"-small")]:{["> ".concat(t,"-head")]:{minHeight:a,padding:"0 ".concat((0,m.bf)(n)),fontSize:o,["> ".concat(t,"-head-wrapper")]:{["> ".concat(t,"-extra")]:{fontSize:e.fontSize}}},["> ".concat(t,"-body")]:{padding:r}},["".concat(t,"-small").concat(t,"-contain-tabs")]:{["> ".concat(t,"-head")]:{["".concat(t,"-head-title, ").concat(t,"-extra")]:{paddingTop:0,display:"flex",alignItems:"center"}}}}};var k=(0,p.I$)("Card",e=>{let t=(0,b.IX)(e,{cardShadow:e.boxShadowCard,cardHeadPadding:e.padding,cardPaddingBase:e.paddingLG,cardActionsIconSize:e.fontSize});return[C(t),O(t)]},e=>{var t,r;return{headerBg:"transparent",headerFontSize:e.fontSizeLG,headerFontSizeSM:e.fontSize,headerHeight:e.fontSizeLG*e.lineHeightLG+2*e.padding,headerHeightSM:e.fontSize*e.lineHeight+2*e.paddingXS,actionsBg:e.colorBgContainer,actionsLiMargin:"".concat(e.paddingSM,"px 0"),tabsMarginBottom:-e.padding-e.lineWidth,extraColor:e.colorText,bodyPaddingSM:12,headerPaddingSM:12,bodyPadding:null!==(t=e.bodyPadding)&&void 0!==t?t:e.paddingLG,headerPadding:null!==(r=e.headerPadding)&&void 0!==r?r:e.paddingLG}}),S=r(56250),P=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,n=Object.getOwnPropertySymbols(e);at.indexOf(n[a])&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r};let N=e=>{let{actionClasses:t,actions:r=[],actionStyle:a}=e;return n.createElement("ul",{className:t,style:a},r.map((e,t)=>n.createElement("li",{style:{width:"".concat(100/r.length,"%")},key:"action-".concat(t)},n.createElement("span",null,e))))},T=n.forwardRef((e,t)=>{let r;let{prefixCls:a,className:d,rootClassName:m,style:f,extra:p,headStyle:b={},bodyStyle:g={},title:v,loading:y,bordered:w,variant:x,size:E,type:C,cover:O,actions:T,tabList:q,children:M,activeTabKey:j,defaultActiveTabKey:D,tabBarExtraContent:L,hoverable:R,tabProps:I={},classNames:_,styles:Z}=e,F=P(e,["prefixCls","className","rootClassName","style","extra","headStyle","bodyStyle","title","loading","bordered","variant","size","type","cover","actions","tabList","children","activeTabKey","defaultActiveTabKey","tabBarExtraContent","hoverable","tabProps","classNames","styles"]),{getPrefixCls:A,direction:z,card:H}=n.useContext(s.E_),[B]=(0,S.Z)("card",x,w),V=e=>{var t;return o()(null===(t=null==H?void 0:H.classNames)||void 0===t?void 0:t[e],null==_?void 0:_[e])},Q=e=>{var t;return Object.assign(Object.assign({},null===(t=null==H?void 0:H.styles)||void 0===t?void 0:t[e]),null==Z?void 0:Z[e])},G=n.useMemo(()=>{let e=!1;return n.Children.forEach(M,t=>{(null==t?void 0:t.type)===h&&(e=!0)}),e},[M]),K=A("card",a),[W,U,X]=k(K),J=n.createElement(c.Z,{loading:!0,active:!0,paragraph:{rows:4},title:!1},M),Y=void 0!==j,$=Object.assign(Object.assign({},I),{[Y?"activeKey":"defaultActiveKey"]:Y?j:D,tabBarExtraContent:L}),ee=(0,l.Z)(E),et=ee&&"default"!==ee?ee:"large",er=q?n.createElement(u.default,Object.assign({size:et},$,{className:"".concat(K,"-head-tabs"),onChange:t=>{var r;null===(r=e.onTabChange)||void 0===r||r.call(e,t)},items:q.map(e=>{var{tab:t}=e;return Object.assign({label:t},P(e,["tab"]))})})):null;if(v||p||er){let e=o()("".concat(K,"-head"),V("header")),t=o()("".concat(K,"-head-title"),V("title")),a=o()("".concat(K,"-extra"),V("extra")),i=Object.assign(Object.assign({},b),Q("header"));r=n.createElement("div",{className:e,style:i},n.createElement("div",{className:"".concat(K,"-head-wrapper")},v&&n.createElement("div",{className:t,style:Q("title")},v),p&&n.createElement("div",{className:a,style:Q("extra")},p)),er)}let en=o()("".concat(K,"-cover"),V("cover")),ea=O?n.createElement("div",{className:en,style:Q("cover")},O):null,eo=o()("".concat(K,"-body"),V("body")),ei=Object.assign(Object.assign({},g),Q("body")),es=n.createElement("div",{className:eo,style:ei},y?J:M),el=o()("".concat(K,"-actions"),V("actions")),ec=(null==T?void 0:T.length)?n.createElement(N,{actionClasses:el,actionStyle:Q("actions"),actions:T}):null,eu=(0,i.Z)(F,["onTabChange"]),ed=o()(K,null==H?void 0:H.className,{["".concat(K,"-loading")]:y,["".concat(K,"-bordered")]:"borderless"!==B,["".concat(K,"-hoverable")]:R,["".concat(K,"-contain-grid")]:G,["".concat(K,"-contain-tabs")]:null==q?void 0:q.length,["".concat(K,"-").concat(ee)]:ee,["".concat(K,"-type-").concat(C)]:!!C,["".concat(K,"-rtl")]:"rtl"===z},d,m,U,X),eh=Object.assign(Object.assign({},null==H?void 0:H.style),f);return W(n.createElement("div",Object.assign({ref:t},eu,{className:ed,style:eh}),r,ea,es,ec))});var q=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,n=Object.getOwnPropertySymbols(e);at.indexOf(n[a])&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r};T.Grid=h,T.Meta=e=>{let{prefixCls:t,className:r,avatar:a,title:i,description:l}=e,c=q(e,["prefixCls","className","avatar","title","description"]),{getPrefixCls:u}=n.useContext(s.E_),d=u("card",t),h=o()("".concat(d,"-meta"),r),m=a?n.createElement("div",{className:"".concat(d,"-meta-avatar")},a):null,f=i?n.createElement("div",{className:"".concat(d,"-meta-title")},i):null,p=l?n.createElement("div",{className:"".concat(d,"-meta-description")},l):null,b=f||p?n.createElement("div",{className:"".concat(d,"-meta-detail")},f,p):null;return n.createElement("div",Object.assign({},c,{className:h}),m,b)};var M=T},77331:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"}))});t.Z=a},44633:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"}))});t.Z=a},15731:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=a},53410:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"}))});t.Z=a},23628:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"}))});t.Z=a},49084:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"}))});t.Z=a},2894:function(e,t,r){r.d(t,{R:function(){return s},m:function(){return i}});var n=r(18238),a=r(7989),o=r(11255),i=class extends a.F{#e;#t;#r;#n;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#r=e.mutationCache,this.#t=[],this.state=e.state||s(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#r.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||("pending"===this.state.status?this.scheduleGc():this.#r.remove(this))}continue(){return this.#n?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#a({type:"continue"})},r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#n=(0,o.Mz)({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{this.#a({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#a({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#r.canRun(this)});let n="pending"===this.state.status,a=!this.#n.canStart();try{if(n)t();else{this.#a({type:"pending",variables:e,isPaused:a}),await this.#r.config.onMutate?.(e,this,r);let t=await this.options.onMutate?.(e,r);t!==this.state.context&&this.#a({type:"pending",context:t,variables:e,isPaused:a})}let o=await this.#n.start();return await this.#r.config.onSuccess?.(o,e,this.state.context,this,r),await this.options.onSuccess?.(o,e,this.state.context,r),await this.#r.config.onSettled?.(o,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(o,null,e,this.state.context,r),this.#a({type:"success",data:o}),o}catch(t){try{throw await this.#r.config.onError?.(t,e,this.state.context,this,r),await this.options.onError?.(t,e,this.state.context,r),await this.#r.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(void 0,t,e,this.state.context,r),t}finally{this.#a({type:"error",error:t})}}finally{this.#r.runNext(this)}}#a(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),n.Vr.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#r.notify({mutation:this,type:"updated",action:e})})}};function s(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}},21623:function(e,t,r){r.d(t,{S:function(){return p}});var n=r(45345),a=r(21733),o=r(18238),i=r(24112),s=class extends i.l{constructor(e={}){super(),this.config=e,this.#o=new Map}#o;build(e,t,r){let o=t.queryKey,i=t.queryHash??(0,n.Rm)(o,t),s=this.get(i);return s||(s=new a.A({client:e,queryKey:o,queryHash:i,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(o)}),this.add(s)),s}add(e){this.#o.has(e.queryHash)||(this.#o.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#o.get(e.queryHash);t&&(e.destroy(),t===e&&this.#o.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){o.Vr.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#o.get(e)}getAll(){return[...this.#o.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,n._x)(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>(0,n._x)(e,t)):t}notify(e){o.Vr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){o.Vr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){o.Vr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},l=r(2894),c=class extends i.l{constructor(e={}){super(),this.config=e,this.#i=new Set,this.#s=new Map,this.#l=0}#i;#s;#l;build(e,t,r){let n=new l.m({client:e,mutationCache:this,mutationId:++this.#l,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#i.add(e);let t=u(e);if("string"==typeof t){let r=this.#s.get(t);r?r.push(e):this.#s.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#i.delete(e)){let t=u(e);if("string"==typeof t){let r=this.#s.get(t);if(r){if(r.length>1){let t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&this.#s.delete(t)}}}this.notify({type:"removed",mutation:e})}canRun(e){let t=u(e);if("string"!=typeof t)return!0;{let r=this.#s.get(t),n=r?.find(e=>"pending"===e.state.status);return!n||n===e}}runNext(e){let t=u(e);if("string"!=typeof t)return Promise.resolve();{let r=this.#s.get(t)?.find(t=>t!==e&&t.state.isPaused);return r?.continue()??Promise.resolve()}}clear(){o.Vr.batch(()=>{this.#i.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#i.clear(),this.#s.clear()})}getAll(){return Array.from(this.#i)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,n.X7)(t,e))}findAll(e={}){return this.getAll().filter(t=>(0,n.X7)(e,t))}notify(e){o.Vr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return o.Vr.batch(()=>Promise.all(e.map(e=>e.continue().catch(n.ZT))))}};function u(e){return e.options.scope?.id}var d=r(87045),h=r(57853);function m(e){return{onFetch:(t,r)=>{let a=t.options,o=t.fetchOptions?.meta?.fetchMore?.direction,i=t.state.data?.pages||[],s=t.state.data?.pageParams||[],l={pages:[],pageParams:[]},c=0,u=async()=>{let r=!1,u=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(t.signal.aborted?r=!0:t.signal.addEventListener("abort",()=>{r=!0}),t.signal)})},d=(0,n.cG)(t.options,t.fetchOptions),h=async(e,a,o)=>{if(r)return Promise.reject();if(null==a&&e.pages.length)return Promise.resolve(e);let i=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:a,direction:o?"backward":"forward",meta:t.options.meta};return u(e),e})(),s=await d(i),{maxPages:l}=t.options,c=o?n.Ht:n.VX;return{pages:c(e.pages,s,l),pageParams:c(e.pageParams,a,l)}};if(o&&i.length){let e="backward"===o,t={pages:i,pageParams:s},r=(e?function(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}:f)(a,t);l=await h(t,r,e)}else{let t=e??i.length;do{let e=0===c?s[0]??a.initialPageParam:f(a,l);if(c>0&&null==e)break;l=await h(l,e),c++}while(ct.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=u}}}function f(e,{pages:t,pageParams:r}){let n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}var p=class{#c;#r;#u;#d;#h;#m;#f;#p;constructor(e={}){this.#c=e.queryCache||new s,this.#r=e.mutationCache||new c,this.#u=e.defaultOptions||{},this.#d=new Map,this.#h=new Map,this.#m=0}mount(){this.#m++,1===this.#m&&(this.#f=d.j.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#c.onFocus())}),this.#p=h.N.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#c.onOnline())}))}unmount(){this.#m--,0===this.#m&&(this.#f?.(),this.#f=void 0,this.#p?.(),this.#p=void 0)}isFetching(e){return this.#c.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#r.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#c.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=this.#c.build(this,t),a=r.state.data;return void 0===a?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime((0,n.KC)(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(a))}getQueriesData(e){return this.#c.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,r){let a=this.defaultQueryOptions({queryKey:e}),o=this.#c.get(a.queryHash),i=o?.state.data,s=(0,n.SE)(t,i);if(void 0!==s)return this.#c.build(this,a).setData(s,{...r,manual:!0})}setQueriesData(e,t,r){return o.Vr.batch(()=>this.#c.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#c.get(t.queryHash)?.state}removeQueries(e){let t=this.#c;o.Vr.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let r=this.#c;return o.Vr.batch(()=>(r.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:!0,...t};return Promise.all(o.Vr.batch(()=>this.#c.findAll(e).map(e=>e.cancel(r)))).then(n.ZT).catch(n.ZT)}invalidateQueries(e,t={}){return o.Vr.batch(()=>(this.#c.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType==="none")?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t))}refetchQueries(e,t={}){let r={...t,cancelRefetch:t.cancelRefetch??!0};return Promise.all(o.Vr.batch(()=>this.#c.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,r);return r.throwOnError||(t=t.catch(n.ZT)),"paused"===e.state.fetchStatus?Promise.resolve():t}))).then(n.ZT)}fetchQuery(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let r=this.#c.build(this,t);return r.isStaleByTime((0,n.KC)(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(n.ZT).catch(n.ZT)}fetchInfiniteQuery(e){return e.behavior=m(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(n.ZT).catch(n.ZT)}ensureInfiniteQueryData(e){return e.behavior=m(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return h.N.isOnline()?this.#r.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#c}getMutationCache(){return this.#r}getDefaultOptions(){return this.#u}setDefaultOptions(e){this.#u=e}setQueryDefaults(e,t){this.#d.set((0,n.Ym)(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#d.values()],r={};return t.forEach(t=>{(0,n.to)(e,t.queryKey)&&Object.assign(r,t.defaultOptions)}),r}setMutationDefaults(e,t){this.#h.set((0,n.Ym)(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#h.values()],r={};return t.forEach(t=>{(0,n.to)(e,t.mutationKey)&&Object.assign(r,t.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#u.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=(0,n.Rm)(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===n.CN&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#u.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#c.clear(),this.#r.clear()}}},19616:function(e,t,r){r.d(t,{G:function(){return i}});var n=r(2265);let a={enabled:!0,leading:!1,trailing:!0,wait:0,onExecute:()=>{}};class o{constructor(e,t){this.fn=e,this._canLeadingExecute=!0,this._isPending=!1,this._executionCount=0,this._options={...a,...t}}setOptions(e){return this._options={...this._options,...e},this._options.enabled||(this._isPending=!1),this._options}getOptions(){return this._options}maybeExecute(...e){this._options.leading&&this._canLeadingExecute&&(this.executeFunction(...e),this._canLeadingExecute=!1),(this._options.leading||this._options.trailing)&&(this._isPending=!0),this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=setTimeout(()=>{this._canLeadingExecute=!0,this._isPending=!1,this._options.trailing&&this.executeFunction(...e)},this._options.wait)}executeFunction(...e){this._options.enabled&&(this.fn(...e),this._executionCount++,this._options.onExecute(this))}cancel(){this._timeoutId&&(clearTimeout(this._timeoutId),this._canLeadingExecute=!0,this._isPending=!1)}getExecutionCount(){return this._executionCount}getIsPending(){return this._options.enabled&&this._isPending}}function i(e,t){let[r,a]=(0,n.useState)(e),i=function(e,t){let[r]=(0,n.useState)(()=>{var r;return Object.getOwnPropertyNames(Object.getPrototypeOf(r=new o(e,t))).filter(e=>"function"==typeof r[e]).reduce((e,t)=>{let n=r[t];return"function"==typeof n&&(e[t]=n.bind(r)),e},{})});return r.setOptions(t),r}(a,t);return[r,i.maybeExecute,i]}},91054:function(e,t,r){let n,a;r.d(t,{pJ:function(){return j}});var o,i=r(71049),s=r(11323),l=r(2265),c=r(66797),u=r(93980),d=r(65573),h=r(67561),m=r(98218),f=r(33443),p=r(28294),b=r(31370),g=r(72468),v=r(5664),y=r(38929);let w=null!=(o=l.startTransition)?o:function(e){e()};var x=r(52724),E=((n=E||{})[n.Open=0]="Open",n[n.Closed=1]="Closed",n),C=((a=C||{})[a.ToggleDisclosure=0]="ToggleDisclosure",a[a.CloseDisclosure=1]="CloseDisclosure",a[a.SetButtonId=2]="SetButtonId",a[a.SetPanelId=3]="SetPanelId",a[a.SetButtonElement=4]="SetButtonElement",a[a.SetPanelElement=5]="SetPanelElement",a);let O={0:e=>({...e,disclosureState:(0,g.E)(e.disclosureState,{0:1,1:0})}),1:e=>1===e.disclosureState?e:{...e,disclosureState:1},2:(e,t)=>e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId},3:(e,t)=>e.panelId===t.panelId?e:{...e,panelId:t.panelId},4:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},5:(e,t)=>e.panelElement===t.element?e:{...e,panelElement:t.element}},k=(0,l.createContext)(null);function S(e){let t=(0,l.useContext)(k);if(null===t){let t=Error("<".concat(e," /> is missing a parent component."));throw Error.captureStackTrace&&Error.captureStackTrace(t,S),t}return t}k.displayName="DisclosureContext";let P=(0,l.createContext)(null);P.displayName="DisclosureAPIContext";let N=(0,l.createContext)(null);function T(e,t){return(0,g.E)(t.type,O,e,t)}N.displayName="DisclosurePanelContext";let q=l.Fragment,M=y.VN.RenderStrategy|y.VN.Static,j=Object.assign((0,y.yV)(function(e,t){let{defaultOpen:r=!1,...n}=e,a=(0,l.useRef)(null),o=(0,h.T)(t,(0,h.h)(e=>{a.current=e},void 0===e.as||e.as===l.Fragment)),i=(0,l.useReducer)(T,{disclosureState:r?0:1,buttonElement:null,panelElement:null,buttonId:null,panelId:null}),[{disclosureState:s,buttonId:c},d]=i,m=(0,u.z)(e=>{d({type:1});let t=(0,v.r)(a);if(!t||!c)return;let r=e?e instanceof HTMLElement?e:e.current instanceof HTMLElement?e.current:t.getElementById(c):t.getElementById(c);null==r||r.focus()}),b=(0,l.useMemo)(()=>({close:m}),[m]),w=(0,l.useMemo)(()=>({open:0===s,close:m}),[s,m]),x=(0,y.L6)();return l.createElement(k.Provider,{value:i},l.createElement(P.Provider,{value:b},l.createElement(f.Z,{value:m},l.createElement(p.up,{value:(0,g.E)(s,{0:p.ZM.Open,1:p.ZM.Closed})},x({ourProps:{ref:o},theirProps:n,slot:w,defaultTag:q,name:"Disclosure"})))))}),{Button:(0,y.yV)(function(e,t){let r=(0,l.useId)(),{id:n="headlessui-disclosure-button-".concat(r),disabled:a=!1,autoFocus:o=!1,...m}=e,[f,p]=S("Disclosure.Button"),g=(0,l.useContext)(N),v=null!==g&&g===f.panelId,w=(0,l.useRef)(null),E=(0,h.T)(w,t,(0,u.z)(e=>{if(!v)return p({type:4,element:e})}));(0,l.useEffect)(()=>{if(!v)return p({type:2,buttonId:n}),()=>{p({type:2,buttonId:null})}},[n,p,v]);let C=(0,u.z)(e=>{var t;if(v){if(1===f.disclosureState)return;switch(e.key){case x.R.Space:case x.R.Enter:e.preventDefault(),e.stopPropagation(),p({type:0}),null==(t=f.buttonElement)||t.focus()}}else switch(e.key){case x.R.Space:case x.R.Enter:e.preventDefault(),e.stopPropagation(),p({type:0})}}),O=(0,u.z)(e=>{e.key===x.R.Space&&e.preventDefault()}),k=(0,u.z)(e=>{var t;(0,b.P)(e.currentTarget)||a||(v?(p({type:0}),null==(t=f.buttonElement)||t.focus()):p({type:0}))}),{isFocusVisible:P,focusProps:T}=(0,i.F)({autoFocus:o}),{isHovered:q,hoverProps:M}=(0,s.X)({isDisabled:a}),{pressed:j,pressProps:D}=(0,c.x)({disabled:a}),L=(0,l.useMemo)(()=>({open:0===f.disclosureState,hover:q,active:j,disabled:a,focus:P,autofocus:o}),[f,q,j,P,a,o]),R=(0,d.f)(e,f.buttonElement),I=v?(0,y.dG)({ref:E,type:R,disabled:a||void 0,autoFocus:o,onKeyDown:C,onClick:k},T,M,D):(0,y.dG)({ref:E,id:n,type:R,"aria-expanded":0===f.disclosureState,"aria-controls":f.panelElement?f.panelId:void 0,disabled:a||void 0,autoFocus:o,onKeyDown:C,onKeyUp:O,onClick:k},T,M,D);return(0,y.L6)()({ourProps:I,theirProps:m,slot:L,defaultTag:"button",name:"Disclosure.Button"})}),Panel:(0,y.yV)(function(e,t){let r=(0,l.useId)(),{id:n="headlessui-disclosure-panel-".concat(r),transition:a=!1,...o}=e,[i,s]=S("Disclosure.Panel"),{close:c}=function e(t){let r=(0,l.useContext)(P);if(null===r){let r=Error("<".concat(t," /> is missing a parent component."));throw Error.captureStackTrace&&Error.captureStackTrace(r,e),r}return r}("Disclosure.Panel"),[d,f]=(0,l.useState)(null),b=(0,h.T)(t,(0,u.z)(e=>{w(()=>s({type:5,element:e}))}),f);(0,l.useEffect)(()=>(s({type:3,panelId:n}),()=>{s({type:3,panelId:null})}),[n,s]);let g=(0,p.oJ)(),[v,x]=(0,m.Y)(a,d,null!==g?(g&p.ZM.Open)===p.ZM.Open:0===i.disclosureState),E=(0,l.useMemo)(()=>({open:0===i.disclosureState,close:c}),[i.disclosureState,c]),C={ref:b,id:n,...(0,m.X)(x)},O=(0,y.L6)();return l.createElement(p.uu,null,l.createElement(N.Provider,{value:i.panelId},O({ourProps:C,theirProps:o,slot:E,defaultTag:"div",features:M,visible:v,name:"Disclosure.Panel"})))})})},85238:function(e,t,r){let n;r.d(t,{u:function(){return N}});var a=r(2265),o=r(59456),i=r(93980),s=r(25289),l=r(73389),c=r(43507),u=r(180),d=r(67561),h=r(98218),m=r(28294),f=r(95504),p=r(72468),b=r(38929);function g(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||(null!=(t=e.as)?t:C)!==a.Fragment||1===a.Children.count(e.children)}let v=(0,a.createContext)(null);v.displayName="TransitionContext";var y=((n=y||{}).Visible="visible",n.Hidden="hidden",n);let w=(0,a.createContext)(null);function x(e){return"children"in e?x(e.children):e.current.filter(e=>{let{el:t}=e;return null!==t.current}).filter(e=>{let{state:t}=e;return"visible"===t}).length>0}function E(e,t){let r=(0,c.E)(e),n=(0,a.useRef)([]),l=(0,s.t)(),u=(0,o.G)(),d=(0,i.z)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:b.l4.Hidden,a=n.current.findIndex(t=>{let{el:r}=t;return r===e});-1!==a&&((0,p.E)(t,{[b.l4.Unmount](){n.current.splice(a,1)},[b.l4.Hidden](){n.current[a].state="hidden"}}),u.microTask(()=>{var e;!x(n)&&l.current&&(null==(e=r.current)||e.call(r))}))}),h=(0,i.z)(e=>{let t=n.current.find(t=>{let{el:r}=t;return r===e});return t?"visible"!==t.state&&(t.state="visible"):n.current.push({el:e,state:"visible"}),()=>d(e,b.l4.Unmount)}),m=(0,a.useRef)([]),f=(0,a.useRef)(Promise.resolve()),g=(0,a.useRef)({enter:[],leave:[]}),v=(0,i.z)((e,r,n)=>{m.current.splice(0),t&&(t.chains.current[r]=t.chains.current[r].filter(t=>{let[r]=t;return r!==e})),null==t||t.chains.current[r].push([e,new Promise(e=>{m.current.push(e)})]),null==t||t.chains.current[r].push([e,new Promise(e=>{Promise.all(g.current[r].map(e=>{let[t,r]=e;return r})).then(()=>e())})]),"enter"===r?f.current=f.current.then(()=>null==t?void 0:t.wait.current).then(()=>n(r)):n(r)}),y=(0,i.z)((e,t,r)=>{Promise.all(g.current[t].splice(0).map(e=>{let[t,r]=e;return r})).then(()=>{var e;null==(e=m.current.shift())||e()}).then(()=>r(t))});return(0,a.useMemo)(()=>({children:n,register:h,unregister:d,onStart:v,onStop:y,wait:f,chains:g}),[h,d,n,v,y,g,f])}w.displayName="NestingContext";let C=a.Fragment,O=b.VN.RenderStrategy,k=(0,b.yV)(function(e,t){let{show:r,appear:n=!1,unmount:o=!0,...s}=e,c=(0,a.useRef)(null),h=g(e),f=(0,d.T)(...h?[c,t]:null===t?[]:[t]);(0,u.H)();let p=(0,m.oJ)();if(void 0===r&&null!==p&&(r=(p&m.ZM.Open)===m.ZM.Open),void 0===r)throw Error("A is used but it is missing a `show={true | false}` prop.");let[y,C]=(0,a.useState)(r?"visible":"hidden"),k=E(()=>{r||C("hidden")}),[P,N]=(0,a.useState)(!0),T=(0,a.useRef)([r]);(0,l.e)(()=>{!1!==P&&T.current[T.current.length-1]!==r&&(T.current.push(r),N(!1))},[T,r]);let q=(0,a.useMemo)(()=>({show:r,appear:n,initial:P}),[r,n,P]);(0,l.e)(()=>{r?C("visible"):x(k)||null===c.current||C("hidden")},[r,k]);let M={unmount:o},j=(0,i.z)(()=>{var t;P&&N(!1),null==(t=e.beforeEnter)||t.call(e)}),D=(0,i.z)(()=>{var t;P&&N(!1),null==(t=e.beforeLeave)||t.call(e)}),L=(0,b.L6)();return a.createElement(w.Provider,{value:k},a.createElement(v.Provider,{value:q},L({ourProps:{...M,as:a.Fragment,children:a.createElement(S,{ref:f,...M,...s,beforeEnter:j,beforeLeave:D})},theirProps:{},defaultTag:a.Fragment,features:O,visible:"visible"===y,name:"Transition"})))}),S=(0,b.yV)(function(e,t){var r,n;let{transition:o=!0,beforeEnter:s,afterEnter:c,beforeLeave:y,afterLeave:k,enter:S,enterFrom:P,enterTo:N,entered:T,leave:q,leaveFrom:M,leaveTo:j,...D}=e,[L,R]=(0,a.useState)(null),I=(0,a.useRef)(null),_=g(e),Z=(0,d.T)(..._?[I,t,R]:null===t?[]:[t]),F=null==(r=D.unmount)||r?b.l4.Unmount:b.l4.Hidden,{show:A,appear:z,initial:H}=function(){let e=(0,a.useContext)(v);if(null===e)throw Error("A is used but it is missing a parent or .");return e}(),[B,V]=(0,a.useState)(A?"visible":"hidden"),Q=function(){let e=(0,a.useContext)(w);if(null===e)throw Error("A is used but it is missing a parent or .");return e}(),{register:G,unregister:K}=Q;(0,l.e)(()=>G(I),[G,I]),(0,l.e)(()=>{if(F===b.l4.Hidden&&I.current){if(A&&"visible"!==B){V("visible");return}return(0,p.E)(B,{hidden:()=>K(I),visible:()=>G(I)})}},[B,I,G,K,A,F]);let W=(0,u.H)();(0,l.e)(()=>{if(_&&W&&"visible"===B&&null===I.current)throw Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[I,B,W,_]);let U=H&&!z,X=z&&A&&H,J=(0,a.useRef)(!1),Y=E(()=>{J.current||(V("hidden"),K(I))},Q),$=(0,i.z)(e=>{J.current=!0,Y.onStart(I,e?"enter":"leave",e=>{"enter"===e?null==s||s():"leave"===e&&(null==y||y())})}),ee=(0,i.z)(e=>{let t=e?"enter":"leave";J.current=!1,Y.onStop(I,t,e=>{"enter"===e?null==c||c():"leave"===e&&(null==k||k())}),"leave"!==t||x(Y)||(V("hidden"),K(I))});(0,a.useEffect)(()=>{_&&o||($(A),ee(A))},[A,_,o]);let et=!(!o||!_||!W||U),[,er]=(0,h.Y)(et,L,A,{start:$,end:ee}),en=(0,b.oA)({ref:Z,className:(null==(n=(0,f.A)(D.className,X&&S,X&&P,er.enter&&S,er.enter&&er.closed&&P,er.enter&&!er.closed&&N,er.leave&&q,er.leave&&!er.closed&&M,er.leave&&er.closed&&j,!er.transition&&A&&T))?void 0:n.trim())||void 0,...(0,h.X)(er)}),ea=0;"visible"===B&&(ea|=m.ZM.Open),"hidden"===B&&(ea|=m.ZM.Closed),er.enter&&(ea|=m.ZM.Opening),er.leave&&(ea|=m.ZM.Closing);let eo=(0,b.L6)();return a.createElement(w.Provider,{value:Y},a.createElement(m.up,{value:ea},eo({ourProps:en,theirProps:D,defaultTag:C,features:O,visible:"visible"===B,name:"Transition.Child"})))}),P=(0,b.yV)(function(e,t){let r=null!==(0,a.useContext)(v),n=null!==(0,m.oJ)();return a.createElement(a.Fragment,null,!r&&n?a.createElement(k,{ref:t,...e}):a.createElement(S,{ref:t,...e}))}),N=Object.assign(k,{Child:P,Root:k})},33443:function(e,t,r){r.d(t,{Z:function(){return o}});var n=r(2265);let a=(0,n.createContext)(()=>{});function o(e){let{value:t,children:r}=e;return n.createElement(a.Provider,{value:t},r)}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1973-26a414084f96c69b.js b/litellm/proxy/_experimental/out/_next/static/chunks/1973-26a414084f96c69b.js deleted file mode 100644 index 8ba0b21bc05..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1973-26a414084f96c69b.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1973],{83669:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),c=n(2265),o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"check-circle",theme:"outlined"},r=n(55015),l=c.forwardRef(function(e,t){return c.createElement(r.Z,(0,a.Z)({},e,{ref:t,icon:o}))})},5540:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),c=n(2265),o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"}}]},name:"clock-circle",theme:"outlined"},r=n(55015),l=c.forwardRef(function(e,t){return c.createElement(r.Z,(0,a.Z)({},e,{ref:t,icon:o}))})},41169:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),c=n(2265),o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 472a40 40 0 1080 0 40 40 0 10-80 0zm367 352.9L696.3 352V178H768v-68H256v68h71.7v174L145 824.9c-2.8 7.4-4.3 15.2-4.3 23.1 0 35.3 28.7 64 64 64h614.6c7.9 0 15.7-1.5 23.1-4.3 33-12.7 49.4-49.8 36.6-82.8zM395.7 364.7V180h232.6v184.7L719.2 600c-20.7-5.3-42.1-8-63.9-8-61.2 0-119.2 21.5-165.3 60a188.78 188.78 0 01-121.3 43.9c-32.7 0-64.1-8.3-91.8-23.7l118.8-307.5zM210.5 844l41.7-107.8c35.7 18.1 75.4 27.8 116.6 27.8 61.2 0 119.2-21.5 165.3-60 33.9-28.2 76.3-43.9 121.3-43.9 35 0 68.4 9.5 97.6 27.1L813.5 844h-603z"}}]},name:"experiment",theme:"outlined"},r=n(55015),l=c.forwardRef(function(e,t){return c.createElement(r.Z,(0,a.Z)({},e,{ref:t,icon:o}))})},10798:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),c=n(2265),o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880.1 154H143.9c-24.5 0-39.8 26.7-27.5 48L349 597.4V838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V597.4L907.7 202c12.2-21.3-3.1-48-27.6-48zM603.4 798H420.6V642h182.9v156zm9.6-236.6l-9.5 16.6h-183l-9.5-16.6L212.7 226h598.6L613 561.4z"}}]},name:"filter",theme:"outlined"},r=n(55015),l=c.forwardRef(function(e,t){return c.createElement(r.Z,(0,a.Z)({},e,{ref:t,icon:o}))})},8881:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),c=n(2265),o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372 0-89 31.3-170.8 83.5-234.8l523.3 523.3C682.8 852.7 601 884 512 884zm288.5-137.2L277.2 223.5C341.2 171.3 423 140 512 140c205.4 0 372 166.6 372 372 0 89-31.3 170.8-83.5 234.8z"}}]},name:"stop",theme:"outlined"},r=n(55015),l=c.forwardRef(function(e,t){return c.createElement(r.Z,(0,a.Z)({},e,{ref:t,icon:o}))})},3632:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),c=n(2265),o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"},r=n(55015),l=c.forwardRef(function(e,t){return c.createElement(r.Z,(0,a.Z)({},e,{ref:t,icon:o}))})},30150:function(e,t,n){n.d(t,{Z:function(){return u}});var a=n(5853),c=n(2265);let o=e=>{var t=(0,a._T)(e,[]);return c.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),c.createElement("path",{d:"M12 4v16m8-8H4"}))},r=e=>{var t=(0,a._T)(e,[]);return c.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),c.createElement("path",{d:"M20 12H4"}))};var l=n(13241),i=n(1153),s=n(69262);let d="flex mx-auto text-tremor-content-subtle dark:text-dark-tremor-content-subtle",m="cursor-pointer hover:text-tremor-content dark:hover:text-dark-tremor-content",u=c.forwardRef((e,t)=>{let{onSubmit:n,enableStepper:u=!0,disabled:g,onValueChange:p,onChange:f}=e,h=(0,a._T)(e,["onSubmit","enableStepper","disabled","onValueChange","onChange"]),v=(0,c.useRef)(null),[b,x]=c.useState(!1),y=c.useCallback(()=>{x(!0)},[]),k=c.useCallback(()=>{x(!1)},[]),[S,w]=c.useState(!1),E=c.useCallback(()=>{w(!0)},[]),C=c.useCallback(()=>{w(!1)},[]);return c.createElement(s.Z,Object.assign({type:"number",ref:(0,i.lq)([v,t]),disabled:g,makeInputClassName:(0,i.fn)("NumberInput"),onKeyDown:e=>{var t;if("Enter"===e.key&&!e.ctrlKey&&!e.altKey&&!e.shiftKey){let e=null===(t=v.current)||void 0===t?void 0:t.value;null==n||n(parseFloat(null!=e?e:""))}"ArrowDown"===e.key&&y(),"ArrowUp"===e.key&&E()},onKeyUp:e=>{"ArrowDown"===e.key&&k(),"ArrowUp"===e.key&&C()},onChange:e=>{g||(null==p||p(parseFloat(e.target.value)),null==f||f(e))},stepper:u?c.createElement("div",{className:(0,l.q)("flex justify-center align-middle")},c.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;g||(null===(e=v.current)||void 0===e||e.stepDown(),null===(t=v.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,l.q)(!g&&m,d,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},c.createElement(r,{"data-testid":"step-down",className:(b?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"})),c.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;g||(null===(e=v.current)||void 0===e||e.stepUp(),null===(t=v.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,l.q)(!g&&m,d,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},c.createElement(o,{"data-testid":"step-up",className:(S?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"}))):null},h))});u.displayName="NumberInput"},16853:function(e,t,n){n.d(t,{Z:function(){return d}});var a=n(5853),c=n(96398),o=n(44140),r=n(2265),l=n(13241),i=n(1153);let s=(0,i.fn)("Textarea"),d=r.forwardRef((e,t)=>{let{value:n,defaultValue:d="",placeholder:m="Type...",error:u=!1,errorMessage:g,disabled:p=!1,className:f,onChange:h,onValueChange:v,autoHeight:b=!1}=e,x=(0,a._T)(e,["value","defaultValue","placeholder","error","errorMessage","disabled","className","onChange","onValueChange","autoHeight"]),[y,k]=(0,o.Z)(d,n),S=(0,r.useRef)(null),w=(0,c.Uh)(y);return(0,r.useEffect)(()=>{let e=S.current;if(b&&e){e.style.height="60px";let t=e.scrollHeight;e.style.height=t+"px"}},[b,S,y]),r.createElement(r.Fragment,null,r.createElement("textarea",Object.assign({ref:(0,i.lq)([S,t]),value:y,placeholder:m,disabled:p,className:(0,l.q)(s("Textarea"),"w-full flex items-center outline-none rounded-tremor-default px-3 py-2 text-tremor-default focus:ring-2 transition duration-100 border","shadow-tremor-input focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:shadow-dark-tremor-input focus:dark:border-dark-tremor-brand-subtle focus:dark:ring-dark-tremor-brand-muted",(0,c.um)(w,p,u),p?"placeholder:text-tremor-content-subtle dark:placeholder:text-dark-tremor-content-subtle":"placeholder:text-tremor-content dark:placeholder:text-dark-tremor-content",f),"data-testid":"text-area",onChange:e=>{null==h||h(e),k(e.target.value),null==v||v(e.target.value)}},x)),u&&g?r.createElement("p",{className:(0,l.q)(s("errorMessage"),"text-sm text-red-500 mt-1")},g):null)});d.displayName="Textarea"},67101:function(e,t,n){n.d(t,{Z:function(){return d}});var a=n(5853),c=n(13241),o=n(1153),r=n(2265),l=n(9496);let i=(0,o.fn)("Grid"),s=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"",d=r.forwardRef((e,t)=>{let{numItems:n=1,numItemsSm:o,numItemsMd:d,numItemsLg:m,children:u,className:g}=e,p=(0,a._T)(e,["numItems","numItemsSm","numItemsMd","numItemsLg","children","className"]),f=s(n,l._m),h=s(o,l.LH),v=s(d,l.l5),b=s(m,l.N4),x=(0,c.q)(f,h,v,b);return r.createElement("div",Object.assign({ref:t,className:(0,c.q)(i("root"),"grid",x,g)},p),u)});d.displayName="Grid"},9496:function(e,t,n){n.d(t,{LH:function(){return c},N4:function(){return r},PT:function(){return l},SP:function(){return i},VS:function(){return s},_m:function(){return a},_w:function(){return d},l5:function(){return o}});let a={0:"grid-cols-none",1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6",7:"grid-cols-7",8:"grid-cols-8",9:"grid-cols-9",10:"grid-cols-10",11:"grid-cols-11",12:"grid-cols-12"},c={0:"sm:grid-cols-none",1:"sm:grid-cols-1",2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6",7:"sm:grid-cols-7",8:"sm:grid-cols-8",9:"sm:grid-cols-9",10:"sm:grid-cols-10",11:"sm:grid-cols-11",12:"sm:grid-cols-12"},o={0:"md:grid-cols-none",1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3",4:"md:grid-cols-4",5:"md:grid-cols-5",6:"md:grid-cols-6",7:"md:grid-cols-7",8:"md:grid-cols-8",9:"md:grid-cols-9",10:"md:grid-cols-10",11:"md:grid-cols-11",12:"md:grid-cols-12"},r={0:"lg:grid-cols-none",1:"lg:grid-cols-1",2:"lg:grid-cols-2",3:"lg:grid-cols-3",4:"lg:grid-cols-4",5:"lg:grid-cols-5",6:"lg:grid-cols-6",7:"lg:grid-cols-7",8:"lg:grid-cols-8",9:"lg:grid-cols-9",10:"lg:grid-cols-10",11:"lg:grid-cols-11",12:"lg:grid-cols-12"},l={1:"col-span-1",2:"col-span-2",3:"col-span-3",4:"col-span-4",5:"col-span-5",6:"col-span-6",7:"col-span-7",8:"col-span-8",9:"col-span-9",10:"col-span-10",11:"col-span-11",12:"col-span-12",13:"col-span-13"},i={1:"sm:col-span-1",2:"sm:col-span-2",3:"sm:col-span-3",4:"sm:col-span-4",5:"sm:col-span-5",6:"sm:col-span-6",7:"sm:col-span-7",8:"sm:col-span-8",9:"sm:col-span-9",10:"sm:col-span-10",11:"sm:col-span-11",12:"sm:col-span-12",13:"sm:col-span-13"},s={1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3",4:"md:col-span-4",5:"md:col-span-5",6:"md:col-span-6",7:"md:col-span-7",8:"md:col-span-8",9:"md:col-span-9",10:"md:col-span-10",11:"md:col-span-11",12:"md:col-span-12",13:"md:col-span-13"},d={1:"lg:col-span-1",2:"lg:col-span-2",3:"lg:col-span-3",4:"lg:col-span-4",5:"lg:col-span-5",6:"lg:col-span-6",7:"lg:col-span-7",8:"lg:col-span-8",9:"lg:col-span-9",10:"lg:col-span-10",11:"lg:col-span-11",12:"lg:col-span-12",13:"lg:col-span-13"}},44140:function(e,t,n){n.d(t,{Z:function(){return c}});var a=n(2265);let c=(e,t)=>{let n=void 0!==t,[c,o]=(0,a.useState)(e);return[n?t:c,e=>{n||o(e)}]}},35631:function(e,t,n){n.d(t,{Z:function(){return I}});var a=n(83145),c=n(2265),o=n(36760),r=n.n(o),l=n(53253),i=n(6543),s=n(71744),d=n(91086),m=n(33759),u=n(77774),g=n(28617),p=n(40049),f=n(10353);let h=c.createContext({});h.Consumer;var v=n(19722),b=n(54998),x=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&0>t.indexOf(a)&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var c=0,a=Object.getOwnPropertySymbols(e);ct.indexOf(a[c])&&Object.prototype.propertyIsEnumerable.call(e,a[c])&&(n[a[c]]=e[a[c]]);return n};let y=c.forwardRef((e,t)=>{let n;let{prefixCls:a,children:o,actions:l,extra:i,styles:d,className:m,classNames:u,colStyle:g}=e,p=x(e,["prefixCls","children","actions","extra","styles","className","classNames","colStyle"]),{grid:f,itemLayout:y}=(0,c.useContext)(h),{getPrefixCls:k,list:S}=(0,c.useContext)(s.E_),w=e=>{var t,n;return r()(null===(n=null===(t=null==S?void 0:S.item)||void 0===t?void 0:t.classNames)||void 0===n?void 0:n[e],null==u?void 0:u[e])},E=e=>{var t,n;return Object.assign(Object.assign({},null===(n=null===(t=null==S?void 0:S.item)||void 0===t?void 0:t.styles)||void 0===n?void 0:n[e]),null==d?void 0:d[e])},C=k("list",a),N=l&&l.length>0&&c.createElement("ul",{className:r()("".concat(C,"-item-action"),w("actions")),key:"actions",style:E("actions")},l.map((e,t)=>c.createElement("li",{key:"".concat(C,"-item-action-").concat(t)},e,t!==l.length-1&&c.createElement("em",{className:"".concat(C,"-item-action-split")})))),z=c.createElement(f?"div":"li",Object.assign({},p,f?{}:{ref:t},{className:r()("".concat(C,"-item"),{["".concat(C,"-item-no-flex")]:!("vertical"===y?!!i:(n=!1,c.Children.forEach(o,e=>{"string"==typeof e&&(n=!0)}),!(n&&c.Children.count(o)>1)))},m)}),"vertical"===y&&i?[c.createElement("div",{className:"".concat(C,"-item-main"),key:"content"},o,N),c.createElement("div",{className:r()("".concat(C,"-item-extra"),w("extra")),key:"extra",style:E("extra")},i)]:[o,N,(0,v.Tm)(i,{key:"extra"})]);return f?c.createElement(b.Z,{ref:t,flex:1,style:g},z):z});y.Meta=e=>{var{prefixCls:t,className:n,avatar:a,title:o,description:l}=e,i=x(e,["prefixCls","className","avatar","title","description"]);let{getPrefixCls:d}=(0,c.useContext)(s.E_),m=d("list",t),u=r()("".concat(m,"-item-meta"),n),g=c.createElement("div",{className:"".concat(m,"-item-meta-content")},o&&c.createElement("h4",{className:"".concat(m,"-item-meta-title")},o),l&&c.createElement("div",{className:"".concat(m,"-item-meta-description")},l));return c.createElement("div",Object.assign({},i,{className:u}),a&&c.createElement("div",{className:"".concat(m,"-item-meta-avatar")},a),(o||l)&&g)};var k=n(93463),S=n(12918),w=n(99320),E=n(71140);let C=e=>{let{listBorderedCls:t,componentCls:n,paddingLG:a,margin:c,itemPaddingSM:o,itemPaddingLG:r,marginLG:l,borderRadiusLG:i}=e,s=(0,k.bf)(e.calc(i).sub(e.lineWidth).equal());return{[t]:{border:"".concat((0,k.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder),borderRadius:i,["".concat(n,"-header")]:{borderRadius:"".concat(s," ").concat(s," 0 0")},["".concat(n,"-footer")]:{borderRadius:"0 0 ".concat(s," ").concat(s)},["".concat(n,"-header,").concat(n,"-footer,").concat(n,"-item")]:{paddingInline:a},["".concat(n,"-pagination")]:{margin:"".concat((0,k.bf)(c)," ").concat((0,k.bf)(l))}},["".concat(t).concat(n,"-sm")]:{["".concat(n,"-item,").concat(n,"-header,").concat(n,"-footer")]:{padding:o}},["".concat(t).concat(n,"-lg")]:{["".concat(n,"-item,").concat(n,"-header,").concat(n,"-footer")]:{padding:r}}}},N=e=>{let{componentCls:t,screenSM:n,screenMD:a,marginLG:c,marginSM:o,margin:r}=e;return{["@media screen and (max-width:".concat(a,"px)")]:{[t]:{["".concat(t,"-item")]:{["".concat(t,"-item-action")]:{marginInlineStart:c}}},["".concat(t,"-vertical")]:{["".concat(t,"-item")]:{["".concat(t,"-item-extra")]:{marginInlineStart:c}}}},["@media screen and (max-width: ".concat(n,"px)")]:{[t]:{["".concat(t,"-item")]:{flexWrap:"wrap",["".concat(t,"-action")]:{marginInlineStart:o}}},["".concat(t,"-vertical")]:{["".concat(t,"-item")]:{flexWrap:"wrap-reverse",["".concat(t,"-item-main")]:{minWidth:e.contentWidth},["".concat(t,"-item-extra")]:{margin:"auto auto ".concat((0,k.bf)(r))}}}}}},z=e=>{let{componentCls:t,antCls:n,controlHeight:a,minHeight:c,paddingSM:o,marginLG:r,padding:l,itemPadding:i,colorPrimary:s,itemPaddingSM:d,itemPaddingLG:m,paddingXS:u,margin:g,colorText:p,colorTextDescription:f,motionDurationSlow:h,lineWidth:v,headerBg:b,footerBg:x,emptyTextPadding:y,metaMarginBottom:w,avatarMarginRight:E,titleMarginBottom:C,descriptionFontSize:N}=e;return{[t]:Object.assign(Object.assign({},(0,S.Wf)(e)),{position:"relative","--rc-virtual-list-scrollbar-bg":e.colorSplit,"*":{outline:"none"},["".concat(t,"-header")]:{background:b},["".concat(t,"-footer")]:{background:x},["".concat(t,"-header, ").concat(t,"-footer")]:{paddingBlock:o},["".concat(t,"-pagination")]:{marginBlockStart:r,["".concat(n,"-pagination-options")]:{textAlign:"start"}},["".concat(t,"-spin")]:{minHeight:c,textAlign:"center"},["".concat(t,"-items")]:{margin:0,padding:0,listStyle:"none"},["".concat(t,"-item")]:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:i,color:p,["".concat(t,"-item-meta")]:{display:"flex",flex:1,alignItems:"flex-start",maxWidth:"100%",["".concat(t,"-item-meta-avatar")]:{marginInlineEnd:E},["".concat(t,"-item-meta-content")]:{flex:"1 0",width:0,color:p},["".concat(t,"-item-meta-title")]:{margin:"0 0 ".concat((0,k.bf)(e.marginXXS)," 0"),color:p,fontSize:e.fontSize,lineHeight:e.lineHeight,"> a":{color:p,transition:"all ".concat(h),"&:hover":{color:s}}},["".concat(t,"-item-meta-description")]:{color:f,fontSize:N,lineHeight:e.lineHeight}},["".concat(t,"-item-action")]:{flex:"0 0 auto",marginInlineStart:e.marginXXL,padding:0,fontSize:0,listStyle:"none","& > li":{position:"relative",display:"inline-block",padding:"0 ".concat((0,k.bf)(u)),color:f,fontSize:e.fontSize,lineHeight:e.lineHeight,textAlign:"center","&:first-child":{paddingInlineStart:0}},["".concat(t,"-item-action-split")]:{position:"absolute",insetBlockStart:"50%",insetInlineEnd:0,width:v,height:e.calc(e.fontHeight).sub(e.calc(e.marginXXS).mul(2)).equal(),transform:"translateY(-50%)",backgroundColor:e.colorSplit}}},["".concat(t,"-empty")]:{padding:"".concat((0,k.bf)(l)," 0"),color:f,fontSize:e.fontSizeSM,textAlign:"center"},["".concat(t,"-empty-text")]:{padding:y,color:e.colorTextDisabled,fontSize:e.fontSize,textAlign:"center"},["".concat(t,"-item-no-flex")]:{display:"block"}}),["".concat(t,"-grid ").concat(n,"-col > ").concat(t,"-item")]:{display:"block",maxWidth:"100%",marginBlockEnd:g,paddingBlock:0,borderBlockEnd:"none"},["".concat(t,"-vertical ").concat(t,"-item")]:{alignItems:"initial",["".concat(t,"-item-main")]:{display:"block",flex:1},["".concat(t,"-item-extra")]:{marginInlineStart:r},["".concat(t,"-item-meta")]:{marginBlockEnd:w,["".concat(t,"-item-meta-title")]:{marginBlockStart:0,marginBlockEnd:C,color:p,fontSize:e.fontSizeLG,lineHeight:e.lineHeightLG}},["".concat(t,"-item-action")]:{marginBlockStart:l,marginInlineStart:"auto","> li":{padding:"0 ".concat((0,k.bf)(l)),"&:first-child":{paddingInlineStart:0}}}},["".concat(t,"-split ").concat(t,"-item")]:{borderBlockEnd:"".concat((0,k.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorSplit),"&:last-child":{borderBlockEnd:"none"}},["".concat(t,"-split ").concat(t,"-header")]:{borderBlockEnd:"".concat((0,k.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorSplit)},["".concat(t,"-split").concat(t,"-empty ").concat(t,"-footer")]:{borderTop:"".concat((0,k.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorSplit)},["".concat(t,"-loading ").concat(t,"-spin-nested-loading")]:{minHeight:a},["".concat(t,"-split").concat(t,"-something-after-last-item ").concat(n,"-spin-container > ").concat(t,"-items > ").concat(t,"-item:last-child")]:{borderBlockEnd:"".concat((0,k.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorSplit)},["".concat(t,"-lg ").concat(t,"-item")]:{padding:m},["".concat(t,"-sm ").concat(t,"-item")]:{padding:d},["".concat(t,":not(").concat(t,"-vertical)")]:{["".concat(t,"-item-no-flex")]:{["".concat(t,"-item-action")]:{float:"right"}}}}};var M=(0,w.I$)("List",e=>{let t=(0,E.IX)(e,{listBorderedCls:"".concat(e.componentCls,"-bordered"),minHeight:e.controlHeightLG});return[z(t),C(t),N(t)]},e=>({contentWidth:220,itemPadding:"".concat((0,k.bf)(e.paddingContentVertical)," 0"),itemPaddingSM:"".concat((0,k.bf)(e.paddingContentVerticalSM)," ").concat((0,k.bf)(e.paddingContentHorizontal)),itemPaddingLG:"".concat((0,k.bf)(e.paddingContentVerticalLG)," ").concat((0,k.bf)(e.paddingContentHorizontalLG)),headerBg:"transparent",footerBg:"transparent",emptyTextPadding:e.padding,metaMarginBottom:e.padding,avatarMarginRight:e.padding,titleMarginBottom:e.paddingSM,descriptionFontSize:e.fontSize})),O=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&0>t.indexOf(a)&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var c=0,a=Object.getOwnPropertySymbols(e);ct.indexOf(a[c])&&Object.prototype.propertyIsEnumerable.call(e,a[c])&&(n[a[c]]=e[a[c]]);return n};let Z=c.forwardRef(function(e,t){let{pagination:n=!1,prefixCls:o,bordered:v=!1,split:b=!0,className:x,rootClassName:y,style:k,children:S,itemLayout:w,loadMore:E,grid:C,dataSource:N=[],size:z,header:Z,footer:I,loading:j=!1,rowKey:H,renderItem:B,locale:L}=e,T=O(e,["pagination","prefixCls","bordered","split","className","rootClassName","style","children","itemLayout","loadMore","grid","dataSource","size","header","footer","loading","rowKey","renderItem","locale"]),V=n&&"object"==typeof n?n:{},[R,W]=c.useState(V.defaultCurrent||1),[_,P]=c.useState(V.defaultPageSize||10),{getPrefixCls:D,direction:q,className:A,style:G}=(0,s.dj)("list"),{renderEmpty:U}=c.useContext(s.E_),X=e=>(t,a)=>{var c;W(t),P(a),n&&(null===(c=null==n?void 0:n[e])||void 0===c||c.call(n,t,a))},K=X("onChange"),F=X("onShowSizeChange"),J=!!(E||n||I),Y=D("list",o),[$,Q,ee]=M(Y),et=j;"boolean"==typeof et&&(et={spinning:et});let en=!!(null==et?void 0:et.spinning),ea=(0,m.Z)(z),ec="";switch(ea){case"large":ec="lg";break;case"small":ec="sm"}let eo=r()(Y,{["".concat(Y,"-vertical")]:"vertical"===w,["".concat(Y,"-").concat(ec)]:ec,["".concat(Y,"-split")]:b,["".concat(Y,"-bordered")]:v,["".concat(Y,"-loading")]:en,["".concat(Y,"-grid")]:!!C,["".concat(Y,"-something-after-last-item")]:J,["".concat(Y,"-rtl")]:"rtl"===q},A,x,y,Q,ee),er=(0,l.Z)({current:1,total:0,position:"bottom"},{total:N.length,current:R,pageSize:_},n||{}),el=Math.ceil(er.total/er.pageSize);er.current=Math.min(er.current,el);let ei=n&&c.createElement("div",{className:r()("".concat(Y,"-pagination"))},c.createElement(p.Z,Object.assign({align:"end"},er,{onChange:K,onShowSizeChange:F}))),es=(0,a.Z)(N);n&&N.length>(er.current-1)*er.pageSize&&(es=(0,a.Z)(N).splice((er.current-1)*er.pageSize,er.pageSize));let ed=Object.keys(C||{}).some(e=>["xs","sm","md","lg","xl","xxl"].includes(e)),em=(0,g.Z)(ed),eu=c.useMemo(()=>{for(let e=0;e{if(!C)return;let e=eu&&C[eu]?C[eu]:C.column;if(e)return{width:"".concat(100/e,"%"),maxWidth:"".concat(100/e,"%")}},[JSON.stringify(C),eu]),ep=en&&c.createElement("div",{style:{minHeight:53}});if(es.length>0){let e=es.map((e,t)=>{let n;return B?((n="function"==typeof H?H(e):H?e[H]:e.key)||(n="list-item-".concat(t)),c.createElement(c.Fragment,{key:n},B(e,t))):null});ep=C?c.createElement(u.Z,{gutter:C.gutter},c.Children.map(e,e=>c.createElement("div",{key:null==e?void 0:e.key,style:eg},e))):c.createElement("ul",{className:"".concat(Y,"-items")},e)}else S||en||(ep=c.createElement("div",{className:"".concat(Y,"-empty-text")},(null==L?void 0:L.emptyText)||(null==U?void 0:U("List"))||c.createElement(d.Z,{componentName:"List"})));let ef=er.position,eh=c.useMemo(()=>({grid:C,itemLayout:w}),[JSON.stringify(C),w]);return $(c.createElement(h.Provider,{value:eh},c.createElement("div",Object.assign({ref:t,style:Object.assign(Object.assign({},G),k),className:eo},T),("top"===ef||"both"===ef)&&ei,Z&&c.createElement("div",{className:"".concat(Y,"-header")},Z),c.createElement(f.Z,Object.assign({},et),ep,S),I&&c.createElement("div",{className:"".concat(Y,"-footer")},I),E||("bottom"===ef||"both"===ef)&&ei)))});Z.Item=y;var I=Z},30401:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(79205).Z)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},10900:function(e,t,n){var a=n(2265);let c=a.forwardRef(function(e,t){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"}))});t.Z=c}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2004-294ce010a90069b4.js b/litellm/proxy/_experimental/out/_next/static/chunks/2004-1eb16c345c0044ae.js similarity index 99% rename from litellm/proxy/_experimental/out/_next/static/chunks/2004-294ce010a90069b4.js rename to litellm/proxy/_experimental/out/_next/static/chunks/2004-1eb16c345c0044ae.js index 280fafea373..00fba328e8c 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/2004-294ce010a90069b4.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/2004-1eb16c345c0044ae.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2004],{22004:function(e,l,s){s.d(l,{Z:function(){return ee},g:function(){return X}});var i=s(57437),a=s(2265),r=s(41649),t=s(78489),n=s(12514),o=s(49804),d=s(67101),c=s(47323),m=s(12485),u=s(18135),x=s(35242),h=s(29706),_=s(77991),g=s(21626),j=s(97214),p=s(28241),v=s(58834),Z=s(69552),b=s(71876),f=s(84264),w=s(24199),z=s(4260),y=s(10032),N=s(99981),C=s(22116),S=s(37592),O=s(15424),M=s(23628),k=s(86462),I=s(47686),P=s(53410),A=s(74998),T=s(31283),D=s(46468),F=s(59872),L=s(10900),R=s(49566),U=s(96761),E=s(5545),B=s(30401),V=s(78867),q=s(33860),G=s(95920),W=s(9114),$=s(19250),J=s(98015),Q=s(10901),Y=s(97415),H=e=>{var l,s,o,N,C;let{organizationId:O,onClose:M,accessToken:k,is_org_admin:I,is_proxy_admin:T,userModels:H,editOrg:K}=e,[X,ee]=(0,a.useState)(null),[el,es]=(0,a.useState)(!0),[ei]=y.Z.useForm(),[ea,er]=(0,a.useState)(!1),[et,en]=(0,a.useState)(!1),[eo,ed]=(0,a.useState)(!1),[ec,em]=(0,a.useState)(null),[eu,ex]=(0,a.useState)({}),[eh,e_]=(0,a.useState)(!1),eg=I||T,ej=async()=>{try{if(es(!0),!k)return;let e=await (0,$.organizationInfoCall)(k,O);ee(e)}catch(e){W.Z.fromBackend("Failed to load organization information"),console.error("Error fetching organization info:",e)}finally{es(!1)}};(0,a.useEffect)(()=>{ej()},[O,k]);let ep=async e=>{try{if(null==k)return;let l={user_email:e.user_email,user_id:e.user_id,role:e.role};await (0,$.organizationMemberAddCall)(k,O,l),W.Z.success("Organization member added successfully"),en(!1),ei.resetFields(),ej()}catch(e){W.Z.fromBackend("Failed to add organization member"),console.error("Error adding organization member:",e)}},ev=async e=>{try{if(!k)return;let l={user_email:e.user_email,user_id:e.user_id,role:e.role};await (0,$.organizationMemberUpdateCall)(k,O,l),W.Z.success("Organization member updated successfully"),ed(!1),ei.resetFields(),ej()}catch(e){W.Z.fromBackend("Failed to update organization member"),console.error("Error updating organization member:",e)}},eZ=async e=>{try{if(!k)return;await (0,$.organizationMemberDeleteCall)(k,O,e.user_id),W.Z.success("Organization member deleted successfully"),ed(!1),ei.resetFields(),ej()}catch(e){W.Z.fromBackend("Failed to delete organization member"),console.error("Error deleting organization member:",e)}},eb=async e=>{try{if(!k)return;e_(!0);let l={organization_id:O,organization_alias:e.organization_alias,models:e.models,litellm_budget_table:{tpm_limit:e.tpm_limit,rpm_limit:e.rpm_limit,max_budget:e.max_budget,budget_duration:e.budget_duration},metadata:e.metadata?JSON.parse(e.metadata):null};if((void 0!==e.vector_stores||void 0!==e.mcp_servers_and_groups)&&(l.object_permission={...null==X?void 0:X.object_permission,vector_stores:e.vector_stores||[]},void 0!==e.mcp_servers_and_groups)){let{servers:s,accessGroups:i}=e.mcp_servers_and_groups||{servers:[],accessGroups:[]};s&&s.length>0&&(l.object_permission.mcp_servers=s),i&&i.length>0&&(l.object_permission.mcp_access_groups=i)}await (0,$.organizationUpdateCall)(k,l),W.Z.success("Organization settings updated successfully"),er(!1),ej()}catch(e){W.Z.fromBackend("Failed to update organization settings"),console.error("Error updating organization:",e)}finally{e_(!1)}};if(el)return(0,i.jsx)("div",{className:"p-4",children:"Loading..."});if(!X)return(0,i.jsx)("div",{className:"p-4",children:"Organization not found"});let ef=async(e,l)=>{await (0,F.vQ)(e)&&(ex(e=>({...e,[l]:!0})),setTimeout(()=>{ex(e=>({...e,[l]:!1}))},2e3))};return(0,i.jsxs)("div",{className:"w-full h-screen p-4 bg-white",children:[(0,i.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,i.jsxs)("div",{children:[(0,i.jsx)(t.Z,{icon:L.Z,onClick:M,variant:"light",className:"mb-4",children:"Back to Organizations"}),(0,i.jsx)(U.Z,{children:X.organization_alias}),(0,i.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,i.jsx)(f.Z,{className:"text-gray-500 font-mono",children:X.organization_id}),(0,i.jsx)(E.ZP,{type:"text",size:"small",icon:eu["org-id"]?(0,i.jsx)(B.Z,{size:12}):(0,i.jsx)(V.Z,{size:12}),onClick:()=>ef(X.organization_id,"org-id"),className:"left-2 z-10 transition-all duration-200 ".concat(eu["org-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]})}),(0,i.jsxs)(u.Z,{defaultIndex:K?2:0,children:[(0,i.jsxs)(x.Z,{className:"mb-4",children:[(0,i.jsx)(m.Z,{children:"Overview"}),(0,i.jsx)(m.Z,{children:"Members"}),(0,i.jsx)(m.Z,{children:"Settings"})]}),(0,i.jsxs)(_.Z,{children:[(0,i.jsx)(h.Z,{children:(0,i.jsxs)(d.Z,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,i.jsxs)(n.Z,{children:[(0,i.jsx)(f.Z,{children:"Organization Details"}),(0,i.jsxs)("div",{className:"mt-2",children:[(0,i.jsxs)(f.Z,{children:["Created: ",new Date(X.created_at).toLocaleDateString()]}),(0,i.jsxs)(f.Z,{children:["Updated: ",new Date(X.updated_at).toLocaleDateString()]}),(0,i.jsxs)(f.Z,{children:["Created By: ",X.created_by]})]})]}),(0,i.jsxs)(n.Z,{children:[(0,i.jsx)(f.Z,{children:"Budget Status"}),(0,i.jsxs)("div",{className:"mt-2",children:[(0,i.jsxs)(U.Z,{children:["$",(0,F.pw)(X.spend,4)]}),(0,i.jsxs)(f.Z,{children:["of"," ",null===X.litellm_budget_table.max_budget?"Unlimited":"$".concat((0,F.pw)(X.litellm_budget_table.max_budget,4))]}),X.litellm_budget_table.budget_duration&&(0,i.jsxs)(f.Z,{className:"text-gray-500",children:["Reset: ",X.litellm_budget_table.budget_duration]})]})]}),(0,i.jsxs)(n.Z,{children:[(0,i.jsx)(f.Z,{children:"Rate Limits"}),(0,i.jsxs)("div",{className:"mt-2",children:[(0,i.jsxs)(f.Z,{children:["TPM: ",X.litellm_budget_table.tpm_limit||"Unlimited"]}),(0,i.jsxs)(f.Z,{children:["RPM: ",X.litellm_budget_table.rpm_limit||"Unlimited"]}),X.litellm_budget_table.max_parallel_requests&&(0,i.jsxs)(f.Z,{children:["Max Parallel Requests: ",X.litellm_budget_table.max_parallel_requests]})]})]}),(0,i.jsxs)(n.Z,{children:[(0,i.jsx)(f.Z,{children:"Models"}),(0,i.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:0===X.models.length?(0,i.jsx)(r.Z,{color:"red",children:"All proxy models"}):X.models.map((e,l)=>(0,i.jsx)(r.Z,{color:"red",children:e},l))})]}),(0,i.jsxs)(n.Z,{children:[(0,i.jsx)(f.Z,{children:"Teams"}),(0,i.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:null===(l=X.teams)||void 0===l?void 0:l.map((e,l)=>(0,i.jsx)(r.Z,{color:"red",children:e.team_id},l))})]}),(0,i.jsx)(J.Z,{objectPermission:X.object_permission,variant:"card",accessToken:k})]})}),(0,i.jsx)(h.Z,{children:(0,i.jsxs)("div",{className:"space-y-4",children:[(0,i.jsx)(n.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[75vh]",children:(0,i.jsxs)(g.Z,{children:[(0,i.jsx)(v.Z,{children:(0,i.jsxs)(b.Z,{children:[(0,i.jsx)(Z.Z,{children:"User ID"}),(0,i.jsx)(Z.Z,{children:"Role"}),(0,i.jsx)(Z.Z,{children:"Spend"}),(0,i.jsx)(Z.Z,{children:"Created At"}),(0,i.jsx)(Z.Z,{})]})}),(0,i.jsx)(j.Z,{children:null===(s=X.members)||void 0===s?void 0:s.map((e,l)=>(0,i.jsxs)(b.Z,{children:[(0,i.jsx)(p.Z,{children:(0,i.jsx)(f.Z,{className:"font-mono",children:e.user_id})}),(0,i.jsx)(p.Z,{children:(0,i.jsx)(f.Z,{className:"font-mono",children:e.user_role})}),(0,i.jsx)(p.Z,{children:(0,i.jsxs)(f.Z,{children:["$",(0,F.pw)(e.spend,4)]})}),(0,i.jsx)(p.Z,{children:(0,i.jsx)(f.Z,{children:new Date(e.created_at).toLocaleString()})}),(0,i.jsx)(p.Z,{children:eg&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(c.Z,{icon:P.Z,size:"sm",onClick:()=>{em({role:e.user_role,user_email:e.user_email,user_id:e.user_id}),ed(!0)}}),(0,i.jsx)(c.Z,{icon:A.Z,size:"sm",onClick:()=>{eZ(e)}})]})})]},l))})]})}),eg&&(0,i.jsx)(t.Z,{onClick:()=>{en(!0)},children:"Add Member"})]})}),(0,i.jsx)(h.Z,{children:(0,i.jsxs)(n.Z,{className:"overflow-y-auto max-h-[65vh]",children:[(0,i.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,i.jsx)(U.Z,{children:"Organization Settings"}),eg&&!ea&&(0,i.jsx)(t.Z,{onClick:()=>er(!0),children:"Edit Settings"})]}),ea?(0,i.jsxs)(y.Z,{form:ei,onFinish:eb,initialValues:{organization_alias:X.organization_alias,models:X.models,tpm_limit:X.litellm_budget_table.tpm_limit,rpm_limit:X.litellm_budget_table.rpm_limit,max_budget:X.litellm_budget_table.max_budget,budget_duration:X.litellm_budget_table.budget_duration,metadata:X.metadata?JSON.stringify(X.metadata,null,2):"",vector_stores:(null===(o=X.object_permission)||void 0===o?void 0:o.vector_stores)||[],mcp_servers_and_groups:{servers:(null===(N=X.object_permission)||void 0===N?void 0:N.mcp_servers)||[],accessGroups:(null===(C=X.object_permission)||void 0===C?void 0:C.mcp_access_groups)||[]}},layout:"vertical",children:[(0,i.jsx)(y.Z.Item,{label:"Organization Name",name:"organization_alias",rules:[{required:!0,message:"Please input an organization name"}],children:(0,i.jsx)(R.Z,{})}),(0,i.jsx)(y.Z.Item,{label:"Models",name:"models",children:(0,i.jsxs)(S.default,{mode:"multiple",placeholder:"Select models",children:[(0,i.jsx)(S.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),H.map(e=>(0,i.jsx)(S.default.Option,{value:e,children:(0,D.W0)(e)},e))]})}),(0,i.jsx)(y.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,i.jsx)(w.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,i.jsx)(y.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,i.jsxs)(S.default,{placeholder:"n/a",children:[(0,i.jsx)(S.default.Option,{value:"24h",children:"daily"}),(0,i.jsx)(S.default.Option,{value:"7d",children:"weekly"}),(0,i.jsx)(S.default.Option,{value:"30d",children:"monthly"})]})}),(0,i.jsx)(y.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,i.jsx)(w.Z,{step:1,style:{width:"100%"}})}),(0,i.jsx)(y.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,i.jsx)(w.Z,{step:1,style:{width:"100%"}})}),(0,i.jsx)(y.Z.Item,{label:"Vector Stores",name:"vector_stores",children:(0,i.jsx)(Y.Z,{onChange:e=>ei.setFieldValue("vector_stores",e),value:ei.getFieldValue("vector_stores"),accessToken:k||"",placeholder:"Select vector stores"})}),(0,i.jsx)(y.Z.Item,{label:"MCP Servers & Access Groups",name:"mcp_servers_and_groups",children:(0,i.jsx)(G.Z,{onChange:e=>ei.setFieldValue("mcp_servers_and_groups",e),value:ei.getFieldValue("mcp_servers_and_groups"),accessToken:k||"",placeholder:"Select MCP servers and access groups"})}),(0,i.jsx)(y.Z.Item,{label:"Metadata",name:"metadata",children:(0,i.jsx)(z.default.TextArea,{rows:4})}),(0,i.jsx)("div",{className:"sticky z-10 bg-white p-4 border-t border-gray-200 bottom-[-1.5rem] inset-x-[-1.5rem]",children:(0,i.jsxs)("div",{className:"flex justify-end items-center gap-2",children:[(0,i.jsx)(t.Z,{variant:"secondary",onClick:()=>er(!1),disabled:eh,children:"Cancel"}),(0,i.jsx)(t.Z,{type:"submit",loading:eh,children:"Save Changes"})]})})]}):(0,i.jsxs)("div",{className:"space-y-4",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)(f.Z,{className:"font-medium",children:"Organization Name"}),(0,i.jsx)("div",{children:X.organization_alias})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(f.Z,{className:"font-medium",children:"Organization ID"}),(0,i.jsx)("div",{className:"font-mono",children:X.organization_id})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(f.Z,{className:"font-medium",children:"Created At"}),(0,i.jsx)("div",{children:new Date(X.created_at).toLocaleString()})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(f.Z,{className:"font-medium",children:"Models"}),(0,i.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:X.models.map((e,l)=>(0,i.jsx)(r.Z,{color:"red",children:e},l))})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(f.Z,{className:"font-medium",children:"Rate Limits"}),(0,i.jsxs)("div",{children:["TPM: ",X.litellm_budget_table.tpm_limit||"Unlimited"]}),(0,i.jsxs)("div",{children:["RPM: ",X.litellm_budget_table.rpm_limit||"Unlimited"]})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(f.Z,{className:"font-medium",children:"Budget"}),(0,i.jsxs)("div",{children:["Max:"," ",null!==X.litellm_budget_table.max_budget?"$".concat((0,F.pw)(X.litellm_budget_table.max_budget,4)):"No Limit"]}),(0,i.jsxs)("div",{children:["Reset: ",X.litellm_budget_table.budget_duration||"Never"]})]}),(0,i.jsx)(J.Z,{objectPermission:X.object_permission,variant:"inline",className:"pt-4 border-t border-gray-200",accessToken:k})]})]})})]})]}),(0,i.jsx)(q.Z,{isVisible:et,onCancel:()=>en(!1),onSubmit:ep,accessToken:k,title:"Add Organization Member",roles:[{label:"org_admin",value:"org_admin",description:"Can add and remove members, and change their roles."},{label:"internal_user",value:"internal_user",description:"Can view/create keys for themselves within organization."},{label:"internal_user_viewer",value:"internal_user_viewer",description:"Can only view their keys within organization."}],defaultRole:"internal_user"}),(0,i.jsx)(Q.Z,{visible:eo,onCancel:()=>ed(!1),onSubmit:ev,initialData:ec,mode:"edit",config:{title:"Edit Member",showEmail:!0,showUserId:!0,roleOptions:[{label:"Org Admin",value:"org_admin"},{label:"Internal User",value:"internal_user"},{label:"Internal User Viewer",value:"internal_user_viewer"}]}})]})},K=s(21609);let X=async(e,l)=>{l(await (0,$.organizationListCall)(e))};var ee=e=>{let{organizations:l,userRole:s,userModels:L,accessToken:R,lastRefreshed:U,handleRefreshClick:E,currentOrg:B,guardrailsList:V=[],setOrganizations:q,premiumUser:J}=e,[Q,ee]=(0,a.useState)(null),[el,es]=(0,a.useState)(!1),[ei,ea]=(0,a.useState)(!1),[er,et]=(0,a.useState)(null),[en,eo]=(0,a.useState)(!1),[ed,ec]=(0,a.useState)(!1),[em]=y.Z.useForm(),[eu,ex]=(0,a.useState)({});(0,a.useEffect)(()=>{R&&X(R,q)},[R]);let eh=e=>{e&&(et(e),ea(!0))},e_=async()=>{if(er&&R)try{eo(!0),await (0,$.organizationDeleteCall)(R,er),W.Z.success("Organization deleted successfully"),ea(!1),et(null),await X(R,q)}catch(e){console.error("Error deleting organization:",e)}finally{eo(!1)}},eg=async e=>{try{var l,s,i,a;if(!R)return;console.log("values in organizations new create call: ".concat(JSON.stringify(e))),(e.allowed_vector_store_ids&&e.allowed_vector_store_ids.length>0||e.allowed_mcp_servers_and_groups&&((null===(l=e.allowed_mcp_servers_and_groups.servers)||void 0===l?void 0:l.length)>0||(null===(s=e.allowed_mcp_servers_and_groups.accessGroups)||void 0===s?void 0:s.length)>0))&&(e.object_permission={},e.allowed_vector_store_ids&&e.allowed_vector_store_ids.length>0&&(e.object_permission.vector_stores=e.allowed_vector_store_ids,delete e.allowed_vector_store_ids),e.allowed_mcp_servers_and_groups&&((null===(i=e.allowed_mcp_servers_and_groups.servers)||void 0===i?void 0:i.length)>0&&(e.object_permission.mcp_servers=e.allowed_mcp_servers_and_groups.servers),(null===(a=e.allowed_mcp_servers_and_groups.accessGroups)||void 0===a?void 0:a.length)>0&&(e.object_permission.mcp_access_groups=e.allowed_mcp_servers_and_groups.accessGroups),delete e.allowed_mcp_servers_and_groups)),await (0,$.organizationCreateCall)(R,e),W.Z.success("Organization created successfully"),ec(!1),em.resetFields(),X(R,q)}catch(e){console.error("Error creating organization:",e)}};return J?(0,i.jsxs)("div",{className:"w-full mx-4 h-[75vh]",children:[(0,i.jsx)(d.Z,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:(0,i.jsxs)(o.Z,{numColSpan:1,className:"flex flex-col gap-2",children:[("Admin"===s||"Org Admin"===s)&&(0,i.jsx)(t.Z,{className:"w-fit",onClick:()=>ec(!0),children:"+ Create New Organization"}),Q?(0,i.jsx)(H,{organizationId:Q,onClose:()=>{ee(null),es(!1)},accessToken:R,is_org_admin:!0,is_proxy_admin:"Admin"===s,userModels:L,editOrg:el}):(0,i.jsxs)(u.Z,{className:"gap-2 h-[75vh] w-full",children:[(0,i.jsxs)(x.Z,{className:"flex justify-between mt-2 w-full items-center",children:[(0,i.jsx)("div",{className:"flex",children:(0,i.jsx)(m.Z,{children:"Your Organizations"})}),(0,i.jsxs)("div",{className:"flex items-center space-x-2",children:[U&&(0,i.jsxs)(f.Z,{children:["Last Refreshed: ",U]}),(0,i.jsx)(c.Z,{icon:M.Z,variant:"shadow",size:"xs",className:"self-center",onClick:E})]})]}),(0,i.jsx)(_.Z,{children:(0,i.jsxs)(h.Z,{children:[(0,i.jsx)(f.Z,{children:"Click on ā€œOrganization IDā€ to view organization details."}),(0,i.jsx)(d.Z,{numItems:1,className:"gap-2 pt-2 pb-2 h-[75vh] w-full mt-2",children:(0,i.jsx)(o.Z,{numColSpan:1,children:(0,i.jsx)(n.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[50vh]",children:(0,i.jsxs)(g.Z,{children:[(0,i.jsx)(v.Z,{children:(0,i.jsxs)(b.Z,{children:[(0,i.jsx)(Z.Z,{children:"Organization ID"}),(0,i.jsx)(Z.Z,{children:"Organization Name"}),(0,i.jsx)(Z.Z,{children:"Created"}),(0,i.jsx)(Z.Z,{children:"Spend (USD)"}),(0,i.jsx)(Z.Z,{children:"Budget (USD)"}),(0,i.jsx)(Z.Z,{children:"Models"}),(0,i.jsx)(Z.Z,{children:"TPM / RPM Limits"}),(0,i.jsx)(Z.Z,{children:"Info"}),(0,i.jsx)(Z.Z,{children:"Actions"})]})}),(0,i.jsx)(j.Z,{children:l&&l.length>0?l.sort((e,l)=>new Date(l.created_at).getTime()-new Date(e.created_at).getTime()).map(e=>{var l,a,n,o,d,m,u,x,h;return(0,i.jsxs)(b.Z,{children:[(0,i.jsx)(p.Z,{children:(0,i.jsx)("div",{className:"overflow-hidden",children:(0,i.jsx)(N.Z,{title:e.organization_id,children:(0,i.jsxs)(t.Z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate max-w-[200px]",onClick:()=>ee(e.organization_id),children:[null===(l=e.organization_id)||void 0===l?void 0:l.slice(0,7),"..."]})})})}),(0,i.jsx)(p.Z,{children:e.organization_alias}),(0,i.jsx)(p.Z,{children:e.created_at?new Date(e.created_at).toLocaleDateString():"N/A"}),(0,i.jsx)(p.Z,{children:(0,F.pw)(e.spend,4)}),(0,i.jsx)(p.Z,{children:(null===(a=e.litellm_budget_table)||void 0===a?void 0:a.max_budget)!==null&&(null===(n=e.litellm_budget_table)||void 0===n?void 0:n.max_budget)!==void 0?null===(o=e.litellm_budget_table)||void 0===o?void 0:o.max_budget:"No limit"}),(0,i.jsx)(p.Z,{style:{maxWidth:"8-x",whiteSpace:"pre-wrap",overflow:"hidden"},className:e.models.length>3?"px-0":"",children:(0,i.jsx)("div",{className:"flex flex-col",children:Array.isArray(e.models)?(0,i.jsx)("div",{className:"flex flex-col",children:0===e.models.length?(0,i.jsx)(r.Z,{size:"xs",className:"mb-1",color:"red",children:(0,i.jsx)(f.Z,{children:"All Proxy Models"})}):(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)("div",{className:"flex items-start",children:[e.models.length>3&&(0,i.jsx)("div",{children:(0,i.jsx)(c.Z,{icon:eu[e.organization_id||""]?k.Z:I.Z,className:"cursor-pointer",size:"xs",onClick:()=>{ex(l=>({...l,[e.organization_id||""]:!l[e.organization_id||""]}))}})}),(0,i.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.models.slice(0,3).map((e,l)=>"all-proxy-models"===e?(0,i.jsx)(r.Z,{size:"xs",color:"red",children:(0,i.jsx)(f.Z,{children:"All Proxy Models"})},l):(0,i.jsx)(r.Z,{size:"xs",color:"blue",children:(0,i.jsx)(f.Z,{children:e.length>30?"".concat((0,D.W0)(e).slice(0,30),"..."):(0,D.W0)(e)})},l)),e.models.length>3&&!eu[e.organization_id||""]&&(0,i.jsx)(r.Z,{size:"xs",color:"gray",className:"cursor-pointer",children:(0,i.jsxs)(f.Z,{children:["+",e.models.length-3," ",e.models.length-3==1?"more model":"more models"]})}),eu[e.organization_id||""]&&(0,i.jsx)("div",{className:"flex flex-wrap gap-1",children:e.models.slice(3).map((e,l)=>"all-proxy-models"===e?(0,i.jsx)(r.Z,{size:"xs",color:"red",children:(0,i.jsx)(f.Z,{children:"All Proxy Models"})},l+3):(0,i.jsx)(r.Z,{size:"xs",color:"blue",children:(0,i.jsx)(f.Z,{children:e.length>30?"".concat((0,D.W0)(e).slice(0,30),"..."):(0,D.W0)(e)})},l+3))})]})]})})}):null})}),(0,i.jsx)(p.Z,{children:(0,i.jsxs)(f.Z,{children:["TPM:"," ",(null===(d=e.litellm_budget_table)||void 0===d?void 0:d.tpm_limit)?null===(m=e.litellm_budget_table)||void 0===m?void 0:m.tpm_limit:"Unlimited",(0,i.jsx)("br",{}),"RPM:"," ",(null===(u=e.litellm_budget_table)||void 0===u?void 0:u.rpm_limit)?null===(x=e.litellm_budget_table)||void 0===x?void 0:x.rpm_limit:"Unlimited"]})}),(0,i.jsx)(p.Z,{children:(0,i.jsxs)(f.Z,{children:[(null===(h=e.members)||void 0===h?void 0:h.length)||0," Members"]})}),(0,i.jsx)(p.Z,{children:"Admin"===s&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(N.Z,{title:"Edit organization",children:[" ",(0,i.jsx)(c.Z,{icon:P.Z,size:"sm",className:"cursor-pointer hover:text-blue-600",onClick:()=>{ee(e.organization_id),es(!0)}})]}),(0,i.jsxs)(N.Z,{title:"Delete organization",children:[" ",(0,i.jsx)(c.Z,{onClick:()=>eh(e.organization_id),icon:A.Z,size:"sm",className:"cursor-pointer hover:text-red-600"})]})]})})]},e.organization_id)}):null})]})})})})]})})]})]})}),(0,i.jsx)(C.Z,{title:"Create Organization",visible:ed,width:800,footer:null,onCancel:()=>{ec(!1),em.resetFields()},children:(0,i.jsxs)(y.Z,{form:em,onFinish:eg,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,i.jsx)(y.Z.Item,{label:"Organization Name",name:"organization_alias",rules:[{required:!0,message:"Please input an organization name"}],children:(0,i.jsx)(T.o,{placeholder:""})}),(0,i.jsx)(y.Z.Item,{label:"Models",name:"models",children:(0,i.jsxs)(S.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:[(0,i.jsx)(S.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),L&&L.length>0&&L.map(e=>(0,i.jsx)(S.default.Option,{value:e,children:(0,D.W0)(e)},e))]})}),(0,i.jsx)(y.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,i.jsx)(w.Z,{step:.01,precision:2,width:200})}),(0,i.jsx)(y.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,i.jsxs)(S.default,{defaultValue:null,placeholder:"n/a",children:[(0,i.jsx)(S.default.Option,{value:"24h",children:"daily"}),(0,i.jsx)(S.default.Option,{value:"7d",children:"weekly"}),(0,i.jsx)(S.default.Option,{value:"30d",children:"monthly"})]})}),(0,i.jsx)(y.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,i.jsx)(w.Z,{step:1,width:400})}),(0,i.jsx)(y.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,i.jsx)(w.Z,{step:1,width:400})}),(0,i.jsx)(y.Z.Item,{label:(0,i.jsxs)("span",{children:["Allowed Vector Stores"," ",(0,i.jsx)(N.Z,{title:"Select which vector stores this organization can access by default. Leave empty for access to all vector stores",children:(0,i.jsx)(O.Z,{style:{marginLeft:"4px"}})})]}),name:"allowed_vector_store_ids",className:"mt-4",help:"Select vector stores this organization can access. Leave empty for access to all vector stores",children:(0,i.jsx)(Y.Z,{onChange:e=>em.setFieldValue("allowed_vector_store_ids",e),value:em.getFieldValue("allowed_vector_store_ids"),accessToken:R||"",placeholder:"Select vector stores (optional)"})}),(0,i.jsx)(y.Z.Item,{label:(0,i.jsxs)("span",{children:["Allowed MCP Servers"," ",(0,i.jsx)(N.Z,{title:"Select which MCP servers and access groups this organization can access by default.",children:(0,i.jsx)(O.Z,{style:{marginLeft:"4px"}})})]}),name:"allowed_mcp_servers_and_groups",className:"mt-4",help:"Select MCP servers and access groups this organization can access.",children:(0,i.jsx)(G.Z,{onChange:e=>em.setFieldValue("allowed_mcp_servers_and_groups",e),value:em.getFieldValue("allowed_mcp_servers_and_groups"),accessToken:R||"",placeholder:"Select MCP servers and access groups (optional)"})}),(0,i.jsx)(y.Z.Item,{label:"Metadata",name:"metadata",children:(0,i.jsx)(z.default.TextArea,{rows:4})}),(0,i.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,i.jsx)(t.Z,{type:"submit",children:"Create Organization"})})]})}),(0,i.jsx)(K.Z,{isOpen:ei,title:"Delete Organization?",message:"Are you sure you want to delete this organization? This action cannot be undone.",resourceInformationTitle:"Organization Information",resourceInformation:[{label:"Organization ID",value:er,code:!0}],onCancel:()=>{ea(!1),et(null)},onOk:e_,confirmLoading:en})]}):(0,i.jsx)("div",{children:(0,i.jsxs)(f.Z,{children:["This is a LiteLLM Enterprise feature, and requires a valid key to use. Get a trial key"," ",(0,i.jsx)("a",{href:"https://www.litellm.ai/#pricing",target:"_blank",rel:"noopener noreferrer",children:"here"}),"."]})})}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2004],{22004:function(e,l,s){s.d(l,{Z:function(){return ee},g:function(){return X}});var i=s(57437),a=s(2265),r=s(41649),t=s(78489),n=s(12514),o=s(49804),d=s(67101),c=s(47323),m=s(12485),u=s(18135),x=s(35242),h=s(29706),_=s(77991),g=s(21626),j=s(97214),p=s(28241),v=s(58834),Z=s(69552),b=s(71876),f=s(84264),w=s(24199),z=s(4260),y=s(10032),N=s(99981),C=s(22116),S=s(37592),O=s(15424),M=s(23628),k=s(86462),I=s(47686),P=s(53410),A=s(74998),T=s(31283),D=s(46468),F=s(59872),L=s(77331),R=s(49566),U=s(96761),E=s(5545),B=s(30401),V=s(78867),q=s(33860),G=s(95920),W=s(9114),$=s(19250),J=s(60131),Q=s(10901),Y=s(97415),H=e=>{var l,s,o,N,C;let{organizationId:O,onClose:M,accessToken:k,is_org_admin:I,is_proxy_admin:T,userModels:H,editOrg:K}=e,[X,ee]=(0,a.useState)(null),[el,es]=(0,a.useState)(!0),[ei]=y.Z.useForm(),[ea,er]=(0,a.useState)(!1),[et,en]=(0,a.useState)(!1),[eo,ed]=(0,a.useState)(!1),[ec,em]=(0,a.useState)(null),[eu,ex]=(0,a.useState)({}),[eh,e_]=(0,a.useState)(!1),eg=I||T,ej=async()=>{try{if(es(!0),!k)return;let e=await (0,$.organizationInfoCall)(k,O);ee(e)}catch(e){W.Z.fromBackend("Failed to load organization information"),console.error("Error fetching organization info:",e)}finally{es(!1)}};(0,a.useEffect)(()=>{ej()},[O,k]);let ep=async e=>{try{if(null==k)return;let l={user_email:e.user_email,user_id:e.user_id,role:e.role};await (0,$.organizationMemberAddCall)(k,O,l),W.Z.success("Organization member added successfully"),en(!1),ei.resetFields(),ej()}catch(e){W.Z.fromBackend("Failed to add organization member"),console.error("Error adding organization member:",e)}},ev=async e=>{try{if(!k)return;let l={user_email:e.user_email,user_id:e.user_id,role:e.role};await (0,$.organizationMemberUpdateCall)(k,O,l),W.Z.success("Organization member updated successfully"),ed(!1),ei.resetFields(),ej()}catch(e){W.Z.fromBackend("Failed to update organization member"),console.error("Error updating organization member:",e)}},eZ=async e=>{try{if(!k)return;await (0,$.organizationMemberDeleteCall)(k,O,e.user_id),W.Z.success("Organization member deleted successfully"),ed(!1),ei.resetFields(),ej()}catch(e){W.Z.fromBackend("Failed to delete organization member"),console.error("Error deleting organization member:",e)}},eb=async e=>{try{if(!k)return;e_(!0);let l={organization_id:O,organization_alias:e.organization_alias,models:e.models,litellm_budget_table:{tpm_limit:e.tpm_limit,rpm_limit:e.rpm_limit,max_budget:e.max_budget,budget_duration:e.budget_duration},metadata:e.metadata?JSON.parse(e.metadata):null};if((void 0!==e.vector_stores||void 0!==e.mcp_servers_and_groups)&&(l.object_permission={...null==X?void 0:X.object_permission,vector_stores:e.vector_stores||[]},void 0!==e.mcp_servers_and_groups)){let{servers:s,accessGroups:i}=e.mcp_servers_and_groups||{servers:[],accessGroups:[]};s&&s.length>0&&(l.object_permission.mcp_servers=s),i&&i.length>0&&(l.object_permission.mcp_access_groups=i)}await (0,$.organizationUpdateCall)(k,l),W.Z.success("Organization settings updated successfully"),er(!1),ej()}catch(e){W.Z.fromBackend("Failed to update organization settings"),console.error("Error updating organization:",e)}finally{e_(!1)}};if(el)return(0,i.jsx)("div",{className:"p-4",children:"Loading..."});if(!X)return(0,i.jsx)("div",{className:"p-4",children:"Organization not found"});let ef=async(e,l)=>{await (0,F.vQ)(e)&&(ex(e=>({...e,[l]:!0})),setTimeout(()=>{ex(e=>({...e,[l]:!1}))},2e3))};return(0,i.jsxs)("div",{className:"w-full h-screen p-4 bg-white",children:[(0,i.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,i.jsxs)("div",{children:[(0,i.jsx)(t.Z,{icon:L.Z,onClick:M,variant:"light",className:"mb-4",children:"Back to Organizations"}),(0,i.jsx)(U.Z,{children:X.organization_alias}),(0,i.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,i.jsx)(f.Z,{className:"text-gray-500 font-mono",children:X.organization_id}),(0,i.jsx)(E.ZP,{type:"text",size:"small",icon:eu["org-id"]?(0,i.jsx)(B.Z,{size:12}):(0,i.jsx)(V.Z,{size:12}),onClick:()=>ef(X.organization_id,"org-id"),className:"left-2 z-10 transition-all duration-200 ".concat(eu["org-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]})}),(0,i.jsxs)(u.Z,{defaultIndex:K?2:0,children:[(0,i.jsxs)(x.Z,{className:"mb-4",children:[(0,i.jsx)(m.Z,{children:"Overview"}),(0,i.jsx)(m.Z,{children:"Members"}),(0,i.jsx)(m.Z,{children:"Settings"})]}),(0,i.jsxs)(_.Z,{children:[(0,i.jsx)(h.Z,{children:(0,i.jsxs)(d.Z,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,i.jsxs)(n.Z,{children:[(0,i.jsx)(f.Z,{children:"Organization Details"}),(0,i.jsxs)("div",{className:"mt-2",children:[(0,i.jsxs)(f.Z,{children:["Created: ",new Date(X.created_at).toLocaleDateString()]}),(0,i.jsxs)(f.Z,{children:["Updated: ",new Date(X.updated_at).toLocaleDateString()]}),(0,i.jsxs)(f.Z,{children:["Created By: ",X.created_by]})]})]}),(0,i.jsxs)(n.Z,{children:[(0,i.jsx)(f.Z,{children:"Budget Status"}),(0,i.jsxs)("div",{className:"mt-2",children:[(0,i.jsxs)(U.Z,{children:["$",(0,F.pw)(X.spend,4)]}),(0,i.jsxs)(f.Z,{children:["of"," ",null===X.litellm_budget_table.max_budget?"Unlimited":"$".concat((0,F.pw)(X.litellm_budget_table.max_budget,4))]}),X.litellm_budget_table.budget_duration&&(0,i.jsxs)(f.Z,{className:"text-gray-500",children:["Reset: ",X.litellm_budget_table.budget_duration]})]})]}),(0,i.jsxs)(n.Z,{children:[(0,i.jsx)(f.Z,{children:"Rate Limits"}),(0,i.jsxs)("div",{className:"mt-2",children:[(0,i.jsxs)(f.Z,{children:["TPM: ",X.litellm_budget_table.tpm_limit||"Unlimited"]}),(0,i.jsxs)(f.Z,{children:["RPM: ",X.litellm_budget_table.rpm_limit||"Unlimited"]}),X.litellm_budget_table.max_parallel_requests&&(0,i.jsxs)(f.Z,{children:["Max Parallel Requests: ",X.litellm_budget_table.max_parallel_requests]})]})]}),(0,i.jsxs)(n.Z,{children:[(0,i.jsx)(f.Z,{children:"Models"}),(0,i.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:0===X.models.length?(0,i.jsx)(r.Z,{color:"red",children:"All proxy models"}):X.models.map((e,l)=>(0,i.jsx)(r.Z,{color:"red",children:e},l))})]}),(0,i.jsxs)(n.Z,{children:[(0,i.jsx)(f.Z,{children:"Teams"}),(0,i.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:null===(l=X.teams)||void 0===l?void 0:l.map((e,l)=>(0,i.jsx)(r.Z,{color:"red",children:e.team_id},l))})]}),(0,i.jsx)(J.Z,{objectPermission:X.object_permission,variant:"card",accessToken:k})]})}),(0,i.jsx)(h.Z,{children:(0,i.jsxs)("div",{className:"space-y-4",children:[(0,i.jsx)(n.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[75vh]",children:(0,i.jsxs)(g.Z,{children:[(0,i.jsx)(v.Z,{children:(0,i.jsxs)(b.Z,{children:[(0,i.jsx)(Z.Z,{children:"User ID"}),(0,i.jsx)(Z.Z,{children:"Role"}),(0,i.jsx)(Z.Z,{children:"Spend"}),(0,i.jsx)(Z.Z,{children:"Created At"}),(0,i.jsx)(Z.Z,{})]})}),(0,i.jsx)(j.Z,{children:null===(s=X.members)||void 0===s?void 0:s.map((e,l)=>(0,i.jsxs)(b.Z,{children:[(0,i.jsx)(p.Z,{children:(0,i.jsx)(f.Z,{className:"font-mono",children:e.user_id})}),(0,i.jsx)(p.Z,{children:(0,i.jsx)(f.Z,{className:"font-mono",children:e.user_role})}),(0,i.jsx)(p.Z,{children:(0,i.jsxs)(f.Z,{children:["$",(0,F.pw)(e.spend,4)]})}),(0,i.jsx)(p.Z,{children:(0,i.jsx)(f.Z,{children:new Date(e.created_at).toLocaleString()})}),(0,i.jsx)(p.Z,{children:eg&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(c.Z,{icon:P.Z,size:"sm",onClick:()=>{em({role:e.user_role,user_email:e.user_email,user_id:e.user_id}),ed(!0)}}),(0,i.jsx)(c.Z,{icon:A.Z,size:"sm",onClick:()=>{eZ(e)}})]})})]},l))})]})}),eg&&(0,i.jsx)(t.Z,{onClick:()=>{en(!0)},children:"Add Member"})]})}),(0,i.jsx)(h.Z,{children:(0,i.jsxs)(n.Z,{className:"overflow-y-auto max-h-[65vh]",children:[(0,i.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,i.jsx)(U.Z,{children:"Organization Settings"}),eg&&!ea&&(0,i.jsx)(t.Z,{onClick:()=>er(!0),children:"Edit Settings"})]}),ea?(0,i.jsxs)(y.Z,{form:ei,onFinish:eb,initialValues:{organization_alias:X.organization_alias,models:X.models,tpm_limit:X.litellm_budget_table.tpm_limit,rpm_limit:X.litellm_budget_table.rpm_limit,max_budget:X.litellm_budget_table.max_budget,budget_duration:X.litellm_budget_table.budget_duration,metadata:X.metadata?JSON.stringify(X.metadata,null,2):"",vector_stores:(null===(o=X.object_permission)||void 0===o?void 0:o.vector_stores)||[],mcp_servers_and_groups:{servers:(null===(N=X.object_permission)||void 0===N?void 0:N.mcp_servers)||[],accessGroups:(null===(C=X.object_permission)||void 0===C?void 0:C.mcp_access_groups)||[]}},layout:"vertical",children:[(0,i.jsx)(y.Z.Item,{label:"Organization Name",name:"organization_alias",rules:[{required:!0,message:"Please input an organization name"}],children:(0,i.jsx)(R.Z,{})}),(0,i.jsx)(y.Z.Item,{label:"Models",name:"models",children:(0,i.jsxs)(S.default,{mode:"multiple",placeholder:"Select models",children:[(0,i.jsx)(S.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),H.map(e=>(0,i.jsx)(S.default.Option,{value:e,children:(0,D.W0)(e)},e))]})}),(0,i.jsx)(y.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,i.jsx)(w.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,i.jsx)(y.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,i.jsxs)(S.default,{placeholder:"n/a",children:[(0,i.jsx)(S.default.Option,{value:"24h",children:"daily"}),(0,i.jsx)(S.default.Option,{value:"7d",children:"weekly"}),(0,i.jsx)(S.default.Option,{value:"30d",children:"monthly"})]})}),(0,i.jsx)(y.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,i.jsx)(w.Z,{step:1,style:{width:"100%"}})}),(0,i.jsx)(y.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,i.jsx)(w.Z,{step:1,style:{width:"100%"}})}),(0,i.jsx)(y.Z.Item,{label:"Vector Stores",name:"vector_stores",children:(0,i.jsx)(Y.Z,{onChange:e=>ei.setFieldValue("vector_stores",e),value:ei.getFieldValue("vector_stores"),accessToken:k||"",placeholder:"Select vector stores"})}),(0,i.jsx)(y.Z.Item,{label:"MCP Servers & Access Groups",name:"mcp_servers_and_groups",children:(0,i.jsx)(G.Z,{onChange:e=>ei.setFieldValue("mcp_servers_and_groups",e),value:ei.getFieldValue("mcp_servers_and_groups"),accessToken:k||"",placeholder:"Select MCP servers and access groups"})}),(0,i.jsx)(y.Z.Item,{label:"Metadata",name:"metadata",children:(0,i.jsx)(z.default.TextArea,{rows:4})}),(0,i.jsx)("div",{className:"sticky z-10 bg-white p-4 border-t border-gray-200 bottom-[-1.5rem] inset-x-[-1.5rem]",children:(0,i.jsxs)("div",{className:"flex justify-end items-center gap-2",children:[(0,i.jsx)(t.Z,{variant:"secondary",onClick:()=>er(!1),disabled:eh,children:"Cancel"}),(0,i.jsx)(t.Z,{type:"submit",loading:eh,children:"Save Changes"})]})})]}):(0,i.jsxs)("div",{className:"space-y-4",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)(f.Z,{className:"font-medium",children:"Organization Name"}),(0,i.jsx)("div",{children:X.organization_alias})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(f.Z,{className:"font-medium",children:"Organization ID"}),(0,i.jsx)("div",{className:"font-mono",children:X.organization_id})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(f.Z,{className:"font-medium",children:"Created At"}),(0,i.jsx)("div",{children:new Date(X.created_at).toLocaleString()})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(f.Z,{className:"font-medium",children:"Models"}),(0,i.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:X.models.map((e,l)=>(0,i.jsx)(r.Z,{color:"red",children:e},l))})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(f.Z,{className:"font-medium",children:"Rate Limits"}),(0,i.jsxs)("div",{children:["TPM: ",X.litellm_budget_table.tpm_limit||"Unlimited"]}),(0,i.jsxs)("div",{children:["RPM: ",X.litellm_budget_table.rpm_limit||"Unlimited"]})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(f.Z,{className:"font-medium",children:"Budget"}),(0,i.jsxs)("div",{children:["Max:"," ",null!==X.litellm_budget_table.max_budget?"$".concat((0,F.pw)(X.litellm_budget_table.max_budget,4)):"No Limit"]}),(0,i.jsxs)("div",{children:["Reset: ",X.litellm_budget_table.budget_duration||"Never"]})]}),(0,i.jsx)(J.Z,{objectPermission:X.object_permission,variant:"inline",className:"pt-4 border-t border-gray-200",accessToken:k})]})]})})]})]}),(0,i.jsx)(q.Z,{isVisible:et,onCancel:()=>en(!1),onSubmit:ep,accessToken:k,title:"Add Organization Member",roles:[{label:"org_admin",value:"org_admin",description:"Can add and remove members, and change their roles."},{label:"internal_user",value:"internal_user",description:"Can view/create keys for themselves within organization."},{label:"internal_user_viewer",value:"internal_user_viewer",description:"Can only view their keys within organization."}],defaultRole:"internal_user"}),(0,i.jsx)(Q.Z,{visible:eo,onCancel:()=>ed(!1),onSubmit:ev,initialData:ec,mode:"edit",config:{title:"Edit Member",showEmail:!0,showUserId:!0,roleOptions:[{label:"Org Admin",value:"org_admin"},{label:"Internal User",value:"internal_user"},{label:"Internal User Viewer",value:"internal_user_viewer"}]}})]})},K=s(21609);let X=async(e,l)=>{l(await (0,$.organizationListCall)(e))};var ee=e=>{let{organizations:l,userRole:s,userModels:L,accessToken:R,lastRefreshed:U,handleRefreshClick:E,currentOrg:B,guardrailsList:V=[],setOrganizations:q,premiumUser:J}=e,[Q,ee]=(0,a.useState)(null),[el,es]=(0,a.useState)(!1),[ei,ea]=(0,a.useState)(!1),[er,et]=(0,a.useState)(null),[en,eo]=(0,a.useState)(!1),[ed,ec]=(0,a.useState)(!1),[em]=y.Z.useForm(),[eu,ex]=(0,a.useState)({});(0,a.useEffect)(()=>{R&&X(R,q)},[R]);let eh=e=>{e&&(et(e),ea(!0))},e_=async()=>{if(er&&R)try{eo(!0),await (0,$.organizationDeleteCall)(R,er),W.Z.success("Organization deleted successfully"),ea(!1),et(null),await X(R,q)}catch(e){console.error("Error deleting organization:",e)}finally{eo(!1)}},eg=async e=>{try{var l,s,i,a;if(!R)return;console.log("values in organizations new create call: ".concat(JSON.stringify(e))),(e.allowed_vector_store_ids&&e.allowed_vector_store_ids.length>0||e.allowed_mcp_servers_and_groups&&((null===(l=e.allowed_mcp_servers_and_groups.servers)||void 0===l?void 0:l.length)>0||(null===(s=e.allowed_mcp_servers_and_groups.accessGroups)||void 0===s?void 0:s.length)>0))&&(e.object_permission={},e.allowed_vector_store_ids&&e.allowed_vector_store_ids.length>0&&(e.object_permission.vector_stores=e.allowed_vector_store_ids,delete e.allowed_vector_store_ids),e.allowed_mcp_servers_and_groups&&((null===(i=e.allowed_mcp_servers_and_groups.servers)||void 0===i?void 0:i.length)>0&&(e.object_permission.mcp_servers=e.allowed_mcp_servers_and_groups.servers),(null===(a=e.allowed_mcp_servers_and_groups.accessGroups)||void 0===a?void 0:a.length)>0&&(e.object_permission.mcp_access_groups=e.allowed_mcp_servers_and_groups.accessGroups),delete e.allowed_mcp_servers_and_groups)),await (0,$.organizationCreateCall)(R,e),W.Z.success("Organization created successfully"),ec(!1),em.resetFields(),X(R,q)}catch(e){console.error("Error creating organization:",e)}};return J?(0,i.jsxs)("div",{className:"w-full mx-4 h-[75vh]",children:[(0,i.jsx)(d.Z,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:(0,i.jsxs)(o.Z,{numColSpan:1,className:"flex flex-col gap-2",children:[("Admin"===s||"Org Admin"===s)&&(0,i.jsx)(t.Z,{className:"w-fit",onClick:()=>ec(!0),children:"+ Create New Organization"}),Q?(0,i.jsx)(H,{organizationId:Q,onClose:()=>{ee(null),es(!1)},accessToken:R,is_org_admin:!0,is_proxy_admin:"Admin"===s,userModels:L,editOrg:el}):(0,i.jsxs)(u.Z,{className:"gap-2 h-[75vh] w-full",children:[(0,i.jsxs)(x.Z,{className:"flex justify-between mt-2 w-full items-center",children:[(0,i.jsx)("div",{className:"flex",children:(0,i.jsx)(m.Z,{children:"Your Organizations"})}),(0,i.jsxs)("div",{className:"flex items-center space-x-2",children:[U&&(0,i.jsxs)(f.Z,{children:["Last Refreshed: ",U]}),(0,i.jsx)(c.Z,{icon:M.Z,variant:"shadow",size:"xs",className:"self-center",onClick:E})]})]}),(0,i.jsx)(_.Z,{children:(0,i.jsxs)(h.Z,{children:[(0,i.jsx)(f.Z,{children:"Click on ā€œOrganization IDā€ to view organization details."}),(0,i.jsx)(d.Z,{numItems:1,className:"gap-2 pt-2 pb-2 h-[75vh] w-full mt-2",children:(0,i.jsx)(o.Z,{numColSpan:1,children:(0,i.jsx)(n.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[50vh]",children:(0,i.jsxs)(g.Z,{children:[(0,i.jsx)(v.Z,{children:(0,i.jsxs)(b.Z,{children:[(0,i.jsx)(Z.Z,{children:"Organization ID"}),(0,i.jsx)(Z.Z,{children:"Organization Name"}),(0,i.jsx)(Z.Z,{children:"Created"}),(0,i.jsx)(Z.Z,{children:"Spend (USD)"}),(0,i.jsx)(Z.Z,{children:"Budget (USD)"}),(0,i.jsx)(Z.Z,{children:"Models"}),(0,i.jsx)(Z.Z,{children:"TPM / RPM Limits"}),(0,i.jsx)(Z.Z,{children:"Info"}),(0,i.jsx)(Z.Z,{children:"Actions"})]})}),(0,i.jsx)(j.Z,{children:l&&l.length>0?l.sort((e,l)=>new Date(l.created_at).getTime()-new Date(e.created_at).getTime()).map(e=>{var l,a,n,o,d,m,u,x,h;return(0,i.jsxs)(b.Z,{children:[(0,i.jsx)(p.Z,{children:(0,i.jsx)("div",{className:"overflow-hidden",children:(0,i.jsx)(N.Z,{title:e.organization_id,children:(0,i.jsxs)(t.Z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate max-w-[200px]",onClick:()=>ee(e.organization_id),children:[null===(l=e.organization_id)||void 0===l?void 0:l.slice(0,7),"..."]})})})}),(0,i.jsx)(p.Z,{children:e.organization_alias}),(0,i.jsx)(p.Z,{children:e.created_at?new Date(e.created_at).toLocaleDateString():"N/A"}),(0,i.jsx)(p.Z,{children:(0,F.pw)(e.spend,4)}),(0,i.jsx)(p.Z,{children:(null===(a=e.litellm_budget_table)||void 0===a?void 0:a.max_budget)!==null&&(null===(n=e.litellm_budget_table)||void 0===n?void 0:n.max_budget)!==void 0?null===(o=e.litellm_budget_table)||void 0===o?void 0:o.max_budget:"No limit"}),(0,i.jsx)(p.Z,{style:{maxWidth:"8-x",whiteSpace:"pre-wrap",overflow:"hidden"},className:e.models.length>3?"px-0":"",children:(0,i.jsx)("div",{className:"flex flex-col",children:Array.isArray(e.models)?(0,i.jsx)("div",{className:"flex flex-col",children:0===e.models.length?(0,i.jsx)(r.Z,{size:"xs",className:"mb-1",color:"red",children:(0,i.jsx)(f.Z,{children:"All Proxy Models"})}):(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)("div",{className:"flex items-start",children:[e.models.length>3&&(0,i.jsx)("div",{children:(0,i.jsx)(c.Z,{icon:eu[e.organization_id||""]?k.Z:I.Z,className:"cursor-pointer",size:"xs",onClick:()=>{ex(l=>({...l,[e.organization_id||""]:!l[e.organization_id||""]}))}})}),(0,i.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.models.slice(0,3).map((e,l)=>"all-proxy-models"===e?(0,i.jsx)(r.Z,{size:"xs",color:"red",children:(0,i.jsx)(f.Z,{children:"All Proxy Models"})},l):(0,i.jsx)(r.Z,{size:"xs",color:"blue",children:(0,i.jsx)(f.Z,{children:e.length>30?"".concat((0,D.W0)(e).slice(0,30),"..."):(0,D.W0)(e)})},l)),e.models.length>3&&!eu[e.organization_id||""]&&(0,i.jsx)(r.Z,{size:"xs",color:"gray",className:"cursor-pointer",children:(0,i.jsxs)(f.Z,{children:["+",e.models.length-3," ",e.models.length-3==1?"more model":"more models"]})}),eu[e.organization_id||""]&&(0,i.jsx)("div",{className:"flex flex-wrap gap-1",children:e.models.slice(3).map((e,l)=>"all-proxy-models"===e?(0,i.jsx)(r.Z,{size:"xs",color:"red",children:(0,i.jsx)(f.Z,{children:"All Proxy Models"})},l+3):(0,i.jsx)(r.Z,{size:"xs",color:"blue",children:(0,i.jsx)(f.Z,{children:e.length>30?"".concat((0,D.W0)(e).slice(0,30),"..."):(0,D.W0)(e)})},l+3))})]})]})})}):null})}),(0,i.jsx)(p.Z,{children:(0,i.jsxs)(f.Z,{children:["TPM:"," ",(null===(d=e.litellm_budget_table)||void 0===d?void 0:d.tpm_limit)?null===(m=e.litellm_budget_table)||void 0===m?void 0:m.tpm_limit:"Unlimited",(0,i.jsx)("br",{}),"RPM:"," ",(null===(u=e.litellm_budget_table)||void 0===u?void 0:u.rpm_limit)?null===(x=e.litellm_budget_table)||void 0===x?void 0:x.rpm_limit:"Unlimited"]})}),(0,i.jsx)(p.Z,{children:(0,i.jsxs)(f.Z,{children:[(null===(h=e.members)||void 0===h?void 0:h.length)||0," Members"]})}),(0,i.jsx)(p.Z,{children:"Admin"===s&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(N.Z,{title:"Edit organization",children:[" ",(0,i.jsx)(c.Z,{icon:P.Z,size:"sm",className:"cursor-pointer hover:text-blue-600",onClick:()=>{ee(e.organization_id),es(!0)}})]}),(0,i.jsxs)(N.Z,{title:"Delete organization",children:[" ",(0,i.jsx)(c.Z,{onClick:()=>eh(e.organization_id),icon:A.Z,size:"sm",className:"cursor-pointer hover:text-red-600"})]})]})})]},e.organization_id)}):null})]})})})})]})})]})]})}),(0,i.jsx)(C.Z,{title:"Create Organization",visible:ed,width:800,footer:null,onCancel:()=>{ec(!1),em.resetFields()},children:(0,i.jsxs)(y.Z,{form:em,onFinish:eg,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,i.jsx)(y.Z.Item,{label:"Organization Name",name:"organization_alias",rules:[{required:!0,message:"Please input an organization name"}],children:(0,i.jsx)(T.o,{placeholder:""})}),(0,i.jsx)(y.Z.Item,{label:"Models",name:"models",children:(0,i.jsxs)(S.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:[(0,i.jsx)(S.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),L&&L.length>0&&L.map(e=>(0,i.jsx)(S.default.Option,{value:e,children:(0,D.W0)(e)},e))]})}),(0,i.jsx)(y.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,i.jsx)(w.Z,{step:.01,precision:2,width:200})}),(0,i.jsx)(y.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,i.jsxs)(S.default,{defaultValue:null,placeholder:"n/a",children:[(0,i.jsx)(S.default.Option,{value:"24h",children:"daily"}),(0,i.jsx)(S.default.Option,{value:"7d",children:"weekly"}),(0,i.jsx)(S.default.Option,{value:"30d",children:"monthly"})]})}),(0,i.jsx)(y.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,i.jsx)(w.Z,{step:1,width:400})}),(0,i.jsx)(y.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,i.jsx)(w.Z,{step:1,width:400})}),(0,i.jsx)(y.Z.Item,{label:(0,i.jsxs)("span",{children:["Allowed Vector Stores"," ",(0,i.jsx)(N.Z,{title:"Select which vector stores this organization can access by default. Leave empty for access to all vector stores",children:(0,i.jsx)(O.Z,{style:{marginLeft:"4px"}})})]}),name:"allowed_vector_store_ids",className:"mt-4",help:"Select vector stores this organization can access. Leave empty for access to all vector stores",children:(0,i.jsx)(Y.Z,{onChange:e=>em.setFieldValue("allowed_vector_store_ids",e),value:em.getFieldValue("allowed_vector_store_ids"),accessToken:R||"",placeholder:"Select vector stores (optional)"})}),(0,i.jsx)(y.Z.Item,{label:(0,i.jsxs)("span",{children:["Allowed MCP Servers"," ",(0,i.jsx)(N.Z,{title:"Select which MCP servers and access groups this organization can access by default.",children:(0,i.jsx)(O.Z,{style:{marginLeft:"4px"}})})]}),name:"allowed_mcp_servers_and_groups",className:"mt-4",help:"Select MCP servers and access groups this organization can access.",children:(0,i.jsx)(G.Z,{onChange:e=>em.setFieldValue("allowed_mcp_servers_and_groups",e),value:em.getFieldValue("allowed_mcp_servers_and_groups"),accessToken:R||"",placeholder:"Select MCP servers and access groups (optional)"})}),(0,i.jsx)(y.Z.Item,{label:"Metadata",name:"metadata",children:(0,i.jsx)(z.default.TextArea,{rows:4})}),(0,i.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,i.jsx)(t.Z,{type:"submit",children:"Create Organization"})})]})}),(0,i.jsx)(K.Z,{isOpen:ei,title:"Delete Organization?",message:"Are you sure you want to delete this organization? This action cannot be undone.",resourceInformationTitle:"Organization Information",resourceInformation:[{label:"Organization ID",value:er,code:!0}],onCancel:()=>{ea(!1),et(null)},onOk:e_,confirmLoading:en})]}):(0,i.jsx)("div",{children:(0,i.jsxs)(f.Z,{children:["This is a LiteLLM Enterprise feature, and requires a valid key to use. Get a trial key"," ",(0,i.jsx)("a",{href:"https://www.litellm.ai/#pricing",target:"_blank",rel:"noopener noreferrer",children:"here"}),"."]})})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2012-c09fa25a9cbf6028.js b/litellm/proxy/_experimental/out/_next/static/chunks/2012-c09fa25a9cbf6028.js deleted file mode 100644 index fc87e2ebf09..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/2012-c09fa25a9cbf6028.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2012],{26210:function(e,l,s){s.d(l,{UQ:function(){return t.Z},X1:function(){return i.Z},_m:function(){return a.Z},oi:function(){return n.Z},xv:function(){return r.Z}});var t=s(87452),i=s(88829),a=s(72208),r=s(84264),n=s(49566)},30078:function(e,l,s){s.d(l,{Ct:function(){return t.Z},Dx:function(){return x.Z},OK:function(){return n.Z},Zb:function(){return a.Z},nP:function(){return c.Z},oi:function(){return h.Z},rj:function(){return r.Z},td:function(){return d.Z},v0:function(){return m.Z},x4:function(){return o.Z},xv:function(){return u.Z},zx:function(){return i.Z}});var t=s(41649),i=s(78489),a=s(12514),r=s(67101),n=s(12485),m=s(18135),d=s(35242),o=s(29706),c=s(77991),u=s(84264),h=s(49566),x=s(96761)},62490:function(e,l,s){s.d(l,{Ct:function(){return t.Z},RM:function(){return n.Z},SC:function(){return c.Z},Zb:function(){return a.Z},iA:function(){return r.Z},pj:function(){return m.Z},ss:function(){return d.Z},xs:function(){return o.Z},xv:function(){return u.Z},zx:function(){return i.Z}});var t=s(41649),i=s(78489),a=s(12514),r=s(21626),n=s(97214),m=s(28241),d=s(58834),o=s(69552),c=s(71876),u=s(84264)},11318:function(e,l,s){s.d(l,{Z:function(){return n}});var t=s(2265),i=s(39760),a=s(19250);let r=async(e,l,s,t)=>"Admin"!=s&&"Admin Viewer"!=s?await (0,a.teamListCall)(e,(null==t?void 0:t.organization_id)||null,l):await (0,a.teamListCall)(e,(null==t?void 0:t.organization_id)||null);var n=()=>{let[e,l]=(0,t.useState)([]),{accessToken:s,userId:a,userRole:n}=(0,i.Z)();return(0,t.useEffect)(()=>{(async()=>{l(await r(s,a,n,null))})()},[s,a,n]),{teams:e,setTeams:l}}},21609:function(e,l,s){s.d(l,{Z:function(){return o}});var t=s(57437),i=s(57840),a=s(22116),r=s(51653),n=s(76188),m=s(4260),d=s(2265);function o(e){let{isOpen:l,title:s,alertMessage:o,message:c,resourceInformationTitle:u,resourceInformation:h,onCancel:x,onOk:b,confirmLoading:p,requiredConfirmation:g}=e,{Title:_,Text:v}=i.default,[j,f]=(0,d.useState)("");return(0,d.useEffect)(()=>{l&&f("")},[l]),(0,t.jsx)(a.Z,{title:s,open:l,onOk:b,onCancel:x,confirmLoading:p,okText:p?"Deleting...":"Delete",cancelText:"Cancel",okButtonProps:{danger:!0,disabled:!!g&&j!==g||p},cancelButtonProps:{disabled:p},children:(0,t.jsxs)("div",{className:"space-y-4",children:[o&&(0,t.jsx)(r.Z,{message:o,type:"warning"}),(0,t.jsxs)("div",{className:"mt-4 p-4 bg-red-50 rounded-lg border border-red-200",children:[(0,t.jsx)(_,{level:5,className:"mb-3 text-gray-900",children:u}),(0,t.jsx)(n.Z,{column:1,size:"small",children:h&&h.map(e=>{let{label:l,value:s,...i}=e;return(0,t.jsx)(n.Z.Item,{label:(0,t.jsx)("span",{className:"font-semibold text-gray-700",children:l}),children:(0,t.jsx)(v,{...i,children:null!=s?s:"-"})},l)})})]}),(0,t.jsx)("div",{children:(0,t.jsx)(v,{children:c})}),g&&(0,t.jsxs)("div",{className:"mb-6 mt-4 pt-4 border-t border-gray-200",children:[(0,t.jsxs)(v,{className:"block text-base font-medium text-gray-700 mb-2",children:[(0,t.jsx)(v,{children:"Type "}),(0,t.jsx)(v,{strong:!0,type:"danger",children:g}),(0,t.jsx)(v,{children:" to confirm deletion:"})]}),(0,t.jsx)(m.default,{value:j,onChange:e=>f(e.target.value),placeholder:g,className:"rounded-md text-base border-gray-200",autoFocus:!0})]})]})})}},33860:function(e,l,s){var t=s(57437),i=s(2265),a=s(10032),r=s(22116),n=s(37592),m=s(99981),d=s(5545),o=s(7310),c=s.n(o),u=s(19250);l.Z=e=>{let{isVisible:l,onCancel:s,onSubmit:o,accessToken:h,title:x="Add Team Member",roles:b=[{label:"admin",value:"admin",description:"Admin role. Can create team keys, add members, and manage settings."},{label:"user",value:"user",description:"User role. Can view team info, but not manage it."}],defaultRole:p="user"}=e,[g]=a.Z.useForm(),[_,v]=(0,i.useState)([]),[j,f]=(0,i.useState)(!1),[Z,y]=(0,i.useState)("user_email"),N=async(e,l)=>{if(!e){v([]);return}f(!0);try{let s=new URLSearchParams;if(s.append(l,e),null==h)return;let t=(await (0,u.userFilterUICall)(h,s)).map(e=>({label:"user_email"===l?"".concat(e.user_email):"".concat(e.user_id),value:"user_email"===l?e.user_email:e.user_id,user:e}));v(t)}catch(e){console.error("Error fetching users:",e)}finally{f(!1)}},w=(0,i.useCallback)(c()((e,l)=>N(e,l),300),[]),k=(e,l)=>{y(l),w(e,l)},M=(e,l)=>{let s=l.user;g.setFieldsValue({user_email:s.user_email,user_id:s.user_id,role:g.getFieldValue("role")})};return(0,t.jsx)(r.Z,{title:x,open:l,onCancel:()=>{g.resetFields(),v([]),s()},footer:null,width:800,children:(0,t.jsxs)(a.Z,{form:g,onFinish:o,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",initialValues:{role:p},children:[(0,t.jsx)(a.Z.Item,{label:"Email",name:"user_email",className:"mb-4",children:(0,t.jsx)(n.default,{showSearch:!0,className:"w-full",placeholder:"Search by email",filterOption:!1,onSearch:e=>k(e,"user_email"),onSelect:(e,l)=>M(e,l),options:"user_email"===Z?_:[],loading:j,allowClear:!0})}),(0,t.jsx)("div",{className:"text-center mb-4",children:"OR"}),(0,t.jsx)(a.Z.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,t.jsx)(n.default,{showSearch:!0,className:"w-full",placeholder:"Search by user ID",filterOption:!1,onSearch:e=>k(e,"user_id"),onSelect:(e,l)=>M(e,l),options:"user_id"===Z?_:[],loading:j,allowClear:!0})}),(0,t.jsx)(a.Z.Item,{label:"Member Role",name:"role",className:"mb-4",children:(0,t.jsx)(n.default,{defaultValue:p,children:b.map(e=>(0,t.jsx)(n.default.Option,{value:e.value,children:(0,t.jsxs)(m.Z,{title:e.description,children:[(0,t.jsx)("span",{className:"font-medium",children:e.label}),(0,t.jsxs)("span",{className:"ml-2 text-gray-500 text-sm",children:["- ",e.description]})]})},e.value))})}),(0,t.jsx)("div",{className:"text-right mt-4",children:(0,t.jsx)(d.ZP,{type:"default",htmlType:"submit",children:"Add Member"})})]})})}},10901:function(e,l,s){s.d(l,{Z:function(){return h}});var t=s(57437),i=s(2265),a=s(10032),r=s(22116),n=s(5545),m=s(27281),d=s(57365),o=s(49566),c=s(92280),u=s(24199),h=e=>{var l,s,h;let{visible:x,onCancel:b,onSubmit:p,initialData:g,mode:_,config:v}=e,[j]=a.Z.useForm();console.log("Initial Data:",g),(0,i.useEffect)(()=>{if(x){if("edit"===_&&g){let e={...g,role:g.role||v.defaultRole,max_budget_in_team:g.max_budget_in_team||null,tpm_limit:g.tpm_limit||null,rpm_limit:g.rpm_limit||null};console.log("Setting form values:",e),j.setFieldsValue(e)}else{var e;j.resetFields(),j.setFieldsValue({role:v.defaultRole||(null===(e=v.roleOptions[0])||void 0===e?void 0:e.value)})}}},[x,g,_,j,v.defaultRole,v.roleOptions]);let f=async e=>{try{let l=Object.entries(e).reduce((e,l)=>{let[s,t]=l;if("string"==typeof t){let l=t.trim();return""===l&&("max_budget_in_team"===s||"tpm_limit"===s||"rpm_limit"===s)?{...e,[s]:null}:{...e,[s]:l}}return{...e,[s]:t}},{});console.log("Submitting form data:",l),p(l),j.resetFields()}catch(e){console.error("Form submission error:",e)}},Z=e=>{switch(e.type){case"input":return(0,t.jsx)(o.Z,{placeholder:e.placeholder});case"numerical":return(0,t.jsx)(u.Z,{step:e.step||1,min:e.min||0,style:{width:"100%"},placeholder:e.placeholder||"Enter a numerical value"});case"select":var l;return(0,t.jsx)(m.Z,{children:null===(l=e.options)||void 0===l?void 0:l.map(e=>(0,t.jsx)(d.Z,{value:e.value,children:e.label},e.value))});default:return null}};return(0,t.jsx)(r.Z,{title:v.title||("add"===_?"Add Member":"Edit Member"),open:x,width:1e3,footer:null,onCancel:b,children:(0,t.jsxs)(a.Z,{form:j,onFinish:f,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[v.showEmail&&(0,t.jsx)(a.Z.Item,{label:"Email",name:"user_email",className:"mb-4",rules:[{type:"email",message:"Please enter a valid email!"}],children:(0,t.jsx)(o.Z,{placeholder:"user@example.com"})}),v.showEmail&&v.showUserId&&(0,t.jsx)("div",{className:"text-center mb-4",children:(0,t.jsx)(c.x,{children:"OR"})}),v.showUserId&&(0,t.jsx)(a.Z.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,t.jsx)(o.Z,{placeholder:"user_123"})}),(0,t.jsx)(a.Z.Item,{label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{children:"Role"}),"edit"===_&&g&&(0,t.jsxs)("span",{className:"text-gray-500 text-sm",children:["(Current: ",(s=g.role,(null===(h=v.roleOptions.find(e=>e.value===s))||void 0===h?void 0:h.label)||s),")"]})]}),name:"role",className:"mb-4",rules:[{required:!0,message:"Please select a role!"}],children:(0,t.jsx)(m.Z,{children:"edit"===_&&g?[...v.roleOptions.filter(e=>e.value===g.role),...v.roleOptions.filter(e=>e.value!==g.role)].map(e=>(0,t.jsx)(d.Z,{value:e.value,children:e.label},e.value)):v.roleOptions.map(e=>(0,t.jsx)(d.Z,{value:e.value,children:e.label},e.value))})}),null===(l=v.additionalFields)||void 0===l?void 0:l.map(e=>(0,t.jsx)(a.Z.Item,{label:e.label,name:e.name,className:"mb-4",rules:e.rules,children:Z(e)},e.name)),(0,t.jsxs)("div",{className:"text-right mt-6",children:[(0,t.jsx)(n.ZP,{onClick:b,className:"mr-2",children:"Cancel"}),(0,t.jsx)(n.ZP,{type:"default",htmlType:"submit",children:"add"===_?"Add Member":"Save Changes"})]})]})})}},33293:function(e,l,s){s.d(l,{Z:function(){return el}});var t=s(57437),i=s(33860),a=s(19250),r=s(59872),n=s(33304),m=s(15424),d=s(10900),o=s(30078),c=s(10032),u=s(42264),h=s(5545),x=s(4260),b=s(37592),p=s(99981),g=s(63709),_=s(30401),v=s(78867),j=s(2265),f=s(21609),Z=s(95096),y=s(46468),N=s(27799),w=s(95920),k=s(68473),M=s(9114),C=s(98015),S=s(24199),T=s(97415),I=s(10901),P=s(21425),L=s(78489),F=s(12514),E=s(21626),O=s(97214),D=s(28241),A=s(58834),R=s(69552),U=s(71876),z=s(84264),B=s(96761),V=s(61994),q=s(85180),G=s(89245),K=s(78355);let $={"/key/generate":"Member can generate a virtual key for this team","/key/service-account/generate":"Member can generate a service account key (not belonging to any user) for this team","/key/update":"Member can update a virtual key belonging to this team","/key/delete":"Member can delete a virtual key belonging to this team","/key/info":"Member can get info about a virtual key belonging to this team","/key/regenerate":"Member can regenerate a virtual key belonging to this team","/key/{key_id}/regenerate":"Member can regenerate a virtual key belonging to this team","/key/list":"Member can list virtual keys belonging to this team","/key/block":"Member can block a virtual key belonging to this team","/key/unblock":"Member can unblock a virtual key belonging to this team"},J=e=>e.includes("/info")||e.includes("/list")?"GET":"POST",Q=e=>{let l=J(e),s=$[e];if(!s){for(let[l,t]of Object.entries($))if(e.includes(l)){s=t;break}}return s||(s="Access ".concat(e)),{method:l,endpoint:e,description:s,route:e}};var W=e=>{let{teamId:l,accessToken:s,canEditTeam:i}=e,[r,n]=(0,j.useState)([]),[m,d]=(0,j.useState)([]),[o,c]=(0,j.useState)(!0),[u,x]=(0,j.useState)(!1),[b,p]=(0,j.useState)(!1),g=async()=>{try{if(c(!0),!s)return;let e=await (0,a.getTeamPermissionsCall)(s,l),t=e.all_available_permissions||[];n(t);let i=e.team_member_permissions||[];d(i),p(!1)}catch(e){M.Z.fromBackend("Failed to load permissions"),console.error("Error fetching permissions:",e)}finally{c(!1)}};(0,j.useEffect)(()=>{g()},[l,s]);let _=(e,l)=>{d(l?[...m,e]:m.filter(l=>l!==e)),p(!0)},v=async()=>{try{if(!s)return;x(!0),await (0,a.teamPermissionsUpdateCall)(s,l,m),M.Z.success("Permissions updated successfully"),p(!1)}catch(e){M.Z.fromBackend("Failed to update permissions"),console.error("Error updating permissions:",e)}finally{x(!1)}};if(o)return(0,t.jsx)("div",{className:"p-6 text-center",children:"Loading permissions..."});let f=r.length>0;return(0,t.jsxs)(F.Z,{className:"bg-white shadow-md rounded-md p-6",children:[(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center border-b pb-4 mb-6",children:[(0,t.jsx)(B.Z,{className:"mb-2 sm:mb-0",children:"Member Permissions"}),i&&b&&(0,t.jsxs)("div",{className:"flex gap-3",children:[(0,t.jsx)(h.ZP,{icon:(0,t.jsx)(G.Z,{}),onClick:()=>{g()},children:"Reset"}),(0,t.jsxs)(L.Z,{onClick:v,loading:u,className:"flex items-center gap-2",children:[(0,t.jsx)(K.Z,{})," Save Changes"]})]})]}),(0,t.jsx)(z.Z,{className:"mb-6 text-gray-600",children:"Control what team members can do when they are not team admins."}),f?(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(E.Z,{className:" min-w-full",children:[(0,t.jsx)(A.Z,{children:(0,t.jsxs)(U.Z,{children:[(0,t.jsx)(R.Z,{children:"Method"}),(0,t.jsx)(R.Z,{children:"Endpoint"}),(0,t.jsx)(R.Z,{children:"Description"}),(0,t.jsx)(R.Z,{className:"sticky right-0 bg-white shadow-[-4px_0_4px_-4px_rgba(0,0,0,0.1)] text-center",children:"Allow Access"})]})}),(0,t.jsx)(O.Z,{children:r.map(e=>{let l=Q(e);return(0,t.jsxs)(U.Z,{className:"hover:bg-gray-50 transition-colors",children:[(0,t.jsx)(D.Z,{children:(0,t.jsx)("span",{className:"px-2 py-1 rounded text-xs font-medium ".concat("GET"===l.method?"bg-blue-100 text-blue-800":"bg-green-100 text-green-800"),children:l.method})}),(0,t.jsx)(D.Z,{children:(0,t.jsx)("span",{className:"font-mono text-sm text-gray-800",children:l.endpoint})}),(0,t.jsx)(D.Z,{className:"text-gray-700",children:l.description}),(0,t.jsx)(D.Z,{className:"sticky right-0 bg-white shadow-[-4px_0_4px_-4px_rgba(0,0,0,0.1)] text-center",children:(0,t.jsx)(V.Z,{checked:m.includes(e),onChange:l=>_(e,l.target.checked),disabled:!i})})]},e)})})]})}):(0,t.jsx)("div",{className:"py-12",children:(0,t.jsx)(q.Z,{description:"No permissions available"})})]})},X=s(47323),Y=s(53410),H=s(74998),ee=e=>{let{teamData:l,canEditTeam:s,handleMemberDelete:i,setSelectedEditMember:a,setIsEditMemberModalVisible:n,setIsAddMemberModalVisible:d}=e,o=e=>{if(null==e)return"0";if("number"==typeof e){let l=Number(e);return l===Math.floor(l)?l.toString():(0,r.pw)(l,8).replace(/\.?0+$/,"")}return"0"},c=e=>{if(!e)return 0;let s=l.team_memberships.find(l=>l.user_id===e);return(null==s?void 0:s.spend)||0},u=e=>{var s;if(!e)return null;let t=l.team_memberships.find(l=>l.user_id===e);console.log("membership=".concat(t));let i=null==t?void 0:null===(s=t.litellm_budget_table)||void 0===s?void 0:s.max_budget;return null==i?null:o(i)},h=e=>{var s,t;if(!e)return"No Limits";let i=l.team_memberships.find(l=>l.user_id===e),a=null==i?void 0:null===(s=i.litellm_budget_table)||void 0===s?void 0:s.rpm_limit,r=null==i?void 0:null===(t=i.litellm_budget_table)||void 0===t?void 0:t.tpm_limit,n=[a?"".concat(o(a)," RPM"):null,r?"".concat(o(r)," TPM"):null].filter(Boolean);return n.length>0?n.join(" / "):"No Limits"};return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(F.Z,{className:"w-full mx-auto flex-auto overflow-auto max-h-[50vh]",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(E.Z,{className:"min-w-full",children:[(0,t.jsx)(A.Z,{children:(0,t.jsxs)(U.Z,{children:[(0,t.jsx)(R.Z,{children:"User ID"}),(0,t.jsx)(R.Z,{children:"User Email"}),(0,t.jsx)(R.Z,{children:"Role"}),(0,t.jsxs)(R.Z,{children:["Team Member Spend (USD)"," ",(0,t.jsx)(p.Z,{title:"This is the amount spent by a user in the team.",children:(0,t.jsx)(m.Z,{})})]}),(0,t.jsx)(R.Z,{children:"Team Member Budget (USD)"}),(0,t.jsxs)(R.Z,{children:["Team Member Rate Limits"," ",(0,t.jsx)(p.Z,{title:"Rate limits for this member's usage within this team.",children:(0,t.jsx)(m.Z,{})})]}),(0,t.jsx)(R.Z,{className:"sticky right-0 bg-white z-10 border-l border-gray-200",children:"Actions"})]})}),(0,t.jsx)(O.Z,{children:l.team_info.members_with_roles.map((e,m)=>(0,t.jsxs)(U.Z,{children:[(0,t.jsx)(D.Z,{children:(0,t.jsx)(z.Z,{className:"font-mono",children:e.user_id})}),(0,t.jsx)(D.Z,{children:(0,t.jsx)(z.Z,{className:"font-mono",children:e.user_email?e.user_email:"No Email"})}),(0,t.jsx)(D.Z,{children:(0,t.jsx)(z.Z,{className:"font-mono",children:e.role})}),(0,t.jsx)(D.Z,{children:(0,t.jsxs)(z.Z,{className:"font-mono",children:["$",(0,r.pw)(c(e.user_id),4)]})}),(0,t.jsx)(D.Z,{children:(0,t.jsx)(z.Z,{className:"font-mono",children:u(e.user_id)?"$".concat((0,r.pw)(Number(u(e.user_id)),4)):"No Limit"})}),(0,t.jsx)(D.Z,{children:(0,t.jsx)(z.Z,{className:"font-mono",children:h(e.user_id)})}),(0,t.jsx)(D.Z,{className:"sticky right-0 bg-white z-10 border-l border-gray-200",children:s&&(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(X.Z,{icon:Y.Z,size:"sm",onClick:()=>{var s,t,i;let r=l.team_memberships.find(l=>l.user_id===e.user_id);a({...e,max_budget_in_team:(null==r?void 0:null===(s=r.litellm_budget_table)||void 0===s?void 0:s.max_budget)||null,tpm_limit:(null==r?void 0:null===(t=r.litellm_budget_table)||void 0===t?void 0:t.tpm_limit)||null,rpm_limit:(null==r?void 0:null===(i=r.litellm_budget_table)||void 0===i?void 0:i.rpm_limit)||null}),n(!0)},className:"cursor-pointer hover:text-blue-600"}),(0,t.jsx)(X.Z,{icon:H.Z,size:"sm",onClick:()=>i(e),className:"cursor-pointer hover:text-red-600"})]})})]},m))})]})})}),(0,t.jsx)(L.Z,{onClick:()=>d(!0),children:"Add Member"})]})},el=e=>{var l,s,L,F,E,O,D,A,R,U,z,B,V,q,G,K,$,J;let{teamId:Q,onClose:X,accessToken:Y,is_team_admin:H,is_proxy_admin:el,userModels:es,editTeam:et,premiumUser:ei=!1,onUpdate:ea}=e,[er,en]=(0,j.useState)(null),[em,ed]=(0,j.useState)(!0),[eo,ec]=(0,j.useState)(!1),[eu]=c.Z.useForm(),[eh,ex]=(0,j.useState)(!1),[eb,ep]=(0,j.useState)(null),[eg,e_]=(0,j.useState)(!1),[ev,ej]=(0,j.useState)([]),[ef,eZ]=(0,j.useState)(!1),[ey,eN]=(0,j.useState)({}),[ew,ek]=(0,j.useState)([]),[eM,eC]=(0,j.useState)(null),[eS,eT]=(0,j.useState)(!1),[eI,eP]=(0,j.useState)(!1),[eL,eF]=(0,j.useState)(!1);console.log("userModels in team info",es);let eE=H||el,eO=async()=>{try{if(ed(!0),!Y)return;let e=await (0,a.teamInfoCall)(Y,Q);en(e)}catch(e){M.Z.fromBackend("Failed to load team information"),console.error("Error fetching team info:",e)}finally{ed(!1)}};(0,j.useEffect)(()=>{eO()},[Q,Y]),(0,j.useEffect)(()=>{(async()=>{try{if(!Y)return;let e=(await (0,a.getGuardrailsList)(Y)).guardrails.map(e=>e.guardrail_name);ek(e)}catch(e){console.error("Failed to fetch guardrails:",e)}})()},[Y]);let eD=async e=>{try{if(null==Y)return;let l={user_email:e.user_email,user_id:e.user_id,role:e.role};await (0,a.teamMemberAddCall)(Y,Q,l),M.Z.success("Team member added successfully"),ec(!1),eu.resetFields();let s=await (0,a.teamInfoCall)(Y,Q);en(s),ea(s)}catch(i){var l,s,t;let e="Failed to add team member";(null==i?void 0:null===(t=i.raw)||void 0===t?void 0:null===(s=t.detail)||void 0===s?void 0:null===(l=s.error)||void 0===l?void 0:l.includes("Assigning team admins is a premium feature"))?e="Assigning admins is an enterprise-only feature. Please upgrade your LiteLLM plan to enable this.":(null==i?void 0:i.message)&&(e=i.message),M.Z.fromBackend(e),console.error("Error adding team member:",i)}},eA=async e=>{try{if(null==Y)return;let l={user_email:e.user_email,user_id:e.user_id,role:e.role,max_budget_in_team:e.max_budget_in_team,tpm_limit:e.tpm_limit,rpm_limit:e.rpm_limit};console.log("Updating member with values:",l),u.ZP.destroy(),await (0,a.teamMemberUpdateCall)(Y,Q,l),M.Z.success("Team member updated successfully"),ex(!1);let s=await (0,a.teamInfoCall)(Y,Q);en(s),ea(s)}catch(t){var l,s;let e="Failed to update team member";(null==t?void 0:null===(s=t.raw)||void 0===s?void 0:null===(l=s.detail)||void 0===l?void 0:l.includes("Assigning team admins is a premium feature"))?e="Assigning admins is an enterprise-only feature. Please upgrade your LiteLLM plan to enable this.":(null==t?void 0:t.message)&&(e=t.message),ex(!1),u.ZP.destroy(),M.Z.fromBackend(e),console.error("Error updating team member:",t)}},eR=async()=>{if(eM&&Y){eP(!0);try{await (0,a.teamMemberDeleteCall)(Y,Q,eM),M.Z.success("Team member removed successfully");let e=await (0,a.teamInfoCall)(Y,Q);en(e),ea(e)}catch(e){M.Z.fromBackend("Failed to remove team member"),console.error("Error removing team member:",e)}finally{eP(!1),eT(!1),eC(null)}}},eU=async e=>{try{if(!Y)return;eF(!0);let l={};try{l=e.metadata?JSON.parse(e.metadata):{}}catch(e){M.Z.fromBackend("Invalid JSON in metadata field");return}let s=e=>null==e||"string"==typeof e&&""===e.trim()||"number"==typeof e&&Number.isNaN(e)?null:e,t={team_id:Q,team_alias:e.team_alias,models:e.models,tpm_limit:s(e.tpm_limit),rpm_limit:s(e.rpm_limit),max_budget:e.max_budget,budget_duration:e.budget_duration,metadata:{...l,guardrails:e.guardrails||[],logging:e.logging_settings||[]},organization_id:e.organization_id};t.max_budget=(0,n.C)(t.max_budget),void 0!==e.team_member_budget&&(t.team_member_budget=Number(e.team_member_budget)),void 0!==e.team_member_key_duration&&(t.team_member_key_duration=e.team_member_key_duration),(void 0!==e.team_member_tpm_limit||void 0!==e.team_member_rpm_limit)&&(t.team_member_tpm_limit=s(e.team_member_tpm_limit),t.team_member_rpm_limit=s(e.team_member_rpm_limit));let{servers:i,accessGroups:r}=e.mcp_servers_and_groups||{servers:[],accessGroups:[]},m=new Set(i||[]),d=Object.fromEntries(Object.entries(e.mcp_tool_permissions||{}).filter(e=>{let[l]=e;return m.has(l)}));t.object_permission={},i&&(t.object_permission.mcp_servers=i),r&&(t.object_permission.mcp_access_groups=r),d&&(t.object_permission.mcp_tool_permissions=d),delete e.mcp_servers_and_groups,delete e.mcp_tool_permissions,await (0,a.teamUpdateCall)(Y,t),M.Z.success("Team settings updated successfully"),e_(!1),eO()}catch(e){console.error("Error updating team:",e)}finally{eF(!1)}};if(em)return(0,t.jsx)("div",{className:"p-4",children:"Loading..."});if(!(null==er?void 0:er.team_info))return(0,t.jsx)("div",{className:"p-4",children:"Team not found"});let{team_info:ez}=er,eB=async(e,l)=>{await (0,r.vQ)(e)&&(eN(e=>({...e,[l]:!0})),setTimeout(()=>{eN(e=>({...e,[l]:!1}))},2e3))};return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(o.zx,{icon:d.Z,variant:"light",onClick:X,className:"mb-4",children:"Back to Teams"}),(0,t.jsx)(o.Dx,{children:ez.team_alias}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(o.xv,{className:"text-gray-500 font-mono",children:ez.team_id}),(0,t.jsx)(h.ZP,{type:"text",size:"small",icon:ey["team-id"]?(0,t.jsx)(_.Z,{size:12}):(0,t.jsx)(v.Z,{size:12}),onClick:()=>eB(ez.team_id,"team-id"),className:"left-2 z-10 transition-all duration-200 ".concat(ey["team-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]})}),(0,t.jsxs)(o.v0,{defaultIndex:et?3:0,children:[(0,t.jsx)(o.td,{className:"mb-4",children:[(0,t.jsx)(o.OK,{children:"Overview"},"overview"),...eE?[(0,t.jsx)(o.OK,{children:"Members"},"members"),(0,t.jsx)(o.OK,{children:"Member Permissions"},"member-permissions"),(0,t.jsx)(o.OK,{children:"Settings"},"settings")]:[]]}),(0,t.jsxs)(o.nP,{children:[(0,t.jsx)(o.x4,{children:(0,t.jsxs)(o.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,t.jsxs)(o.Zb,{children:[(0,t.jsx)(o.xv,{children:"Budget Status"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(o.Dx,{children:["$",(0,r.pw)(ez.spend,4)]}),(0,t.jsxs)(o.xv,{children:["of ",null===ez.max_budget?"Unlimited":"$".concat((0,r.pw)(ez.max_budget,4))]}),ez.budget_duration&&(0,t.jsxs)(o.xv,{className:"text-gray-500",children:["Reset: ",ez.budget_duration]}),(0,t.jsx)("br",{}),ez.team_member_budget_table&&(0,t.jsxs)(o.xv,{className:"text-gray-500",children:["Team Member Budget: $",(0,r.pw)(ez.team_member_budget_table.max_budget,4)]})]})]}),(0,t.jsxs)(o.Zb,{children:[(0,t.jsx)(o.xv,{children:"Rate Limits"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(o.xv,{children:["TPM: ",ez.tpm_limit||"Unlimited"]}),(0,t.jsxs)(o.xv,{children:["RPM: ",ez.rpm_limit||"Unlimited"]}),ez.max_parallel_requests&&(0,t.jsxs)(o.xv,{children:["Max Parallel Requests: ",ez.max_parallel_requests]})]})]}),(0,t.jsxs)(o.Zb,{children:[(0,t.jsx)(o.xv,{children:"Models"}),(0,t.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:0===ez.models.length?(0,t.jsx)(o.Ct,{color:"red",children:"All proxy models"}):ez.models.map((e,l)=>(0,t.jsx)(o.Ct,{color:"red",children:e},l))})]}),(0,t.jsxs)(o.Zb,{children:[(0,t.jsx)(o.xv,{className:"font-semibold text-gray-900",children:"Virtual Keys"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(o.xv,{children:["User Keys: ",er.keys.filter(e=>e.user_id).length]}),(0,t.jsxs)(o.xv,{children:["Service Account Keys: ",er.keys.filter(e=>!e.user_id).length]}),(0,t.jsxs)(o.xv,{className:"text-gray-500",children:["Total: ",er.keys.length]})]})]}),(0,t.jsx)(C.Z,{objectPermission:ez.object_permission,variant:"card",accessToken:Y}),(0,t.jsx)(N.Z,{loggingConfigs:(null===(l=ez.metadata)||void 0===l?void 0:l.logging)||[],disabledCallbacks:[],variant:"card"})]})}),(0,t.jsx)(o.x4,{children:(0,t.jsx)(ee,{teamData:er,canEditTeam:eE,handleMemberDelete:e=>{eC(e),eT(!0)},setSelectedEditMember:ep,setIsEditMemberModalVisible:ex,setIsAddMemberModalVisible:ec})}),eE&&(0,t.jsx)(o.x4,{children:(0,t.jsx)(W,{teamId:Q,accessToken:Y,canEditTeam:eE})}),(0,t.jsx)(o.x4,{children:(0,t.jsxs)(o.Zb,{className:"overflow-y-auto max-h-[65vh]",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(o.Dx,{children:"Team Settings"}),eE&&!eg&&(0,t.jsx)(o.zx,{onClick:()=>e_(!0),children:"Edit Settings"})]}),eg?(0,t.jsxs)(c.Z,{form:eu,onFinish:eU,initialValues:{...ez,team_alias:ez.team_alias,models:ez.models,tpm_limit:ez.tpm_limit,rpm_limit:ez.rpm_limit,max_budget:ez.max_budget,budget_duration:ez.budget_duration,team_member_tpm_limit:null===(s=ez.team_member_budget_table)||void 0===s?void 0:s.tpm_limit,team_member_rpm_limit:null===(L=ez.team_member_budget_table)||void 0===L?void 0:L.rpm_limit,guardrails:(null===(F=ez.metadata)||void 0===F?void 0:F.guardrails)||[],disable_global_guardrails:(null===(E=ez.metadata)||void 0===E?void 0:E.disable_global_guardrails)||!1,metadata:ez.metadata?JSON.stringify((e=>{let{logging:l,...s}=e;return s})(ez.metadata),null,2):"",logging_settings:(null===(O=ez.metadata)||void 0===O?void 0:O.logging)||[],organization_id:ez.organization_id,vector_stores:(null===(D=ez.object_permission)||void 0===D?void 0:D.vector_stores)||[],mcp_servers:(null===(A=ez.object_permission)||void 0===A?void 0:A.mcp_servers)||[],mcp_access_groups:(null===(R=ez.object_permission)||void 0===R?void 0:R.mcp_access_groups)||[],mcp_servers_and_groups:{servers:(null===(U=ez.object_permission)||void 0===U?void 0:U.mcp_servers)||[],accessGroups:(null===(z=ez.object_permission)||void 0===z?void 0:z.mcp_access_groups)||[]},mcp_tool_permissions:(null===(B=ez.object_permission)||void 0===B?void 0:B.mcp_tool_permissions)||{}},layout:"vertical",children:[(0,t.jsx)(c.Z.Item,{label:"Team Name",name:"team_alias",rules:[{required:!0,message:"Please input a team name"}],children:(0,t.jsx)(x.default,{type:""})}),(0,t.jsx)(c.Z.Item,{label:"Models",name:"models",rules:[{required:!0,message:"Please select at least one model"}],children:(0,t.jsxs)(b.default,{mode:"multiple",placeholder:"Select models",children:[(el||es.includes("all-proxy-models"))&&(0,t.jsx)(b.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),(0,t.jsx)(b.default.Option,{value:"no-default-models",children:"No Default Models"},"no-default-models"),Array.from(new Set(es)).map((e,l)=>(0,t.jsx)(b.default.Option,{value:e,children:(0,y.W0)(e)},l))]})}),(0,t.jsx)(c.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,t.jsx)(S.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,t.jsx)(c.Z.Item,{label:"Team Member Budget (USD)",name:"team_member_budget",tooltip:"This is the individual budget for a user in the team.",children:(0,t.jsx)(S.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,t.jsx)(c.Z.Item,{label:"Team Member Key Duration (eg: 1d, 1mo)",name:"team_member_key_duration",tooltip:"Set a limit to the duration of a team member's key. Format: 30s (seconds), 30m (minutes), 30h (hours), 30d (days), 1mo (month)",children:(0,t.jsx)(o.oi,{placeholder:"e.g., 30d"})}),(0,t.jsx)(c.Z.Item,{label:"Team Member TPM Limit",name:"team_member_tpm_limit",tooltip:"Default tokens per minute limit for an individual team member. This limit applies to all requests the user makes within this team. Can be overridden per member.",children:(0,t.jsx)(S.Z,{step:1,style:{width:"100%"},placeholder:"e.g., 1000"})}),(0,t.jsx)(c.Z.Item,{label:"Team Member RPM Limit",name:"team_member_rpm_limit",tooltip:"Default requests per minute limit for an individual team member. This limit applies to all requests the user makes within this team. Can be overridden per member.",children:(0,t.jsx)(S.Z,{step:1,style:{width:"100%"},placeholder:"e.g., 100"})}),(0,t.jsx)(c.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,t.jsxs)(b.default,{placeholder:"n/a",children:[(0,t.jsx)(b.default.Option,{value:"24h",children:"daily"}),(0,t.jsx)(b.default.Option,{value:"7d",children:"weekly"}),(0,t.jsx)(b.default.Option,{value:"30d",children:"monthly"})]})}),(0,t.jsx)(c.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,t.jsx)(S.Z,{step:1,style:{width:"100%"}})}),(0,t.jsx)(c.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,t.jsx)(S.Z,{step:1,style:{width:"100%"}})}),(0,t.jsx)(c.Z.Item,{label:(0,t.jsxs)("span",{children:["Guardrails"," ",(0,t.jsx)(p.Z,{title:"Setup your first guardrail",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})})]}),name:"guardrails",help:"Select existing guardrails or enter new ones",children:(0,t.jsx)(b.default,{mode:"tags",placeholder:"Select or enter guardrails",options:ew.map(e=>({value:e,label:e}))})}),(0,t.jsx)(c.Z.Item,{label:(0,t.jsxs)("span",{children:["Disable Global Guardrails"," ",(0,t.jsx)(p.Z,{title:"When enabled, this team will bypass any guardrails configured to run on every request (global guardrails)",children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})]}),name:"disable_global_guardrails",valuePropName:"checked",help:"Bypass global guardrails for this team",children:(0,t.jsx)(g.Z,{checkedChildren:"Yes",unCheckedChildren:"No"})}),(0,t.jsx)(c.Z.Item,{label:"Vector Stores",name:"vector_stores",children:(0,t.jsx)(T.Z,{onChange:e=>eu.setFieldValue("vector_stores",e),value:eu.getFieldValue("vector_stores"),accessToken:Y||"",placeholder:"Select vector stores"})}),(0,t.jsx)(c.Z.Item,{label:"Allowed Pass Through Routes",name:"allowed_passthrough_routes",children:(0,t.jsx)(Z.Z,{onChange:e=>eu.setFieldValue("allowed_passthrough_routes",e),value:eu.getFieldValue("allowed_passthrough_routes"),accessToken:Y||"",placeholder:"Select pass through routes"})}),(0,t.jsx)(c.Z.Item,{label:"MCP Servers / Access Groups",name:"mcp_servers_and_groups",children:(0,t.jsx)(w.Z,{onChange:e=>eu.setFieldValue("mcp_servers_and_groups",e),value:eu.getFieldValue("mcp_servers_and_groups"),accessToken:Y||"",placeholder:"Select MCP servers or access groups (optional)"})}),(0,t.jsx)(c.Z.Item,{name:"mcp_tool_permissions",initialValue:{},hidden:!0,children:(0,t.jsx)(x.default,{type:"hidden"})}),(0,t.jsx)(c.Z.Item,{noStyle:!0,shouldUpdate:(e,l)=>e.mcp_servers_and_groups!==l.mcp_servers_and_groups||e.mcp_tool_permissions!==l.mcp_tool_permissions,children:()=>{var e;return(0,t.jsx)("div",{className:"mb-6",children:(0,t.jsx)(k.Z,{accessToken:Y||"",selectedServers:(null===(e=eu.getFieldValue("mcp_servers_and_groups"))||void 0===e?void 0:e.servers)||[],toolPermissions:eu.getFieldValue("mcp_tool_permissions")||{},onChange:e=>eu.setFieldsValue({mcp_tool_permissions:e})})})}}),(0,t.jsx)(c.Z.Item,{label:"Organization ID",name:"organization_id",children:(0,t.jsx)(x.default,{type:""})}),(0,t.jsx)(c.Z.Item,{label:"Logging Settings",name:"logging_settings",children:(0,t.jsx)(P.Z,{value:eu.getFieldValue("logging_settings"),onChange:e=>eu.setFieldValue("logging_settings",e)})}),(0,t.jsx)(c.Z.Item,{label:"Metadata",name:"metadata",children:(0,t.jsx)(x.default.TextArea,{rows:10})}),(0,t.jsx)("div",{className:"sticky z-10 bg-white p-4 border-t border-gray-200 bottom-[-1.5rem] inset-x-[-1.5rem]",children:(0,t.jsxs)("div",{className:"flex justify-end items-center gap-2",children:[(0,t.jsx)(o.zx,{variant:"secondary",onClick:()=>e_(!1),disabled:eL,children:"Cancel"}),(0,t.jsx)(o.zx,{type:"submit",loading:eL,children:"Save Changes"})]})})]}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Team Name"}),(0,t.jsx)("div",{children:ez.team_alias})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Team ID"}),(0,t.jsx)("div",{className:"font-mono",children:ez.team_id})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Created At"}),(0,t.jsx)("div",{children:new Date(ez.created_at).toLocaleString()})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Models"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:ez.models.map((e,l)=>(0,t.jsx)(o.Ct,{color:"red",children:e},l))})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Rate Limits"}),(0,t.jsxs)("div",{children:["TPM: ",ez.tpm_limit||"Unlimited"]}),(0,t.jsxs)("div",{children:["RPM: ",ez.rpm_limit||"Unlimited"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Team Budget"}),(0,t.jsxs)("div",{children:["Max Budget:"," ",null!==ez.max_budget?"$".concat((0,r.pw)(ez.max_budget,4)):"No Limit"]}),(0,t.jsxs)("div",{children:["Budget Reset: ",ez.budget_duration||"Never"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(o.xv,{className:"font-medium",children:["Team Member Settings"," ",(0,t.jsx)(p.Z,{title:"These are limits on individual team members",children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})]}),(0,t.jsxs)("div",{children:["Max Budget: ",(null===(V=ez.team_member_budget_table)||void 0===V?void 0:V.max_budget)||"No Limit"]}),(0,t.jsxs)("div",{children:["Key Duration: ",(null===(q=ez.metadata)||void 0===q?void 0:q.team_member_key_duration)||"No Limit"]}),(0,t.jsxs)("div",{children:["TPM Limit: ",(null===(G=ez.team_member_budget_table)||void 0===G?void 0:G.tpm_limit)||"No Limit"]}),(0,t.jsxs)("div",{children:["RPM Limit: ",(null===(K=ez.team_member_budget_table)||void 0===K?void 0:K.rpm_limit)||"No Limit"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Organization ID"}),(0,t.jsx)("div",{children:ez.organization_id})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Status"}),(0,t.jsx)(o.Ct,{color:ez.blocked?"red":"green",children:ez.blocked?"Blocked":"Active"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Disable Global Guardrails"}),(0,t.jsx)("div",{children:(null===($=ez.metadata)||void 0===$?void 0:$.disable_global_guardrails)===!0?(0,t.jsx)(o.Ct,{color:"yellow",children:"Enabled - Global guardrails bypassed"}):(0,t.jsx)(o.Ct,{color:"green",children:"Disabled - Global guardrails active"})})]}),(0,t.jsx)(C.Z,{objectPermission:ez.object_permission,variant:"inline",className:"pt-4 border-t border-gray-200",accessToken:Y}),(0,t.jsx)(N.Z,{loggingConfigs:(null===(J=ez.metadata)||void 0===J?void 0:J.logging)||[],disabledCallbacks:[],variant:"inline",className:"pt-4 border-t border-gray-200"})]})]})})]})]}),(0,t.jsx)(I.Z,{visible:eh,onCancel:()=>ex(!1),onSubmit:eA,initialData:eb,mode:"edit",config:{title:"Edit Member",showEmail:!0,showUserId:!0,roleOptions:[{label:"Admin",value:"admin"},{label:"User",value:"user"}],additionalFields:[{name:"max_budget_in_team",label:(0,t.jsxs)("span",{children:["Team Member Budget (USD)"," ",(0,t.jsx)(p.Z,{title:"Maximum amount in USD this member can spend within this team. This is separate from any global user budget limits",children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})]}),type:"numerical",step:.01,min:0,placeholder:"Budget limit for this member within this team"},{name:"tpm_limit",label:(0,t.jsxs)("span",{children:["Team Member TPM Limit"," ",(0,t.jsx)(p.Z,{title:"Maximum tokens per minute this member can use within this team. This is separate from any global user TPM limit",children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})]}),type:"numerical",step:1,min:0,placeholder:"Tokens per minute limit for this member in this team"},{name:"rpm_limit",label:(0,t.jsxs)("span",{children:["Team Member RPM Limit"," ",(0,t.jsx)(p.Z,{title:"Maximum requests per minute this member can make within this team. This is separate from any global user RPM limit",children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})]}),type:"numerical",step:1,min:0,placeholder:"Requests per minute limit for this member in this team"}]}}),(0,t.jsx)(i.Z,{isVisible:eo,onCancel:()=>ec(!1),onSubmit:eD,accessToken:Y}),(0,t.jsx)(f.Z,{isOpen:eS,title:"Delete Team Member",alertMessage:"Removing team members will also delete any keys created by or created for this member.",message:"Are you sure you want to remove this member from the team? This action cannot be undone.",resourceInformationTitle:"Team Member Information",resourceInformation:[{label:"User ID",value:null==eM?void 0:eM.user_id,code:!0},{label:"Email",value:null==eM?void 0:eM.user_email},{label:"Role",value:null==eM?void 0:eM.role}],onCancel:()=>{eT(!1),eC(null)},onOk:eR,confirmLoading:eI})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2012-dcbd62e829c6106f.js b/litellm/proxy/_experimental/out/_next/static/chunks/2012-dcbd62e829c6106f.js new file mode 100644 index 00000000000..c7545f87f93 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/2012-dcbd62e829c6106f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2012],{26210:function(e,l,s){s.d(l,{UQ:function(){return t.Z},X1:function(){return i.Z},_m:function(){return a.Z},oi:function(){return n.Z},xv:function(){return r.Z}});var t=s(87452),i=s(88829),a=s(72208),r=s(84264),n=s(49566)},30078:function(e,l,s){s.d(l,{Ct:function(){return t.Z},Dx:function(){return x.Z},OK:function(){return n.Z},Zb:function(){return a.Z},nP:function(){return c.Z},oi:function(){return h.Z},rj:function(){return r.Z},td:function(){return o.Z},v0:function(){return m.Z},x4:function(){return d.Z},xv:function(){return u.Z},zx:function(){return i.Z}});var t=s(41649),i=s(78489),a=s(12514),r=s(67101),n=s(12485),m=s(18135),o=s(35242),d=s(29706),c=s(77991),u=s(84264),h=s(49566),x=s(96761)},62490:function(e,l,s){s.d(l,{Ct:function(){return t.Z},RM:function(){return n.Z},SC:function(){return c.Z},Zb:function(){return a.Z},iA:function(){return r.Z},pj:function(){return m.Z},ss:function(){return o.Z},xs:function(){return d.Z},xv:function(){return u.Z},zx:function(){return i.Z}});var t=s(41649),i=s(78489),a=s(12514),r=s(21626),n=s(97214),m=s(28241),o=s(58834),d=s(69552),c=s(71876),u=s(84264)},11318:function(e,l,s){s.d(l,{Z:function(){return n}});var t=s(2265),i=s(39760),a=s(19250);let r=async(e,l,s,t)=>"Admin"!=s&&"Admin Viewer"!=s?await (0,a.teamListCall)(e,(null==t?void 0:t.organization_id)||null,l):await (0,a.teamListCall)(e,(null==t?void 0:t.organization_id)||null);var n=()=>{let[e,l]=(0,t.useState)([]),{accessToken:s,userId:a,userRole:n}=(0,i.Z)();return(0,t.useEffect)(()=>{(async()=>{l(await r(s,a,n,null))})()},[s,a,n]),{teams:e,setTeams:l}}},21609:function(e,l,s){s.d(l,{Z:function(){return d}});var t=s(57437),i=s(57840),a=s(22116),r=s(51653),n=s(76188),m=s(4260),o=s(2265);function d(e){let{isOpen:l,title:s,alertMessage:d,message:c,resourceInformationTitle:u,resourceInformation:h,onCancel:x,onOk:p,confirmLoading:g,requiredConfirmation:b}=e,{Title:_,Text:v}=i.default,[j,f]=(0,o.useState)("");return(0,o.useEffect)(()=>{l&&f("")},[l]),(0,t.jsx)(a.Z,{title:s,open:l,onOk:p,onCancel:x,confirmLoading:g,okText:g?"Deleting...":"Delete",cancelText:"Cancel",okButtonProps:{danger:!0,disabled:!!b&&j!==b||g},cancelButtonProps:{disabled:g},children:(0,t.jsxs)("div",{className:"space-y-4",children:[d&&(0,t.jsx)(r.Z,{message:d,type:"warning"}),(0,t.jsxs)("div",{className:"mt-4 p-4 bg-red-50 rounded-lg border border-red-200",children:[(0,t.jsx)(_,{level:5,className:"mb-3 text-gray-900",children:u}),(0,t.jsx)(n.Z,{column:1,size:"small",children:h&&h.map(e=>{let{label:l,value:s,...i}=e;return(0,t.jsx)(n.Z.Item,{label:(0,t.jsx)("span",{className:"font-semibold text-gray-700",children:l}),children:(0,t.jsx)(v,{...i,children:null!=s?s:"-"})},l)})})]}),(0,t.jsx)("div",{children:(0,t.jsx)(v,{children:c})}),b&&(0,t.jsxs)("div",{className:"mb-6 mt-4 pt-4 border-t border-gray-200",children:[(0,t.jsxs)(v,{className:"block text-base font-medium text-gray-700 mb-2",children:[(0,t.jsx)(v,{children:"Type "}),(0,t.jsx)(v,{strong:!0,type:"danger",children:b}),(0,t.jsx)(v,{children:" to confirm deletion:"})]}),(0,t.jsx)(m.default,{value:j,onChange:e=>f(e.target.value),placeholder:b,className:"rounded-md text-base border-gray-200",autoFocus:!0})]})]})})}},33860:function(e,l,s){var t=s(57437),i=s(2265),a=s(10032),r=s(22116),n=s(37592),m=s(99981),o=s(5545),d=s(7310),c=s.n(d),u=s(19250);l.Z=e=>{let{isVisible:l,onCancel:s,onSubmit:d,accessToken:h,title:x="Add Team Member",roles:p=[{label:"admin",value:"admin",description:"Admin role. Can create team keys, add members, and manage settings."},{label:"user",value:"user",description:"User role. Can view team info, but not manage it."}],defaultRole:g="user"}=e,[b]=a.Z.useForm(),[_,v]=(0,i.useState)([]),[j,f]=(0,i.useState)(!1),[Z,y]=(0,i.useState)("user_email"),N=async(e,l)=>{if(!e){v([]);return}f(!0);try{let s=new URLSearchParams;if(s.append(l,e),null==h)return;let t=(await (0,u.userFilterUICall)(h,s)).map(e=>({label:"user_email"===l?"".concat(e.user_email):"".concat(e.user_id),value:"user_email"===l?e.user_email:e.user_id,user:e}));v(t)}catch(e){console.error("Error fetching users:",e)}finally{f(!1)}},w=(0,i.useCallback)(c()((e,l)=>N(e,l),300),[]),k=(e,l)=>{y(l),w(e,l)},M=(e,l)=>{let s=l.user;b.setFieldsValue({user_email:s.user_email,user_id:s.user_id,role:b.getFieldValue("role")})};return(0,t.jsx)(r.Z,{title:x,open:l,onCancel:()=>{b.resetFields(),v([]),s()},footer:null,width:800,children:(0,t.jsxs)(a.Z,{form:b,onFinish:d,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",initialValues:{role:g},children:[(0,t.jsx)(a.Z.Item,{label:"Email",name:"user_email",className:"mb-4",children:(0,t.jsx)(n.default,{showSearch:!0,className:"w-full",placeholder:"Search by email",filterOption:!1,onSearch:e=>k(e,"user_email"),onSelect:(e,l)=>M(e,l),options:"user_email"===Z?_:[],loading:j,allowClear:!0})}),(0,t.jsx)("div",{className:"text-center mb-4",children:"OR"}),(0,t.jsx)(a.Z.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,t.jsx)(n.default,{showSearch:!0,className:"w-full",placeholder:"Search by user ID",filterOption:!1,onSearch:e=>k(e,"user_id"),onSelect:(e,l)=>M(e,l),options:"user_id"===Z?_:[],loading:j,allowClear:!0})}),(0,t.jsx)(a.Z.Item,{label:"Member Role",name:"role",className:"mb-4",children:(0,t.jsx)(n.default,{defaultValue:g,children:p.map(e=>(0,t.jsx)(n.default.Option,{value:e.value,children:(0,t.jsxs)(m.Z,{title:e.description,children:[(0,t.jsx)("span",{className:"font-medium",children:e.label}),(0,t.jsxs)("span",{className:"ml-2 text-gray-500 text-sm",children:["- ",e.description]})]})},e.value))})}),(0,t.jsx)("div",{className:"text-right mt-4",children:(0,t.jsx)(o.ZP,{type:"default",htmlType:"submit",children:"Add Member"})})]})})}},10901:function(e,l,s){s.d(l,{Z:function(){return h}});var t=s(57437),i=s(2265),a=s(10032),r=s(22116),n=s(5545),m=s(27281),o=s(43227),d=s(49566),c=s(92280),u=s(24199),h=e=>{var l,s,h;let{visible:x,onCancel:p,onSubmit:g,initialData:b,mode:_,config:v}=e,[j]=a.Z.useForm();console.log("Initial Data:",b),(0,i.useEffect)(()=>{if(x){if("edit"===_&&b){let e={...b,role:b.role||v.defaultRole,max_budget_in_team:b.max_budget_in_team||null,tpm_limit:b.tpm_limit||null,rpm_limit:b.rpm_limit||null};console.log("Setting form values:",e),j.setFieldsValue(e)}else{var e;j.resetFields(),j.setFieldsValue({role:v.defaultRole||(null===(e=v.roleOptions[0])||void 0===e?void 0:e.value)})}}},[x,b,_,j,v.defaultRole,v.roleOptions]);let f=async e=>{try{let l=Object.entries(e).reduce((e,l)=>{let[s,t]=l;if("string"==typeof t){let l=t.trim();return""===l&&("max_budget_in_team"===s||"tpm_limit"===s||"rpm_limit"===s)?{...e,[s]:null}:{...e,[s]:l}}return{...e,[s]:t}},{});console.log("Submitting form data:",l),g(l),j.resetFields()}catch(e){console.error("Form submission error:",e)}},Z=e=>{switch(e.type){case"input":return(0,t.jsx)(d.Z,{placeholder:e.placeholder});case"numerical":return(0,t.jsx)(u.Z,{step:e.step||1,min:e.min||0,style:{width:"100%"},placeholder:e.placeholder||"Enter a numerical value"});case"select":var l;return(0,t.jsx)(m.Z,{children:null===(l=e.options)||void 0===l?void 0:l.map(e=>(0,t.jsx)(o.Z,{value:e.value,children:e.label},e.value))});default:return null}};return(0,t.jsx)(r.Z,{title:v.title||("add"===_?"Add Member":"Edit Member"),open:x,width:1e3,footer:null,onCancel:p,children:(0,t.jsxs)(a.Z,{form:j,onFinish:f,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[v.showEmail&&(0,t.jsx)(a.Z.Item,{label:"Email",name:"user_email",className:"mb-4",rules:[{type:"email",message:"Please enter a valid email!"}],children:(0,t.jsx)(d.Z,{placeholder:"user@example.com"})}),v.showEmail&&v.showUserId&&(0,t.jsx)("div",{className:"text-center mb-4",children:(0,t.jsx)(c.x,{children:"OR"})}),v.showUserId&&(0,t.jsx)(a.Z.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,t.jsx)(d.Z,{placeholder:"user_123"})}),(0,t.jsx)(a.Z.Item,{label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{children:"Role"}),"edit"===_&&b&&(0,t.jsxs)("span",{className:"text-gray-500 text-sm",children:["(Current: ",(s=b.role,(null===(h=v.roleOptions.find(e=>e.value===s))||void 0===h?void 0:h.label)||s),")"]})]}),name:"role",className:"mb-4",rules:[{required:!0,message:"Please select a role!"}],children:(0,t.jsx)(m.Z,{children:"edit"===_&&b?[...v.roleOptions.filter(e=>e.value===b.role),...v.roleOptions.filter(e=>e.value!==b.role)].map(e=>(0,t.jsx)(o.Z,{value:e.value,children:e.label},e.value)):v.roleOptions.map(e=>(0,t.jsx)(o.Z,{value:e.value,children:e.label},e.value))})}),null===(l=v.additionalFields)||void 0===l?void 0:l.map(e=>(0,t.jsx)(a.Z.Item,{label:e.label,name:e.name,className:"mb-4",rules:e.rules,children:Z(e)},e.name)),(0,t.jsxs)("div",{className:"text-right mt-6",children:[(0,t.jsx)(n.ZP,{onClick:p,className:"mr-2",children:"Cancel"}),(0,t.jsx)(n.ZP,{type:"default",htmlType:"submit",children:"add"===_?"Add Member":"Save Changes"})]})]})})}},33293:function(e,l,s){s.d(l,{Z:function(){return et}});var t=s(57437),i=s(33860),a=s(19250),r=s(59872),n=s(33304),m=s(15424),o=s(77331),d=s(30078),c=s(10032),u=s(42264),h=s(5545),x=s(4260),p=s(37592),g=s(99981),b=s(63709),_=s(30401),v=s(78867),j=s(2265),f=s(21609),Z=s(95096),y=s(46468),N=s(27799),w=s(95920),k=s(68473),M=s(82586),C=s(9114),S=s(60131),T=s(24199),I=s(97415),P=s(10901),L=s(21425),F=s(78489),E=s(12514),O=s(21626),D=s(97214),A=s(28241),R=s(58834),z=s(69552),U=s(71876),V=s(84264),B=s(96761),G=s(61994),q=s(85180),K=s(89245),$=s(78355);let J={"/key/generate":"Member can generate a virtual key for this team","/key/service-account/generate":"Member can generate a service account key (not belonging to any user) for this team","/key/update":"Member can update a virtual key belonging to this team","/key/delete":"Member can delete a virtual key belonging to this team","/key/info":"Member can get info about a virtual key belonging to this team","/key/regenerate":"Member can regenerate a virtual key belonging to this team","/key/{key_id}/regenerate":"Member can regenerate a virtual key belonging to this team","/key/list":"Member can list virtual keys belonging to this team","/key/block":"Member can block a virtual key belonging to this team","/key/unblock":"Member can unblock a virtual key belonging to this team"},Q=e=>e.includes("/info")||e.includes("/list")?"GET":"POST",W=e=>{let l=Q(e),s=J[e];if(!s){for(let[l,t]of Object.entries(J))if(e.includes(l)){s=t;break}}return s||(s="Access ".concat(e)),{method:l,endpoint:e,description:s,route:e}};var X=e=>{let{teamId:l,accessToken:s,canEditTeam:i}=e,[r,n]=(0,j.useState)([]),[m,o]=(0,j.useState)([]),[d,c]=(0,j.useState)(!0),[u,x]=(0,j.useState)(!1),[p,g]=(0,j.useState)(!1),b=async()=>{try{if(c(!0),!s)return;let e=await (0,a.getTeamPermissionsCall)(s,l),t=e.all_available_permissions||[];n(t);let i=e.team_member_permissions||[];o(i),g(!1)}catch(e){C.Z.fromBackend("Failed to load permissions"),console.error("Error fetching permissions:",e)}finally{c(!1)}};(0,j.useEffect)(()=>{b()},[l,s]);let _=(e,l)=>{o(l?[...m,e]:m.filter(l=>l!==e)),g(!0)},v=async()=>{try{if(!s)return;x(!0),await (0,a.teamPermissionsUpdateCall)(s,l,m),C.Z.success("Permissions updated successfully"),g(!1)}catch(e){C.Z.fromBackend("Failed to update permissions"),console.error("Error updating permissions:",e)}finally{x(!1)}};if(d)return(0,t.jsx)("div",{className:"p-6 text-center",children:"Loading permissions..."});let f=r.length>0;return(0,t.jsxs)(E.Z,{className:"bg-white shadow-md rounded-md p-6",children:[(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center border-b pb-4 mb-6",children:[(0,t.jsx)(B.Z,{className:"mb-2 sm:mb-0",children:"Member Permissions"}),i&&p&&(0,t.jsxs)("div",{className:"flex gap-3",children:[(0,t.jsx)(h.ZP,{icon:(0,t.jsx)(K.Z,{}),onClick:()=>{b()},children:"Reset"}),(0,t.jsxs)(F.Z,{onClick:v,loading:u,className:"flex items-center gap-2",children:[(0,t.jsx)($.Z,{})," Save Changes"]})]})]}),(0,t.jsx)(V.Z,{className:"mb-6 text-gray-600",children:"Control what team members can do when they are not team admins."}),f?(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(O.Z,{className:" min-w-full",children:[(0,t.jsx)(R.Z,{children:(0,t.jsxs)(U.Z,{children:[(0,t.jsx)(z.Z,{children:"Method"}),(0,t.jsx)(z.Z,{children:"Endpoint"}),(0,t.jsx)(z.Z,{children:"Description"}),(0,t.jsx)(z.Z,{className:"sticky right-0 bg-white shadow-[-4px_0_4px_-4px_rgba(0,0,0,0.1)] text-center",children:"Allow Access"})]})}),(0,t.jsx)(D.Z,{children:r.map(e=>{let l=W(e);return(0,t.jsxs)(U.Z,{className:"hover:bg-gray-50 transition-colors",children:[(0,t.jsx)(A.Z,{children:(0,t.jsx)("span",{className:"px-2 py-1 rounded text-xs font-medium ".concat("GET"===l.method?"bg-blue-100 text-blue-800":"bg-green-100 text-green-800"),children:l.method})}),(0,t.jsx)(A.Z,{children:(0,t.jsx)("span",{className:"font-mono text-sm text-gray-800",children:l.endpoint})}),(0,t.jsx)(A.Z,{className:"text-gray-700",children:l.description}),(0,t.jsx)(A.Z,{className:"sticky right-0 bg-white shadow-[-4px_0_4px_-4px_rgba(0,0,0,0.1)] text-center",children:(0,t.jsx)(G.Z,{checked:m.includes(e),onChange:l=>_(e,l.target.checked),disabled:!i})})]},e)})})]})}):(0,t.jsx)("div",{className:"py-12",children:(0,t.jsx)(q.Z,{description:"No permissions available"})})]})},Y=s(47323),H=s(53410),ee=s(74998),el=e=>{let{teamData:l,canEditTeam:s,handleMemberDelete:i,setSelectedEditMember:a,setIsEditMemberModalVisible:n,setIsAddMemberModalVisible:o}=e,d=e=>{if(null==e)return"0";if("number"==typeof e){let l=Number(e);return l===Math.floor(l)?l.toString():(0,r.pw)(l,8).replace(/\.?0+$/,"")}return"0"},c=e=>{if(!e)return 0;let s=l.team_memberships.find(l=>l.user_id===e);return(null==s?void 0:s.spend)||0},u=e=>{var s;if(!e)return null;let t=l.team_memberships.find(l=>l.user_id===e);console.log("membership=".concat(t));let i=null==t?void 0:null===(s=t.litellm_budget_table)||void 0===s?void 0:s.max_budget;return null==i?null:d(i)},h=e=>{var s,t;if(!e)return"No Limits";let i=l.team_memberships.find(l=>l.user_id===e),a=null==i?void 0:null===(s=i.litellm_budget_table)||void 0===s?void 0:s.rpm_limit,r=null==i?void 0:null===(t=i.litellm_budget_table)||void 0===t?void 0:t.tpm_limit,n=[a?"".concat(d(a)," RPM"):null,r?"".concat(d(r)," TPM"):null].filter(Boolean);return n.length>0?n.join(" / "):"No Limits"};return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(E.Z,{className:"w-full mx-auto flex-auto overflow-auto max-h-[50vh]",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(O.Z,{className:"min-w-full",children:[(0,t.jsx)(R.Z,{children:(0,t.jsxs)(U.Z,{children:[(0,t.jsx)(z.Z,{children:"User ID"}),(0,t.jsx)(z.Z,{children:"User Email"}),(0,t.jsx)(z.Z,{children:"Role"}),(0,t.jsxs)(z.Z,{children:["Team Member Spend (USD)"," ",(0,t.jsx)(g.Z,{title:"This is the amount spent by a user in the team.",children:(0,t.jsx)(m.Z,{})})]}),(0,t.jsx)(z.Z,{children:"Team Member Budget (USD)"}),(0,t.jsxs)(z.Z,{children:["Team Member Rate Limits"," ",(0,t.jsx)(g.Z,{title:"Rate limits for this member's usage within this team.",children:(0,t.jsx)(m.Z,{})})]}),(0,t.jsx)(z.Z,{className:"sticky right-0 bg-white z-10 border-l border-gray-200",children:"Actions"})]})}),(0,t.jsx)(D.Z,{children:l.team_info.members_with_roles.map((e,m)=>(0,t.jsxs)(U.Z,{children:[(0,t.jsx)(A.Z,{children:(0,t.jsx)(V.Z,{className:"font-mono",children:e.user_id})}),(0,t.jsx)(A.Z,{children:(0,t.jsx)(V.Z,{className:"font-mono",children:e.user_email?e.user_email:"No Email"})}),(0,t.jsx)(A.Z,{children:(0,t.jsx)(V.Z,{className:"font-mono",children:e.role})}),(0,t.jsx)(A.Z,{children:(0,t.jsxs)(V.Z,{className:"font-mono",children:["$",(0,r.pw)(c(e.user_id),4)]})}),(0,t.jsx)(A.Z,{children:(0,t.jsx)(V.Z,{className:"font-mono",children:u(e.user_id)?"$".concat((0,r.pw)(Number(u(e.user_id)),4)):"No Limit"})}),(0,t.jsx)(A.Z,{children:(0,t.jsx)(V.Z,{className:"font-mono",children:h(e.user_id)})}),(0,t.jsx)(A.Z,{className:"sticky right-0 bg-white z-10 border-l border-gray-200",children:s&&(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(Y.Z,{icon:H.Z,size:"sm",onClick:()=>{var s,t,i;let r=l.team_memberships.find(l=>l.user_id===e.user_id);a({...e,max_budget_in_team:(null==r?void 0:null===(s=r.litellm_budget_table)||void 0===s?void 0:s.max_budget)||null,tpm_limit:(null==r?void 0:null===(t=r.litellm_budget_table)||void 0===t?void 0:t.tpm_limit)||null,rpm_limit:(null==r?void 0:null===(i=r.litellm_budget_table)||void 0===i?void 0:i.rpm_limit)||null}),n(!0)},className:"cursor-pointer hover:text-blue-600"}),(0,t.jsx)(Y.Z,{icon:ee.Z,size:"sm",onClick:()=>i(e),className:"cursor-pointer hover:text-red-600"})]})})]},m))})]})})}),(0,t.jsx)(F.Z,{onClick:()=>o(!0),children:"Add Member"})]})};let es=(e,l)=>{let s=[];return s=e?e.models.includes("all-proxy-models")?l:e.models.length>0?e.models:l:l,(0,y.Ob)(s,l)};var et=e=>{var l,s,F,E,O,D,A,R,z,U,V,B,G,q,K,$,J,Q,W,Y,H;let ee;let{teamId:et,onClose:ei,accessToken:ea,is_team_admin:er,is_proxy_admin:en,userModels:em,editTeam:eo,premiumUser:ed=!1,onUpdate:ec}=e,[eu,eh]=(0,j.useState)(null),[ex,ep]=(0,j.useState)(!0),[eg,eb]=(0,j.useState)(!1),[e_]=c.Z.useForm(),[ev,ej]=(0,j.useState)(!1),[ef,eZ]=(0,j.useState)(null),[ey,eN]=(0,j.useState)(!1),[ew,ek]=(0,j.useState)([]),[eM,eC]=(0,j.useState)(!1),[eS,eT]=(0,j.useState)({}),[eI,eP]=(0,j.useState)([]),[eL,eF]=(0,j.useState)(null),[eE,eO]=(0,j.useState)(!1),[eD,eA]=(0,j.useState)(!1),[eR,ez]=(0,j.useState)(!1),[eU,eV]=(0,j.useState)(null);console.log("userModels in team info",em);let eB=er||en,eG=async()=>{try{if(ep(!0),!ea)return;let e=await (0,a.teamInfoCall)(ea,et);eh(e)}catch(e){C.Z.fromBackend("Failed to load team information"),console.error("Error fetching team info:",e)}finally{ep(!1)}};(0,j.useEffect)(()=>{eG()},[et,ea]),(0,j.useEffect)(()=>{(async()=>{var e;if(!ea||!(null==eu?void 0:null===(e=eu.team_info)||void 0===e?void 0:e.organization_id)){eV(null);return}try{let e=await (0,a.organizationInfoCall)(ea,eu.team_info.organization_id);eV(e)}catch(e){console.error("Error fetching organization info:",e),eV(null)}})()},[ea,null==eu?void 0:null===(l=eu.team_info)||void 0===l?void 0:l.organization_id]);let eq=(0,j.useMemo)(()=>es(eU,em),[eU,em]);(0,j.useEffect)(()=>{(async()=>{try{if(!ea)return;let e=(await (0,a.getGuardrailsList)(ea)).guardrails.map(e=>e.guardrail_name);eP(e)}catch(e){console.error("Failed to fetch guardrails:",e)}})()},[ea]);let eK=async e=>{try{if(null==ea)return;let l={user_email:e.user_email,user_id:e.user_id,role:e.role};await (0,a.teamMemberAddCall)(ea,et,l),C.Z.success("Team member added successfully"),eb(!1),e_.resetFields();let s=await (0,a.teamInfoCall)(ea,et);eh(s),ec(s)}catch(i){var l,s,t;let e="Failed to add team member";(null==i?void 0:null===(t=i.raw)||void 0===t?void 0:null===(s=t.detail)||void 0===s?void 0:null===(l=s.error)||void 0===l?void 0:l.includes("Assigning team admins is a premium feature"))?e="Assigning admins is an enterprise-only feature. Please upgrade your LiteLLM plan to enable this.":(null==i?void 0:i.message)&&(e=i.message),C.Z.fromBackend(e),console.error("Error adding team member:",i)}},e$=async e=>{try{if(null==ea)return;let l={user_email:e.user_email,user_id:e.user_id,role:e.role,max_budget_in_team:e.max_budget_in_team,tpm_limit:e.tpm_limit,rpm_limit:e.rpm_limit};console.log("Updating member with values:",l),u.ZP.destroy(),await (0,a.teamMemberUpdateCall)(ea,et,l),C.Z.success("Team member updated successfully"),ej(!1);let s=await (0,a.teamInfoCall)(ea,et);eh(s),ec(s)}catch(t){var l,s;let e="Failed to update team member";(null==t?void 0:null===(s=t.raw)||void 0===s?void 0:null===(l=s.detail)||void 0===l?void 0:l.includes("Assigning team admins is a premium feature"))?e="Assigning admins is an enterprise-only feature. Please upgrade your LiteLLM plan to enable this.":(null==t?void 0:t.message)&&(e=t.message),ej(!1),u.ZP.destroy(),C.Z.fromBackend(e),console.error("Error updating team member:",t)}},eJ=async()=>{if(eL&&ea){eA(!0);try{await (0,a.teamMemberDeleteCall)(ea,et,eL),C.Z.success("Team member removed successfully");let e=await (0,a.teamInfoCall)(ea,et);eh(e),ec(e)}catch(e){C.Z.fromBackend("Failed to remove team member"),console.error("Error removing team member:",e)}finally{eA(!1),eO(!1),eF(null)}}},eQ=async e=>{try{if(!ea)return;ez(!0);let l={};try{l=e.metadata?JSON.parse(e.metadata):{}}catch(e){C.Z.fromBackend("Invalid JSON in metadata field");return}let s=e=>null==e||"string"==typeof e&&""===e.trim()||"number"==typeof e&&Number.isNaN(e)?null:e,t={team_id:et,team_alias:e.team_alias,models:e.models,tpm_limit:s(e.tpm_limit),rpm_limit:s(e.rpm_limit),max_budget:e.max_budget,budget_duration:e.budget_duration,metadata:{...l,guardrails:e.guardrails||[],logging:e.logging_settings||[]},organization_id:e.organization_id};t.max_budget=(0,n.C)(t.max_budget),void 0!==e.team_member_budget&&(t.team_member_budget=Number(e.team_member_budget)),void 0!==e.team_member_key_duration&&(t.team_member_key_duration=e.team_member_key_duration),(void 0!==e.team_member_tpm_limit||void 0!==e.team_member_rpm_limit)&&(t.team_member_tpm_limit=s(e.team_member_tpm_limit),t.team_member_rpm_limit=s(e.team_member_rpm_limit));let{servers:i,accessGroups:r}=e.mcp_servers_and_groups||{servers:[],accessGroups:[]},m=new Set(i||[]),o=Object.fromEntries(Object.entries(e.mcp_tool_permissions||{}).filter(e=>{let[l]=e;return m.has(l)}));t.object_permission={},i&&(t.object_permission.mcp_servers=i),r&&(t.object_permission.mcp_access_groups=r),o&&(t.object_permission.mcp_tool_permissions=o),delete e.mcp_servers_and_groups,delete e.mcp_tool_permissions;let{agents:d,accessGroups:c}=e.agents_and_groups||{agents:[],accessGroups:[]};d&&d.length>0&&(t.object_permission.agents=d),c&&c.length>0&&(t.object_permission.agent_access_groups=c),delete e.agents_and_groups,await (0,a.teamUpdateCall)(ea,t),C.Z.success("Team settings updated successfully"),eN(!1),eG()}catch(e){console.error("Error updating team:",e)}finally{ez(!1)}};if(ex)return(0,t.jsx)("div",{className:"p-4",children:"Loading..."});if(!(null==eu?void 0:eu.team_info))return(0,t.jsx)("div",{className:"p-4",children:"Team not found"});let{team_info:eW}=eu,eX=async(e,l)=>{await (0,r.vQ)(e)&&(eT(e=>({...e,[l]:!0})),setTimeout(()=>{eT(e=>({...e,[l]:!1}))},2e3))};return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(d.zx,{icon:o.Z,variant:"light",onClick:ei,className:"mb-4",children:"Back to Teams"}),(0,t.jsx)(d.Dx,{children:eW.team_alias}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(d.xv,{className:"text-gray-500 font-mono",children:eW.team_id}),(0,t.jsx)(h.ZP,{type:"text",size:"small",icon:eS["team-id"]?(0,t.jsx)(_.Z,{size:12}):(0,t.jsx)(v.Z,{size:12}),onClick:()=>eX(eW.team_id,"team-id"),className:"left-2 z-10 transition-all duration-200 ".concat(eS["team-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]})}),(0,t.jsxs)(d.v0,{defaultIndex:eo?3:0,children:[(0,t.jsx)(d.td,{className:"mb-4",children:[(0,t.jsx)(d.OK,{children:"Overview"},"overview"),...eB?[(0,t.jsx)(d.OK,{children:"Members"},"members"),(0,t.jsx)(d.OK,{children:"Member Permissions"},"member-permissions"),(0,t.jsx)(d.OK,{children:"Settings"},"settings")]:[]]}),(0,t.jsxs)(d.nP,{children:[(0,t.jsx)(d.x4,{children:(0,t.jsxs)(d.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,t.jsxs)(d.Zb,{children:[(0,t.jsx)(d.xv,{children:"Budget Status"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(d.Dx,{children:["$",(0,r.pw)(eW.spend,4)]}),(0,t.jsxs)(d.xv,{children:["of ",null===eW.max_budget?"Unlimited":"$".concat((0,r.pw)(eW.max_budget,4))]}),eW.budget_duration&&(0,t.jsxs)(d.xv,{className:"text-gray-500",children:["Reset: ",eW.budget_duration]}),(0,t.jsx)("br",{}),eW.team_member_budget_table&&(0,t.jsxs)(d.xv,{className:"text-gray-500",children:["Team Member Budget: $",(0,r.pw)(eW.team_member_budget_table.max_budget,4)]})]})]}),(0,t.jsxs)(d.Zb,{children:[(0,t.jsx)(d.xv,{children:"Rate Limits"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(d.xv,{children:["TPM: ",eW.tpm_limit||"Unlimited"]}),(0,t.jsxs)(d.xv,{children:["RPM: ",eW.rpm_limit||"Unlimited"]}),eW.max_parallel_requests&&(0,t.jsxs)(d.xv,{children:["Max Parallel Requests: ",eW.max_parallel_requests]})]})]}),(0,t.jsxs)(d.Zb,{children:[(0,t.jsx)(d.xv,{children:"Models"}),(0,t.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:0===eW.models.length?(0,t.jsx)(d.Ct,{color:"red",children:"All proxy models"}):eW.models.map((e,l)=>(0,t.jsx)(d.Ct,{color:"red",children:e},l))})]}),(0,t.jsxs)(d.Zb,{children:[(0,t.jsx)(d.xv,{className:"font-semibold text-gray-900",children:"Virtual Keys"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(d.xv,{children:["User Keys: ",eu.keys.filter(e=>e.user_id).length]}),(0,t.jsxs)(d.xv,{children:["Service Account Keys: ",eu.keys.filter(e=>!e.user_id).length]}),(0,t.jsxs)(d.xv,{className:"text-gray-500",children:["Total: ",eu.keys.length]})]})]}),(0,t.jsx)(S.Z,{objectPermission:eW.object_permission,variant:"card",accessToken:ea}),(0,t.jsx)(N.Z,{loggingConfigs:(null===(s=eW.metadata)||void 0===s?void 0:s.logging)||[],disabledCallbacks:[],variant:"card"})]})}),(0,t.jsx)(d.x4,{children:(0,t.jsx)(el,{teamData:eu,canEditTeam:eB,handleMemberDelete:e=>{eF(e),eO(!0)},setSelectedEditMember:eZ,setIsEditMemberModalVisible:ej,setIsAddMemberModalVisible:eb})}),eB&&(0,t.jsx)(d.x4,{children:(0,t.jsx)(X,{teamId:et,accessToken:ea,canEditTeam:eB})}),(0,t.jsx)(d.x4,{children:(0,t.jsxs)(d.Zb,{className:"overflow-y-auto max-h-[65vh]",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(d.Dx,{children:"Team Settings"}),eB&&!ey&&(0,t.jsx)(d.zx,{onClick:()=>eN(!0),children:"Edit Settings"})]}),ey?(0,t.jsxs)(c.Z,{form:e_,onFinish:eQ,initialValues:{...eW,team_alias:eW.team_alias,models:eW.models,tpm_limit:eW.tpm_limit,rpm_limit:eW.rpm_limit,max_budget:eW.max_budget,budget_duration:eW.budget_duration,team_member_tpm_limit:null===(F=eW.team_member_budget_table)||void 0===F?void 0:F.tpm_limit,team_member_rpm_limit:null===(E=eW.team_member_budget_table)||void 0===E?void 0:E.rpm_limit,guardrails:(null===(O=eW.metadata)||void 0===O?void 0:O.guardrails)||[],disable_global_guardrails:(null===(D=eW.metadata)||void 0===D?void 0:D.disable_global_guardrails)||!1,metadata:eW.metadata?JSON.stringify((e=>{let{logging:l,...s}=e;return s})(eW.metadata),null,2):"",logging_settings:(null===(A=eW.metadata)||void 0===A?void 0:A.logging)||[],organization_id:eW.organization_id,vector_stores:(null===(R=eW.object_permission)||void 0===R?void 0:R.vector_stores)||[],mcp_servers:(null===(z=eW.object_permission)||void 0===z?void 0:z.mcp_servers)||[],mcp_access_groups:(null===(U=eW.object_permission)||void 0===U?void 0:U.mcp_access_groups)||[],mcp_servers_and_groups:{servers:(null===(V=eW.object_permission)||void 0===V?void 0:V.mcp_servers)||[],accessGroups:(null===(B=eW.object_permission)||void 0===B?void 0:B.mcp_access_groups)||[]},mcp_tool_permissions:(null===(G=eW.object_permission)||void 0===G?void 0:G.mcp_tool_permissions)||{},agents_and_groups:{agents:(null===(q=eW.object_permission)||void 0===q?void 0:q.agents)||[],accessGroups:(null===(K=eW.object_permission)||void 0===K?void 0:K.agent_access_groups)||[]}},layout:"vertical",children:[(0,t.jsx)(c.Z.Item,{label:"Team Name",name:"team_alias",rules:[{required:!0,message:"Please input a team name"}],children:(0,t.jsx)(x.default,{type:""})}),(0,t.jsx)(c.Z.Item,{label:"Models",name:"models",rules:[{required:!0,message:"Please select at least one model"}],children:(0,t.jsxs)(p.default,{mode:"multiple",placeholder:"Select models",children:[(ee=!1,eU?(0===eU.models.length||eU.models.includes("all-proxy-models"))&&(ee=!0):ee=en||em.includes("all-proxy-models"),ee?(0,t.jsx)(p.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"):null),!eU||eU.models.includes("no-default-models")?(0,t.jsx)(p.default.Option,{value:"no-default-models",children:"No Default Models"},"no-default-models"):null,Array.from(new Set(eq)).map((e,l)=>(0,t.jsx)(p.default.Option,{value:e,children:(0,y.W0)(e)},l))]})}),(0,t.jsx)(c.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,t.jsx)(T.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,t.jsx)(c.Z.Item,{label:"Team Member Budget (USD)",name:"team_member_budget",tooltip:"This is the individual budget for a user in the team.",children:(0,t.jsx)(T.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,t.jsx)(c.Z.Item,{label:"Team Member Key Duration (eg: 1d, 1mo)",name:"team_member_key_duration",tooltip:"Set a limit to the duration of a team member's key. Format: 30s (seconds), 30m (minutes), 30h (hours), 30d (days), 1mo (month)",children:(0,t.jsx)(d.oi,{placeholder:"e.g., 30d"})}),(0,t.jsx)(c.Z.Item,{label:"Team Member TPM Limit",name:"team_member_tpm_limit",tooltip:"Default tokens per minute limit for an individual team member. This limit applies to all requests the user makes within this team. Can be overridden per member.",children:(0,t.jsx)(T.Z,{step:1,style:{width:"100%"},placeholder:"e.g., 1000"})}),(0,t.jsx)(c.Z.Item,{label:"Team Member RPM Limit",name:"team_member_rpm_limit",tooltip:"Default requests per minute limit for an individual team member. This limit applies to all requests the user makes within this team. Can be overridden per member.",children:(0,t.jsx)(T.Z,{step:1,style:{width:"100%"},placeholder:"e.g., 100"})}),(0,t.jsx)(c.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,t.jsxs)(p.default,{placeholder:"n/a",children:[(0,t.jsx)(p.default.Option,{value:"24h",children:"daily"}),(0,t.jsx)(p.default.Option,{value:"7d",children:"weekly"}),(0,t.jsx)(p.default.Option,{value:"30d",children:"monthly"})]})}),(0,t.jsx)(c.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,t.jsx)(T.Z,{step:1,style:{width:"100%"}})}),(0,t.jsx)(c.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,t.jsx)(T.Z,{step:1,style:{width:"100%"}})}),(0,t.jsx)(c.Z.Item,{label:(0,t.jsxs)("span",{children:["Guardrails"," ",(0,t.jsx)(g.Z,{title:"Setup your first guardrail",children:(0,t.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})})]}),name:"guardrails",help:"Select existing guardrails or enter new ones",children:(0,t.jsx)(p.default,{mode:"tags",placeholder:"Select or enter guardrails",options:eI.map(e=>({value:e,label:e}))})}),(0,t.jsx)(c.Z.Item,{label:(0,t.jsxs)("span",{children:["Disable Global Guardrails"," ",(0,t.jsx)(g.Z,{title:"When enabled, this team will bypass any guardrails configured to run on every request (global guardrails)",children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})]}),name:"disable_global_guardrails",valuePropName:"checked",help:"Bypass global guardrails for this team",children:(0,t.jsx)(b.Z,{checkedChildren:"Yes",unCheckedChildren:"No"})}),(0,t.jsx)(c.Z.Item,{label:"Vector Stores",name:"vector_stores",children:(0,t.jsx)(I.Z,{onChange:e=>e_.setFieldValue("vector_stores",e),value:e_.getFieldValue("vector_stores"),accessToken:ea||"",placeholder:"Select vector stores"})}),(0,t.jsx)(c.Z.Item,{label:"Allowed Pass Through Routes",name:"allowed_passthrough_routes",children:(0,t.jsx)(Z.Z,{onChange:e=>e_.setFieldValue("allowed_passthrough_routes",e),value:e_.getFieldValue("allowed_passthrough_routes"),accessToken:ea||"",placeholder:"Select pass through routes"})}),(0,t.jsx)(c.Z.Item,{label:"MCP Servers / Access Groups",name:"mcp_servers_and_groups",children:(0,t.jsx)(w.Z,{onChange:e=>e_.setFieldValue("mcp_servers_and_groups",e),value:e_.getFieldValue("mcp_servers_and_groups"),accessToken:ea||"",placeholder:"Select MCP servers or access groups (optional)"})}),(0,t.jsx)(c.Z.Item,{name:"mcp_tool_permissions",initialValue:{},hidden:!0,children:(0,t.jsx)(x.default,{type:"hidden"})}),(0,t.jsx)(c.Z.Item,{noStyle:!0,shouldUpdate:(e,l)=>e.mcp_servers_and_groups!==l.mcp_servers_and_groups||e.mcp_tool_permissions!==l.mcp_tool_permissions,children:()=>{var e;return(0,t.jsx)("div",{className:"mb-6",children:(0,t.jsx)(k.Z,{accessToken:ea||"",selectedServers:(null===(e=e_.getFieldValue("mcp_servers_and_groups"))||void 0===e?void 0:e.servers)||[],toolPermissions:e_.getFieldValue("mcp_tool_permissions")||{},onChange:e=>e_.setFieldsValue({mcp_tool_permissions:e})})})}}),(0,t.jsx)(c.Z.Item,{label:"Agents / Access Groups",name:"agents_and_groups",children:(0,t.jsx)(M.Z,{onChange:e=>e_.setFieldValue("agents_and_groups",e),value:e_.getFieldValue("agents_and_groups"),accessToken:ea||"",placeholder:"Select agents or access groups (optional)"})}),(0,t.jsx)(c.Z.Item,{label:"Organization ID",name:"organization_id",children:(0,t.jsx)(x.default,{type:"",disabled:!0})}),(0,t.jsx)(c.Z.Item,{label:"Logging Settings",name:"logging_settings",children:(0,t.jsx)(L.Z,{value:e_.getFieldValue("logging_settings"),onChange:e=>e_.setFieldValue("logging_settings",e)})}),(0,t.jsx)(c.Z.Item,{label:"Metadata",name:"metadata",children:(0,t.jsx)(x.default.TextArea,{rows:10})}),(0,t.jsx)("div",{className:"sticky z-10 bg-white p-4 border-t border-gray-200 bottom-[-1.5rem] inset-x-[-1.5rem]",children:(0,t.jsxs)("div",{className:"flex justify-end items-center gap-2",children:[(0,t.jsx)(d.zx,{variant:"secondary",onClick:()=>eN(!1),disabled:eR,children:"Cancel"}),(0,t.jsx)(d.zx,{type:"submit",loading:eR,children:"Save Changes"})]})})]}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Team Name"}),(0,t.jsx)("div",{children:eW.team_alias})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Team ID"}),(0,t.jsx)("div",{className:"font-mono",children:eW.team_id})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Created At"}),(0,t.jsx)("div",{children:new Date(eW.created_at).toLocaleString()})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Models"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:eW.models.map((e,l)=>(0,t.jsx)(d.Ct,{color:"red",children:e},l))})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Rate Limits"}),(0,t.jsxs)("div",{children:["TPM: ",eW.tpm_limit||"Unlimited"]}),(0,t.jsxs)("div",{children:["RPM: ",eW.rpm_limit||"Unlimited"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Team Budget"}),(0,t.jsxs)("div",{children:["Max Budget:"," ",null!==eW.max_budget?"$".concat((0,r.pw)(eW.max_budget,4)):"No Limit"]}),(0,t.jsxs)("div",{children:["Budget Reset: ",eW.budget_duration||"Never"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(d.xv,{className:"font-medium",children:["Team Member Settings"," ",(0,t.jsx)(g.Z,{title:"These are limits on individual team members",children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})]}),(0,t.jsxs)("div",{children:["Max Budget: ",(null===($=eW.team_member_budget_table)||void 0===$?void 0:$.max_budget)||"No Limit"]}),(0,t.jsxs)("div",{children:["Key Duration: ",(null===(J=eW.metadata)||void 0===J?void 0:J.team_member_key_duration)||"No Limit"]}),(0,t.jsxs)("div",{children:["TPM Limit: ",(null===(Q=eW.team_member_budget_table)||void 0===Q?void 0:Q.tpm_limit)||"No Limit"]}),(0,t.jsxs)("div",{children:["RPM Limit: ",(null===(W=eW.team_member_budget_table)||void 0===W?void 0:W.rpm_limit)||"No Limit"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Organization ID"}),(0,t.jsx)("div",{children:eW.organization_id})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Status"}),(0,t.jsx)(d.Ct,{color:eW.blocked?"red":"green",children:eW.blocked?"Blocked":"Active"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(d.xv,{className:"font-medium",children:"Disable Global Guardrails"}),(0,t.jsx)("div",{children:(null===(Y=eW.metadata)||void 0===Y?void 0:Y.disable_global_guardrails)===!0?(0,t.jsx)(d.Ct,{color:"yellow",children:"Enabled - Global guardrails bypassed"}):(0,t.jsx)(d.Ct,{color:"green",children:"Disabled - Global guardrails active"})})]}),(0,t.jsx)(S.Z,{objectPermission:eW.object_permission,variant:"inline",className:"pt-4 border-t border-gray-200",accessToken:ea}),(0,t.jsx)(N.Z,{loggingConfigs:(null===(H=eW.metadata)||void 0===H?void 0:H.logging)||[],disabledCallbacks:[],variant:"inline",className:"pt-4 border-t border-gray-200"})]})]})})]})]}),(0,t.jsx)(P.Z,{visible:ev,onCancel:()=>ej(!1),onSubmit:e$,initialData:ef,mode:"edit",config:{title:"Edit Member",showEmail:!0,showUserId:!0,roleOptions:[{label:"Admin",value:"admin"},{label:"User",value:"user"}],additionalFields:[{name:"max_budget_in_team",label:(0,t.jsxs)("span",{children:["Team Member Budget (USD)"," ",(0,t.jsx)(g.Z,{title:"Maximum amount in USD this member can spend within this team. This is separate from any global user budget limits",children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})]}),type:"numerical",step:.01,min:0,placeholder:"Budget limit for this member within this team"},{name:"tpm_limit",label:(0,t.jsxs)("span",{children:["Team Member TPM Limit"," ",(0,t.jsx)(g.Z,{title:"Maximum tokens per minute this member can use within this team. This is separate from any global user TPM limit",children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})]}),type:"numerical",step:1,min:0,placeholder:"Tokens per minute limit for this member in this team"},{name:"rpm_limit",label:(0,t.jsxs)("span",{children:["Team Member RPM Limit"," ",(0,t.jsx)(g.Z,{title:"Maximum requests per minute this member can make within this team. This is separate from any global user RPM limit",children:(0,t.jsx)(m.Z,{style:{marginLeft:"4px"}})})]}),type:"numerical",step:1,min:0,placeholder:"Requests per minute limit for this member in this team"}]}}),(0,t.jsx)(i.Z,{isVisible:eg,onCancel:()=>eb(!1),onSubmit:eK,accessToken:ea}),(0,t.jsx)(f.Z,{isOpen:eE,title:"Delete Team Member",alertMessage:"Removing team members will also delete any keys created by or created for this member.",message:"Are you sure you want to remove this member from the team? This action cannot be undone.",resourceInformationTitle:"Team Member Information",resourceInformation:[{label:"User ID",value:null==eL?void 0:eL.user_id,code:!0},{label:"Email",value:null==eL?void 0:eL.user_email},{label:"Role",value:null==eL?void 0:eL.role}],onCancel:()=>{eO(!1),eF(null)},onOk:eJ,confirmLoading:eD})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2106-df512fb0bae97b5c.js b/litellm/proxy/_experimental/out/_next/static/chunks/2106-df512fb0bae97b5c.js deleted file mode 100644 index 1d1be368cc3..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/2106-df512fb0bae97b5c.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2106],{10900:function(t,e,r){var s=r(2265);let i=s.forwardRef(function(t,e){return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:e},t),s.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"}))});e.Z=i},87045:function(t,e,r){r.d(e,{j:function(){return n}});var s=r(24112),i=r(45345),n=new class extends s.l{#t;#e;#r;constructor(){super(),this.#r=t=>{if(!i.sk&&window.addEventListener){let e=()=>t();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#e||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#r=t,this.#e?.(),this.#e=t(t=>{"boolean"==typeof t?this.setFocused(t):this.onFocus()})}setFocused(t){this.#t!==t&&(this.#t=t,this.onFocus())}onFocus(){let t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){return"boolean"==typeof this.#t?this.#t:globalThis.document?.visibilityState!=="hidden"}}},18238:function(t,e,r){r.d(e,{Vr:function(){return i}});var s=r(84554).Hp,i=function(){let t=[],e=0,r=t=>{t()},i=t=>{t()},n=s,o=s=>{e?t.push(s):n(()=>{r(s)})},u=()=>{let e=t;t=[],e.length&&n(()=>{i(()=>{e.forEach(t=>{r(t)})})})};return{batch:t=>{let r;e++;try{r=t()}finally{--e||u()}return r},batchCalls:t=>(...e)=>{o(()=>{t(...e)})},schedule:o,setNotifyFunction:t=>{r=t},setBatchNotifyFunction:t=>{i=t},setScheduler:t=>{n=t}}}()},57853:function(t,e,r){r.d(e,{N:function(){return n}});var s=r(24112),i=r(45345),n=new class extends s.l{#s=!0;#e;#r;constructor(){super(),this.#r=t=>{if(!i.sk&&window.addEventListener){let e=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#e||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#r=t,this.#e?.(),this.#e=t(this.setOnline.bind(this))}setOnline(t){this.#s!==t&&(this.#s=t,this.listeners.forEach(e=>{e(t)}))}isOnline(){return this.#s}}},21733:function(t,e,r){r.d(e,{A:function(){return u},z:function(){return a}});var s=r(45345),i=r(18238),n=r(11255),o=r(7989),u=class extends o.F{#i;#n;#o;#u;#a;#c;#h;constructor(t){super(),this.#h=!1,this.#c=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#u=t.client,this.#o=this.#u.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#i=h(this.options),this.state=t.state??this.#i,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#a?.promise}setOptions(t){if(this.options={...this.#c,...t},this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){let t=h(this.options);void 0!==t.data&&(this.setState(c(t.data,t.dataUpdatedAt)),this.#i=t)}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#o.remove(this)}setData(t,e){let r=(0,s.oE)(this.state.data,t,this.options);return this.#l({data:r,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),r}setState(t,e){this.#l({type:"setState",state:t,setStateOptions:e})}cancel(t){let e=this.#a?.promise;return this.#a?.cancel(t),e?e.then(s.ZT).catch(s.ZT):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#i)}isActive(){return this.observers.some(t=>!1!==(0,s.Nc)(t.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===s.CN||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0&&this.observers.some(t=>"static"===(0,s.KC)(t.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(t=0){return void 0===this.state.data||"static"!==t&&(!!this.state.isInvalidated||!(0,s.Kp)(this.state.dataUpdatedAt,t))}onFocus(){let t=this.observers.find(t=>t.shouldFetchOnWindowFocus());t?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){let t=this.observers.find(t=>t.shouldFetchOnReconnect());t?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),this.#o.notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(this.#a&&(this.#h?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#o.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#l({type:"invalidate"})}async fetch(t,e){if("idle"!==this.state.fetchStatus&&this.#a?.status()!=="rejected"){if(void 0!==this.state.data&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(t&&this.setOptions(t),!this.options.queryFn){let t=this.observers.find(t=>t.options.queryFn);t&&this.setOptions(t.options)}let r=new AbortController,i=t=>{Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(this.#h=!0,r.signal)})},o=()=>{let t=(0,s.cG)(this.options,e),r=(()=>{let t={client:this.#u,queryKey:this.queryKey,meta:this.meta};return i(t),t})();return(this.#h=!1,this.options.persister)?this.options.persister(t,r,this):t(r)},u=(()=>{let t={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#u,state:this.state,fetchFn:o};return i(t),t})();this.options.behavior?.onFetch(u,this),this.#n=this.state,("idle"===this.state.fetchStatus||this.state.fetchMeta!==u.fetchOptions?.meta)&&this.#l({type:"fetch",meta:u.fetchOptions?.meta}),this.#a=(0,n.Mz)({initialPromise:e?.initialPromise,fn:u.fetchFn,onCancel:t=>{t instanceof n.p8&&t.revert&&this.setState({...this.#n,fetchStatus:"idle"}),r.abort()},onFail:(t,e)=>{this.#l({type:"failed",failureCount:t,error:e})},onPause:()=>{this.#l({type:"pause"})},onContinue:()=>{this.#l({type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0});try{let t=await this.#a.start();if(void 0===t)throw Error(`${this.queryHash} data is undefined`);return this.setData(t),this.#o.config.onSuccess?.(t,this),this.#o.config.onSettled?.(t,this.state.error,this),t}catch(t){if(t instanceof n.p8){if(t.silent)return this.#a.promise;if(t.revert){if(void 0===this.state.data)throw t;return this.state.data}}throw this.#l({type:"error",error:t}),this.#o.config.onError?.(t,this),this.#o.config.onSettled?.(this.state.data,t,this),t}finally{this.scheduleGc()}}#l(t){this.state=(e=>{switch(t.type){case"failed":return{...e,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...e,fetchStatus:"paused"};case"continue":return{...e,fetchStatus:"fetching"};case"fetch":return{...e,...a(e.data,this.options),fetchMeta:t.meta??null};case"success":let r={...e,...c(t.data,t.dataUpdatedAt),dataUpdateCount:e.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#n=t.manual?r:void 0,r;case"error":let s=t.error;return{...e,error:s,errorUpdateCount:e.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:e.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...e,isInvalidated:!0};case"setState":return{...e,...t.state}}})(this.state),i.Vr.batch(()=>{this.observers.forEach(t=>{t.onQueryUpdate()}),this.#o.notify({query:this,type:"updated",action:t})})}};function a(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:(0,n.Kw)(e.networkMode)?"fetching":"paused",...void 0===t&&{error:null,status:"pending"}}}function c(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function h(t){let e="function"==typeof t.initialData?t.initialData():t.initialData,r=void 0!==e,s=r?"function"==typeof t.initialDataUpdatedAt?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:r?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}},7989:function(t,e,r){r.d(e,{F:function(){return n}});var s=r(84554),i=r(45345),n=class{#d;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),(0,i.PN)(this.gcTime)&&(this.#d=s.mr.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(i.sk?1/0:3e5))}clearGcTimeout(){this.#d&&(s.mr.clearTimeout(this.#d),this.#d=void 0)}}},11255:function(t,e,r){r.d(e,{Kw:function(){return a},Mz:function(){return h},p8:function(){return c}});var s=r(87045),i=r(57853),n=r(16803),o=r(45345);function u(t){return Math.min(1e3*2**t,3e4)}function a(t){return(t??"online")!=="online"||i.N.isOnline()}var c=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function h(t){let e,r=!1,h=0,l=(0,n.O)(),d=()=>"pending"!==l.status,f=()=>s.j.isFocused()&&("always"===t.networkMode||i.N.isOnline())&&t.canRun(),p=()=>a(t.networkMode)&&t.canRun(),y=t=>{d()||(e?.(),l.resolve(t))},v=t=>{d()||(e?.(),l.reject(t))},b=()=>new Promise(r=>{e=t=>{(d()||f())&&r(t)},t.onPause?.()}).then(()=>{e=void 0,d()||t.onContinue?.()}),m=()=>{let e;if(d())return;let s=0===h?t.initialPromise:void 0;try{e=s??t.fn()}catch(t){e=Promise.reject(t)}Promise.resolve(e).then(y).catch(e=>{if(d())return;let s=t.retry??(o.sk?0:3),i=t.retryDelay??u,n="function"==typeof i?i(h,e):i,a=!0===s||"number"==typeof s&&hf()?void 0:b()).then(()=>{r?v(e):m()})})};return{promise:l,status:()=>l.status,cancel:e=>{if(!d()){let r=new c(e);v(r),t.onCancel?.(r)}},continue:()=>(e?.(),l),cancelRetry:()=>{r=!0},continueRetry:()=>{r=!1},canStart:p,start:()=>(p()?m():b().then(m),l)}}},24112:function(t,e,r){r.d(e,{l:function(){return s}});var s=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}}},16803:function(t,e,r){r.d(e,{O:function(){return s}});function s(){let t,e;let r=new Promise((r,s)=>{t=r,e=s});function s(t){Object.assign(r,t),delete r.resolve,delete r.reject}return r.status="pending",r.catch(()=>{}),r.resolve=e=>{s({status:"fulfilled",value:e}),t(e)},r.reject=t=>{s({status:"rejected",reason:t}),e(t)},r}},84554:function(t,e,r){r.d(e,{Hp:function(){return n},mr:function(){return i}});var s={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},i=new class{#f=s;#p=!1;setTimeoutProvider(t){this.#f=t}setTimeout(t,e){return this.#f.setTimeout(t,e)}clearTimeout(t){this.#f.clearTimeout(t)}setInterval(t,e){return this.#f.setInterval(t,e)}clearInterval(t){this.#f.clearInterval(t)}};function n(t){setTimeout(t,0)}},45345:function(t,e,r){r.d(e,{CN:function(){return T},Ht:function(){return w},KC:function(){return c},Kp:function(){return a},L3:function(){return Q},Nc:function(){return h},PN:function(){return u},Rm:function(){return f},SE:function(){return o},VS:function(){return b},VX:function(){return C},X7:function(){return d},Ym:function(){return p},ZT:function(){return n},_v:function(){return O},_x:function(){return l},cG:function(){return F},oE:function(){return S},sk:function(){return i},to:function(){return y}});var s=r(84554),i="undefined"==typeof window||"Deno"in globalThis;function n(){}function o(t,e){return"function"==typeof t?t(e):t}function u(t){return"number"==typeof t&&t>=0&&t!==1/0}function a(t,e){return Math.max(t+(e||0)-Date.now(),0)}function c(t,e){return"function"==typeof t?t(e):t}function h(t,e){return"function"==typeof t?t(e):t}function l(t,e){let{type:r="all",exact:s,fetchStatus:i,predicate:n,queryKey:o,stale:u}=t;if(o){if(s){if(e.queryHash!==f(o,e.options))return!1}else if(!y(e.queryKey,o))return!1}if("all"!==r){let t=e.isActive();if("active"===r&&!t||"inactive"===r&&t)return!1}return("boolean"!=typeof u||e.isStale()===u)&&(!i||i===e.state.fetchStatus)&&(!n||!!n(e))}function d(t,e){let{exact:r,status:s,predicate:i,mutationKey:n}=t;if(n){if(!e.options.mutationKey)return!1;if(r){if(p(e.options.mutationKey)!==p(n))return!1}else if(!y(e.options.mutationKey,n))return!1}return(!s||e.state.status===s)&&(!i||!!i(e))}function f(t,e){return(e?.queryKeyHashFn||p)(t)}function p(t){return JSON.stringify(t,(t,e)=>g(e)?Object.keys(e).sort().reduce((t,r)=>(t[r]=e[r],t),{}):e)}function y(t,e){return t===e||typeof t==typeof e&&!!t&&!!e&&"object"==typeof t&&"object"==typeof e&&Object.keys(e).every(r=>y(t[r],e[r]))}var v=Object.prototype.hasOwnProperty;function b(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(let r in t)if(t[r]!==e[r])return!1;return!0}function m(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function g(t){if(!R(t))return!1;let e=t.constructor;if(void 0===e)return!0;let r=e.prototype;return!!(R(r)&&r.hasOwnProperty("isPrototypeOf"))&&Object.getPrototypeOf(t)===Object.prototype}function R(t){return"[object Object]"===Object.prototype.toString.call(t)}function O(t){return new Promise(e=>{s.mr.setTimeout(e,t)})}function S(t,e,r){return"function"==typeof r.structuralSharing?r.structuralSharing(t,e):!1!==r.structuralSharing?function t(e,r){if(e===r)return e;let s=m(e)&&m(r);if(!s&&!(g(e)&&g(r)))return r;let i=(s?e:Object.keys(e)).length,n=s?r:Object.keys(r),o=n.length,u=s?Array(o):{},a=0;for(let c=0;cr?s.slice(1):s}function w(t,e,r=0){let s=[e,...t];return r&&s.length>r?s.slice(0,-1):s}var T=Symbol();function F(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:t.queryFn&&t.queryFn!==T?t.queryFn:()=>Promise.reject(Error(`Missing queryFn: '${t.queryHash}'`))}function Q(t,e){return"function"==typeof t?t(...e):!!t}},11713:function(t,e,r){let s;r.d(e,{a:function(){return E}});var i=r(87045),n=r(18238),o=r(21733),u=r(24112),a=r(16803),c=r(45345),h=r(84554),l=class extends u.l{constructor(t,e){super(),this.options=e,this.#u=t,this.#y=null,this.#v=(0,a.O)(),this.bindMethods(),this.setOptions(e)}#u;#b=void 0;#m=void 0;#g=void 0;#R;#O;#v;#y;#S;#C;#w;#T;#F;#Q;#I=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#b.addObserver(this),d(this.#b,this.options)?this.#E():this.updateResult(),this.#k())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return f(this.#b,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return f(this.#b,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#U(),this.#P(),this.#b.removeObserver(this)}setOptions(t){let e=this.options,r=this.#b;if(this.options=this.#u.defaultQueryOptions(t),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof(0,c.Nc)(this.options.enabled,this.#b))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#j(),this.#b.setOptions(this.options),e._defaulted&&!(0,c.VS)(this.options,e)&&this.#u.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#b,observer:this});let s=this.hasListeners();s&&p(this.#b,r,this.options,e)&&this.#E(),this.updateResult(),s&&(this.#b!==r||(0,c.Nc)(this.options.enabled,this.#b)!==(0,c.Nc)(e.enabled,this.#b)||(0,c.KC)(this.options.staleTime,this.#b)!==(0,c.KC)(e.staleTime,this.#b))&&this.#q();let i=this.#D();s&&(this.#b!==r||(0,c.Nc)(this.options.enabled,this.#b)!==(0,c.Nc)(e.enabled,this.#b)||i!==this.#Q)&&this.#x(i)}getOptimisticResult(t){let e=this.#u.getQueryCache().build(this.#u,t),r=this.createResult(e,t);return(0,c.VS)(this.getCurrentResult(),r)||(this.#g=r,this.#O=this.options,this.#R=this.#b.state),r}getCurrentResult(){return this.#g}trackResult(t,e){return new Proxy(t,{get:(t,r)=>(this.trackProp(r),e?.(r),"promise"!==r||(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#v.status||this.#v.reject(Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(t,r))})}trackProp(t){this.#I.add(t)}getCurrentQuery(){return this.#b}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let e=this.#u.defaultQueryOptions(t),r=this.#u.getQueryCache().build(this.#u,e);return r.fetch().then(()=>this.createResult(r,e))}fetch(t){return this.#E({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#g))}#E(t){this.#j();let e=this.#b.fetch(this.options,t);return t?.throwOnError||(e=e.catch(c.ZT)),e}#q(){this.#U();let t=(0,c.KC)(this.options.staleTime,this.#b);if(c.sk||this.#g.isStale||!(0,c.PN)(t))return;let e=(0,c.Kp)(this.#g.dataUpdatedAt,t);this.#T=h.mr.setTimeout(()=>{this.#g.isStale||this.updateResult()},e+1)}#D(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#b):this.options.refetchInterval)??!1}#x(t){this.#P(),this.#Q=t,!c.sk&&!1!==(0,c.Nc)(this.options.enabled,this.#b)&&(0,c.PN)(this.#Q)&&0!==this.#Q&&(this.#F=h.mr.setInterval(()=>{(this.options.refetchIntervalInBackground||i.j.isFocused())&&this.#E()},this.#Q))}#k(){this.#q(),this.#x(this.#D())}#U(){this.#T&&(h.mr.clearTimeout(this.#T),this.#T=void 0)}#P(){this.#F&&(h.mr.clearInterval(this.#F),this.#F=void 0)}createResult(t,e){let r;let s=this.#b,i=this.options,n=this.#g,u=this.#R,h=this.#O,l=t!==s?t.state:this.#m,{state:f}=t,v={...f},b=!1;if(e._optimisticResults){let r=this.hasListeners(),n=!r&&d(t,e),u=r&&p(t,s,e,i);(n||u)&&(v={...v,...(0,o.z)(f.data,t.options)}),"isRestoring"===e._optimisticResults&&(v.fetchStatus="idle")}let{error:m,errorUpdatedAt:g,status:R}=v;r=v.data;let O=!1;if(void 0!==e.placeholderData&&void 0===r&&"pending"===R){let t;n?.isPlaceholderData&&e.placeholderData===h?.placeholderData?(t=n.data,O=!0):t="function"==typeof e.placeholderData?e.placeholderData(this.#w?.state.data,this.#w):e.placeholderData,void 0!==t&&(R="success",r=(0,c.oE)(n?.data,t,e),b=!0)}if(e.select&&void 0!==r&&!O){if(n&&r===u?.data&&e.select===this.#S)r=this.#C;else try{this.#S=e.select,r=e.select(r),r=(0,c.oE)(n?.data,r,e),this.#C=r,this.#y=null}catch(t){this.#y=t}}this.#y&&(m=this.#y,r=this.#C,g=Date.now(),R="error");let S="fetching"===v.fetchStatus,C="pending"===R,w="error"===R,T=C&&S,F=void 0!==r,Q={status:R,fetchStatus:v.fetchStatus,isPending:C,isSuccess:"success"===R,isError:w,isInitialLoading:T,isLoading:T,data:r,dataUpdatedAt:v.dataUpdatedAt,error:m,errorUpdatedAt:g,failureCount:v.fetchFailureCount,failureReason:v.fetchFailureReason,errorUpdateCount:v.errorUpdateCount,isFetched:v.dataUpdateCount>0||v.errorUpdateCount>0,isFetchedAfterMount:v.dataUpdateCount>l.dataUpdateCount||v.errorUpdateCount>l.errorUpdateCount,isFetching:S,isRefetching:S&&!C,isLoadingError:w&&!F,isPaused:"paused"===v.fetchStatus,isPlaceholderData:b,isRefetchError:w&&F,isStale:y(t,e),refetch:this.refetch,promise:this.#v,isEnabled:!1!==(0,c.Nc)(e.enabled,t)};if(this.options.experimental_prefetchInRender){let e=t=>{"error"===Q.status?t.reject(Q.error):void 0!==Q.data&&t.resolve(Q.data)},r=()=>{e(this.#v=Q.promise=(0,a.O)())},i=this.#v;switch(i.status){case"pending":t.queryHash===s.queryHash&&e(i);break;case"fulfilled":("error"===Q.status||Q.data!==i.value)&&r();break;case"rejected":("error"!==Q.status||Q.error!==i.reason)&&r()}}return Q}updateResult(){let t=this.#g,e=this.createResult(this.#b,this.options);this.#R=this.#b.state,this.#O=this.options,void 0!==this.#R.data&&(this.#w=this.#b),(0,c.VS)(e,t)||(this.#g=e,this.#L({listeners:(()=>{if(!t)return!0;let{notifyOnChangeProps:e}=this.options,r="function"==typeof e?e():e;if("all"===r||!r&&!this.#I.size)return!0;let s=new Set(r??this.#I);return this.options.throwOnError&&s.add("error"),Object.keys(this.#g).some(e=>this.#g[e]!==t[e]&&s.has(e))})()}))}#j(){let t=this.#u.getQueryCache().build(this.#u,this.options);if(t===this.#b)return;let e=this.#b;this.#b=t,this.#m=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#k()}#L(t){n.Vr.batch(()=>{t.listeners&&this.listeners.forEach(t=>{t(this.#g)}),this.#u.getQueryCache().notify({query:this.#b,type:"observerResultsUpdated"})})}};function d(t,e){return!1!==(0,c.Nc)(e.enabled,t)&&void 0===t.state.data&&!("error"===t.state.status&&!1===e.retryOnMount)||void 0!==t.state.data&&f(t,e,e.refetchOnMount)}function f(t,e,r){if(!1!==(0,c.Nc)(e.enabled,t)&&"static"!==(0,c.KC)(e.staleTime,t)){let s="function"==typeof r?r(t):r;return"always"===s||!1!==s&&y(t,e)}return!1}function p(t,e,r,s){return(t!==e||!1===(0,c.Nc)(s.enabled,t))&&(!r.suspense||"error"!==t.state.status)&&y(t,r)}function y(t,e){return!1!==(0,c.Nc)(e.enabled,t)&&t.isStaleByTime((0,c.KC)(e.staleTime,t))}var v=r(2265),b=r(29827);r(57437);var m=v.createContext((s=!1,{clearReset:()=>{s=!1},reset:()=>{s=!0},isReset:()=>s})),g=()=>v.useContext(m),R=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&!e.isReset()&&(t.retryOnMount=!1)},O=t=>{v.useEffect(()=>{t.clearReset()},[t])},S=t=>{let{result:e,errorResetBoundary:r,throwOnError:s,query:i,suspense:n}=t;return e.isError&&!r.isReset()&&!e.isFetching&&i&&(n&&void 0===e.data||(0,c.L3)(s,[e.error,i]))},C=v.createContext(!1),w=()=>v.useContext(C);C.Provider;var T=t=>{if(t.suspense){let e=t=>"static"===t?t:Math.max(t??1e3,1e3),r=t.staleTime;t.staleTime="function"==typeof r?(...t)=>e(r(...t)):e(r),"number"==typeof t.gcTime&&(t.gcTime=Math.max(t.gcTime,1e3))}},F=(t,e)=>t.isLoading&&t.isFetching&&!e,Q=(t,e)=>t?.suspense&&e.isPending,I=(t,e,r)=>e.fetchOptimistic(t).catch(()=>{r.clearReset()});function E(t,e){return function(t,e,r){var s,i,o,u,a;let h=w(),l=g(),d=(0,b.NL)(r),f=d.defaultQueryOptions(t);null===(i=d.getDefaultOptions().queries)||void 0===i||null===(s=i._experimental_beforeQuery)||void 0===s||s.call(i,f),f._optimisticResults=h?"isRestoring":"optimistic",T(f),R(f,l),O(l);let p=!d.getQueryCache().get(f.queryHash),[y]=v.useState(()=>new e(d,f)),m=y.getOptimisticResult(f),C=!h&&!1!==t.subscribed;if(v.useSyncExternalStore(v.useCallback(t=>{let e=C?y.subscribe(n.Vr.batchCalls(t)):c.ZT;return y.updateResult(),e},[y,C]),()=>y.getCurrentResult(),()=>y.getCurrentResult()),v.useEffect(()=>{y.setOptions(f)},[f,y]),Q(f,m))throw I(f,y,l);if(S({result:m,errorResetBoundary:l,throwOnError:f.throwOnError,query:d.getQueryCache().get(f.queryHash),suspense:f.suspense}))throw m.error;if(null===(u=d.getDefaultOptions().queries)||void 0===u||null===(o=u._experimental_afterQuery)||void 0===o||o.call(u,f,m),f.experimental_prefetchInRender&&!c.sk&&F(m,h)){let t=p?I(f,y,l):null===(a=d.getQueryCache().get(f.queryHash))||void 0===a?void 0:a.promise;null==t||t.catch(c.ZT).finally(()=>{y.updateResult()})}return f.notifyOnChangeProps?m:y.trackResult(m)}(t,l,e)}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2202-75f4ebfcb55c7701.js b/litellm/proxy/_experimental/out/_next/static/chunks/2202-75f4ebfcb55c7701.js deleted file mode 100644 index dcfa3582f8b..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/2202-75f4ebfcb55c7701.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2202],{19431:function(e,s,t){t.d(s,{x:function(){return a.Z},z:function(){return l.Z}});var l=t(78489),a=t(84264)},65925:function(e,s,t){t.d(s,{m:function(){return i}});var l=t(57437);t(2265);var a=t(37592);let{Option:r}=a.default,i=e=>e?({"24h":"daily","7d":"weekly","30d":"monthly"})[e]||e:"Not set";s.Z=e=>{let{value:s,onChange:t,className:i="",style:n={}}=e;return(0,l.jsxs)(a.default,{style:{width:"100%",...n},value:s||void 0,onChange:t,className:i,placeholder:"n/a",children:[(0,l.jsx)(r,{value:"24h",children:"daily"}),(0,l.jsx)(r,{value:"7d",children:"weekly"}),(0,l.jsx)(r,{value:"30d",children:"monthly"})]})}},84376:function(e,s,t){var l=t(57437);t(2265);var a=t(37592);s.Z=e=>{let{teams:s,value:t,onChange:r,disabled:i}=e;return console.log("disabled",i),(0,l.jsx)(a.default,{showSearch:!0,placeholder:"Search or select a team",value:t,onChange:r,disabled:i,filterOption:(e,t)=>{if(!t)return!1;let l=null==s?void 0:s.find(e=>e.team_id===t.key);if(!l)return!1;let a=e.toLowerCase().trim(),r=(l.team_alias||"").toLowerCase(),i=(l.team_id||"").toLowerCase();return r.includes(a)||i.includes(a)},optionFilterProp:"children",children:null==s?void 0:s.map(e=>(0,l.jsxs)(a.default.Option,{value:e.team_id,children:[(0,l.jsx)("span",{className:"font-medium",children:e.team_alias})," ",(0,l.jsxs)("span",{className:"text-gray-500",children:["(",e.team_id,")"]})]},e.team_id))})}},7765:function(e,s,t){t.d(s,{Z:function(){return J}});var l=t(57437),a=t(2265),r=t(37592),i=t(10032),n=t(4260),d=t(5545),o=t(22116),c=t(87452),m=t(88829),u=t(72208),x=t(78489),h=t(57365),f=t(84264),p=t(49566),j=t(96761),g=t(98187),v=t(19250),b=t(19431),y=t(57840),N=t(65319),w=t(56609),_=t(73879),C=t(34310),k=t(38434),S=t(26349),Z=t(35291),U=t(3632),I=t(15452),V=t.n(I),L=t(71157),P=t(44643),R=t(88532),E=t(29233),O=t(9114),T=e=>{let{accessToken:s,teams:t,possibleUIRoles:r,onUsersCreated:i}=e,[n,d]=(0,a.useState)(!1),[c,m]=(0,a.useState)([]),[u,x]=(0,a.useState)(!1),[h,f]=(0,a.useState)(null),[p,j]=(0,a.useState)(null),[g,I]=(0,a.useState)(null),[T,z]=(0,a.useState)(null),[F,B]=(0,a.useState)(null),[D,M]=(0,a.useState)("http://localhost:4000");(0,a.useEffect)(()=>{(async()=>{try{let e=await (0,v.getProxyUISettings)(s);B(e)}catch(e){console.error("Error fetching UI settings:",e)}})(),M(new URL("/",window.location.href).toString())},[s]);let A=async()=>{x(!0);let e=c.map(e=>({...e,status:"pending"}));m(e);let t=!1;for(let i=0;ie.trim()).filter(Boolean),0===e.teams.length&&delete e.teams),n.models&&"string"==typeof n.models&&""!==n.models.trim()&&(e.models=n.models.split(",").map(e=>e.trim()).filter(Boolean),0===e.models.length&&delete e.models),n.max_budget&&""!==n.max_budget.toString().trim()){let s=parseFloat(n.max_budget.toString());!isNaN(s)&&s>0&&(e.max_budget=s)}n.budget_duration&&""!==n.budget_duration.trim()&&(e.budget_duration=n.budget_duration.trim()),n.metadata&&"string"==typeof n.metadata&&""!==n.metadata.trim()&&(e.metadata=n.metadata.trim()),console.log("Sending user data:",e);let a=await (0,v.userCreateCall)(s,null,e);if(console.log("Full response:",a),a&&(a.key||a.user_id)){t=!0,console.log("Success case triggered");let e=(null===(l=a.data)||void 0===l?void 0:l.user_id)||a.user_id;try{if(null==F?void 0:F.SSO_ENABLED){let e=new URL("/ui",D).toString();m(s=>s.map((s,t)=>t===i?{...s,status:"success",key:a.key||a.user_id,invitation_link:e}:s))}else{let t=await (0,v.invitationCreateCall)(s,e),l=new URL("/ui?invitation_id=".concat(t.id),D).toString();m(e=>e.map((e,s)=>s===i?{...e,status:"success",key:a.key||a.user_id,invitation_link:l}:e))}}catch(e){console.error("Error creating invitation:",e),m(e=>e.map((e,s)=>s===i?{...e,status:"success",key:a.key||a.user_id,error:"User created but failed to generate invitation link"}:e))}}else{console.log("Error case triggered");let e=(null==a?void 0:a.error)||"Failed to create user";console.log("Error message:",e),m(s=>s.map((s,t)=>t===i?{...s,status:"failed",error:e}:s))}}catch(s){console.error("Caught error:",s);let e=(null==s?void 0:null===(r=s.response)||void 0===r?void 0:null===(a=r.data)||void 0===a?void 0:a.error)||(null==s?void 0:s.message)||String(s);m(s=>s.map((s,t)=>t===i?{...s,status:"failed",error:e}:s))}}x(!1),t&&i&&i()};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(b.z,{className:"mb-0",onClick:()=>d(!0),children:"+ Bulk Invite Users"}),(0,l.jsx)(o.Z,{title:"Bulk Invite Users",visible:n,width:800,onCancel:()=>d(!1),bodyStyle:{maxHeight:"70vh",overflow:"auto"},footer:null,children:(0,l.jsx)("div",{className:"flex flex-col",children:0===c.length?(0,l.jsxs)("div",{className:"mb-6",children:[(0,l.jsxs)("div",{className:"flex items-center mb-4",children:[(0,l.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-500 text-white flex items-center justify-center mr-3",children:"1"}),(0,l.jsx)("h3",{className:"text-lg font-medium",children:"Download and fill the template"})]}),(0,l.jsxs)("div",{className:"ml-11 mb-6",children:[(0,l.jsx)("p",{className:"mb-4",children:"Add multiple users at once by following these steps:"}),(0,l.jsxs)("ol",{className:"list-decimal list-inside space-y-2 ml-2 mb-4",children:[(0,l.jsx)("li",{children:"Download our CSV template"}),(0,l.jsx)("li",{children:"Add your users' information to the spreadsheet"}),(0,l.jsx)("li",{children:"Save the file and upload it here"}),(0,l.jsx)("li",{children:"After creation, download the results file containing the API keys for each user"})]}),(0,l.jsxs)("div",{className:"bg-gray-50 p-4 rounded-md border border-gray-200 mb-4",children:[(0,l.jsx)("h4",{className:"font-medium mb-2",children:"Template Column Names"}),(0,l.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-red-500 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"user_email"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:"User's email address (required)"})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-red-500 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"user_role"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'User\'s role (one of: "proxy_admin", "proxy_admin_viewer", "internal_user", "internal_user_viewer")'})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"teams"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'Comma-separated team IDs (e.g., "team-1,team-2")'})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"max_budget"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'Maximum budget as a number (e.g., "100")'})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"budget_duration"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'Budget reset period (e.g., "30d", "1mo")'})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"models"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'Comma-separated allowed models (e.g., "gpt-3.5-turbo,gpt-4")'})]})]})]})]}),(0,l.jsxs)(b.z,{onClick:()=>{let e=new Blob([V().unparse([["user_email","user_role","teams","max_budget","budget_duration","models"],["user@example.com","internal_user","team-id-1,team-id-2","100","30d","gpt-3.5-turbo,gpt-4"]])],{type:"text/csv"}),s=window.URL.createObjectURL(e),t=document.createElement("a");t.href=s,t.download="bulk_users_template.csv",document.body.appendChild(t),t.click(),document.body.removeChild(t),window.URL.revokeObjectURL(s)},size:"lg",className:"w-full md:w-auto",children:[(0,l.jsx)(_.Z,{className:"mr-2"})," Download CSV Template"]})]}),(0,l.jsxs)("div",{className:"flex items-center mb-4",children:[(0,l.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-500 text-white flex items-center justify-center mr-3",children:"2"}),(0,l.jsx)("h3",{className:"text-lg font-medium",children:"Upload your completed CSV"})]}),(0,l.jsxs)("div",{className:"ml-11",children:[T?(0,l.jsxs)("div",{className:"mb-4 p-4 rounded-md border ".concat(g?"bg-red-50 border-red-200":"bg-blue-50 border-blue-200"),children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex items-center",children:[g?(0,l.jsx)(C.Z,{className:"text-red-500 text-xl mr-3"}):(0,l.jsx)(k.Z,{className:"text-blue-500 text-xl mr-3"}),(0,l.jsxs)("div",{children:[(0,l.jsx)(y.default.Text,{strong:!0,className:g?"text-red-800":"text-blue-800",children:T.name}),(0,l.jsxs)(y.default.Text,{className:"block text-xs ".concat(g?"text-red-600":"text-blue-600"),children:[(T.size/1024).toFixed(1)," KB • ",new Date().toLocaleDateString()]})]})]}),(0,l.jsxs)(b.z,{size:"xs",variant:"secondary",onClick:()=>{z(null),m([]),f(null),j(null),I(null)},className:"flex items-center",children:[(0,l.jsx)(S.Z,{className:"mr-1"})," Remove"]})]}),g?(0,l.jsxs)("div",{className:"mt-3 text-red-600 text-sm flex items-start",children:[(0,l.jsx)(Z.Z,{className:"mr-2 mt-0.5"}),(0,l.jsx)("span",{children:g})]}):!p&&(0,l.jsxs)("div",{className:"mt-3 flex items-center",children:[(0,l.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-1.5",children:(0,l.jsx)("div",{className:"bg-blue-500 h-1.5 rounded-full w-full animate-pulse"})}),(0,l.jsx)("span",{className:"ml-2 text-xs text-blue-600",children:"Processing..."})]})]}):(0,l.jsx)(N.default,{beforeUpload:e=>((f(null),j(null),I(null),z(e),"text/csv"===e.type||e.name.endsWith(".csv"))?e.size>5242880?I("File is too large (".concat((e.size/1048576).toFixed(1)," MB). Please upload a CSV file smaller than 5MB.")):V().parse(e,{complete:e=>{if(!e.data||0===e.data.length){j("The CSV file appears to be empty. Please upload a file with data."),m([]);return}if(1===e.data.length){j("The CSV file only contains headers but no user data. Please add user data to your CSV."),m([]);return}let s=e.data[0];if(0===s.length||1===s.length&&""===s[0]){j("The CSV file doesn't contain any column headers. Please make sure your CSV has headers."),m([]);return}let l=["user_email","user_role"].filter(e=>!s.includes(e));if(l.length>0){j("Your CSV is missing these required columns: ".concat(l.join(", "),". Please add these columns to your CSV file.")),m([]);return}try{let l=e.data.slice(1).map((e,l)=>{var a,r,i,n,d,o;if(0===e.length||1===e.length&&""===e[0])return null;if(e.length=parseFloat(c.max_budget.toString())&&m.push("Max budget must be greater than 0")),c.budget_duration&&!c.budget_duration.match(/^\d+[dhmwy]$|^\d+mo$/)&&m.push('Invalid budget duration format "'.concat(c.budget_duration,'". Use format like "30d", "1mo", "2w", "6h"')),c.teams&&"string"==typeof c.teams&&t&&t.length>0){let e=t.map(e=>e.team_id),s=c.teams.split(",").map(e=>e.trim()).filter(s=>!e.includes(s));s.length>0&&m.push("Unknown team(s): ".concat(s.join(", ")))}return m.length>0&&(c.isValid=!1,c.error=m.join(", ")),c}).filter(Boolean),a=l.filter(e=>e.isValid);m(l),0===l.length?j("No valid data rows found in the CSV file. Please check your file format."):0===a.length?f("No valid users found in the CSV. Please check the errors below and fix your CSV file."):a.length{f("Failed to parse CSV file: ".concat(e.message)),m([])},header:!1}):(I("Invalid file type: ".concat(e.name,". Please upload a CSV file (.csv extension).")),O.Z.fromBackend("Invalid file type. Please upload a CSV file.")),!1),accept:".csv",maxCount:1,showUploadList:!1,children:(0,l.jsxs)("div",{className:"border-2 border-dashed border-gray-300 rounded-lg p-8 text-center hover:border-blue-500 transition-colors cursor-pointer",children:[(0,l.jsx)(U.Z,{className:"text-3xl text-gray-400 mb-2"}),(0,l.jsx)("p",{className:"mb-1",children:"Drag and drop your CSV file here"}),(0,l.jsx)("p",{className:"text-sm text-gray-500 mb-3",children:"or"}),(0,l.jsx)(b.z,{size:"sm",children:"Browse files"}),(0,l.jsx)("p",{className:"text-xs text-gray-500 mt-4",children:"Only CSV files (.csv) are supported"})]})}),p&&(0,l.jsx)("div",{className:"mb-4 p-4 bg-yellow-50 border border-yellow-200 rounded-md",children:(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)(R.Z,{className:"h-5 w-5 text-yellow-500 mr-2 mt-0.5"}),(0,l.jsxs)("div",{children:[(0,l.jsx)(y.default.Text,{strong:!0,className:"text-yellow-800",children:"CSV Structure Error"}),(0,l.jsx)(y.default.Paragraph,{className:"text-yellow-700 mt-1 mb-0",children:p}),(0,l.jsx)(y.default.Paragraph,{className:"text-yellow-700 mt-2 mb-0",children:"Please download our template and ensure your CSV follows the required format."})]})]})})]})]}):(0,l.jsxs)("div",{className:"mb-6",children:[(0,l.jsxs)("div",{className:"flex items-center mb-4",children:[(0,l.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-500 text-white flex items-center justify-center mr-3",children:"3"}),(0,l.jsx)("h3",{className:"text-lg font-medium",children:c.some(e=>"success"===e.status||"failed"===e.status)?"User Creation Results":"Review and create users"})]}),h&&(0,l.jsx)("div",{className:"ml-11 mb-4 p-4 bg-red-50 border border-red-200 rounded-md",children:(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)(Z.Z,{className:"text-red-500 mr-2 mt-1"}),(0,l.jsxs)("div",{children:[(0,l.jsx)(b.x,{className:"text-red-600 font-medium",children:h}),c.some(e=>!e.isValid)&&(0,l.jsxs)("ul",{className:"mt-2 list-disc list-inside text-red-600 text-sm",children:[(0,l.jsx)("li",{children:"Check the table below for specific errors in each row"}),(0,l.jsx)("li",{children:"Common issues include invalid email formats, missing required fields, or incorrect role values"}),(0,l.jsx)("li",{children:"Fix these issues in your CSV file and upload again"})]})]})]})}),(0,l.jsxs)("div",{className:"ml-11",children:[(0,l.jsxs)("div",{className:"flex justify-between items-center mb-3",children:[(0,l.jsx)("div",{className:"flex items-center",children:c.some(e=>"success"===e.status||"failed"===e.status)?(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(b.x,{className:"text-lg font-medium mr-3",children:"Creation Summary"}),(0,l.jsxs)(b.x,{className:"text-sm bg-green-100 text-green-800 px-2 py-1 rounded mr-2",children:[c.filter(e=>"success"===e.status).length," Successful"]}),c.some(e=>"failed"===e.status)&&(0,l.jsxs)(b.x,{className:"text-sm bg-red-100 text-red-800 px-2 py-1 rounded",children:[c.filter(e=>"failed"===e.status).length," Failed"]})]}):(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(b.x,{className:"text-lg font-medium mr-3",children:"User Preview"}),(0,l.jsxs)(b.x,{className:"text-sm bg-blue-100 text-blue-800 px-2 py-1 rounded",children:[c.filter(e=>e.isValid).length," of ",c.length," users valid"]})]})}),!c.some(e=>"success"===e.status||"failed"===e.status)&&(0,l.jsxs)("div",{className:"flex space-x-3",children:[(0,l.jsx)(b.z,{onClick:()=>{m([]),f(null)},variant:"secondary",children:"Back"}),(0,l.jsx)(b.z,{onClick:A,disabled:0===c.filter(e=>e.isValid).length||u,children:u?"Creating...":"Create ".concat(c.filter(e=>e.isValid).length," Users")})]})]}),c.some(e=>"success"===e.status)&&(0,l.jsx)("div",{className:"mb-4 p-4 bg-blue-50 border border-blue-200 rounded-md",children:(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"mr-3 mt-1",children:(0,l.jsx)(P.Z,{className:"h-5 w-5 text-blue-500"})}),(0,l.jsxs)("div",{children:[(0,l.jsx)(b.x,{className:"font-medium text-blue-800",children:"User creation complete"}),(0,l.jsxs)(b.x,{className:"block text-sm text-blue-700 mt-1",children:[(0,l.jsx)("span",{className:"font-medium",children:"Next step:"})," Download the credentials file containing API keys and invitation links. Users will need these API keys to make LLM requests through LiteLLM."]})]})]})}),(0,l.jsx)(w.Z,{dataSource:c,columns:[{title:"Row",dataIndex:"rowNumber",key:"rowNumber",width:80},{title:"Email",dataIndex:"user_email",key:"user_email"},{title:"Role",dataIndex:"user_role",key:"user_role"},{title:"Teams",dataIndex:"teams",key:"teams"},{title:"Budget",dataIndex:"max_budget",key:"max_budget"},{title:"Status",key:"status",render:(e,s)=>s.isValid?s.status&&"pending"!==s.status?"success"===s.status?(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(P.Z,{className:"h-5 w-5 text-green-500 mr-2"}),(0,l.jsx)("span",{className:"text-green-500",children:"Success"})]}),s.invitation_link&&(0,l.jsx)("div",{className:"mt-1",children:(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)("span",{className:"text-xs text-gray-500 truncate max-w-[150px]",children:s.invitation_link}),(0,l.jsx)(E.CopyToClipboard,{text:s.invitation_link,onCopy:()=>O.Z.success("Invitation link copied!"),children:(0,l.jsx)("button",{className:"ml-1 text-blue-500 text-xs hover:text-blue-700",children:"Copy"})})]})})]}):(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(L.Z,{className:"h-5 w-5 text-red-500 mr-2"}),(0,l.jsx)("span",{className:"text-red-500",children:"Failed"})]}),s.error&&(0,l.jsx)("span",{className:"text-sm text-red-500 ml-7",children:JSON.stringify(s.error)})]}):(0,l.jsx)("span",{className:"text-gray-500",children:"Pending"}):(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(L.Z,{className:"h-5 w-5 text-red-500 mr-2"}),(0,l.jsx)("span",{className:"text-red-500",children:"Invalid"})]}),s.error&&(0,l.jsx)("span",{className:"text-sm text-red-500 ml-7",children:s.error})]})}],size:"small",pagination:{pageSize:5},scroll:{y:300},rowClassName:e=>e.isValid?"":"bg-red-50"}),!c.some(e=>"success"===e.status||"failed"===e.status)&&(0,l.jsxs)("div",{className:"flex justify-end mt-4",children:[(0,l.jsx)(b.z,{onClick:()=>{m([]),f(null)},variant:"secondary",className:"mr-3",children:"Back"}),(0,l.jsx)(b.z,{onClick:A,disabled:0===c.filter(e=>e.isValid).length||u,children:u?"Creating...":"Create ".concat(c.filter(e=>e.isValid).length," Users")})]}),c.some(e=>"success"===e.status||"failed"===e.status)&&(0,l.jsxs)("div",{className:"flex justify-end mt-4",children:[(0,l.jsx)(b.z,{onClick:()=>{m([]),f(null)},variant:"secondary",className:"mr-3",children:"Start New Bulk Import"}),(0,l.jsxs)(b.z,{onClick:()=>{let e=c.map(e=>({user_email:e.user_email,user_role:e.user_role,status:e.status,key:e.key||"",invitation_link:e.invitation_link||"",error:e.error||""})),s=new Blob([V().unparse(e)],{type:"text/csv"}),t=window.URL.createObjectURL(s),l=document.createElement("a");l.href=t,l.download="bulk_users_results.csv",document.body.appendChild(l),l.click(),document.body.removeChild(l),window.URL.revokeObjectURL(t)},variant:"primary",className:"flex items-center",children:[(0,l.jsx)(_.Z,{className:"mr-2"})," Download User Credentials"]})]})]})]})})})]})},z=t(99981),F=t(15424),B=t(46468),D=t(29827),M=t(84376);let{Option:A}=r.default,q=()=>"undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let s=16*Math.random()|0;return("x"==e?s:3&s|8).toString(16)});var J=e=>{let{userID:s,accessToken:t,teams:b,possibleUIRoles:y,onUserCreated:N,isEmbedded:w=!1}=e,_=(0,D.NL)(),[C,k]=(0,a.useState)(null),[S]=i.Z.useForm(),[Z,U]=(0,a.useState)(!1),[I,V]=(0,a.useState)(!1),[L,P]=(0,a.useState)([]),[R,E]=(0,a.useState)(!1),[A,J]=(0,a.useState)(null),[K,W]=(0,a.useState)(null);(0,a.useEffect)(()=>{let e=async()=>{try{let e=await (0,v.modelAvailableCall)(t,s,"any"),l=[];for(let s=0;s{var l,a,r;try{O.Z.info("Making API Call"),w||U(!0),e.models&&0!==e.models.length||"proxy_admin"===e.user_role||(console.log("formValues.user_role",e.user_role),e.models=["no-default-models"]),console.log("formValues in create user:",e);let a=await (0,v.userCreateCall)(t,null,e);await _.invalidateQueries({queryKey:["userList"]}),console.log("user create Response:",a),V(!0);let r=(null===(l=a.data)||void 0===l?void 0:l.user_id)||a.user_id;if(N&&w){N(r),S.resetFields();return}if(null==C?void 0:C.SSO_ENABLED){let e={id:q(),user_id:r,is_accepted:!1,accepted_at:null,expires_at:new Date(Date.now()+6048e5),created_at:new Date,created_by:s,updated_at:new Date,updated_by:s,has_user_setup_sso:!0};J(e),E(!0)}else(0,v.invitationCreateCall)(t,r).then(e=>{e.has_user_setup_sso=!1,J(e),E(!0)});O.Z.success("API user Created"),S.resetFields(),localStorage.removeItem("userData"+s)}catch(s){let e=(null===(r=s.response)||void 0===r?void 0:null===(a=r.data)||void 0===a?void 0:a.detail)||(null==s?void 0:s.message)||"Error creating the user";O.Z.fromBackend(e),console.error("Error creating the user:",s)}};return w?(0,l.jsxs)(i.Z,{form:S,onFinish:$,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,l.jsx)(i.Z.Item,{label:"User Email",name:"user_email",children:(0,l.jsx)(p.Z,{placeholder:""})}),(0,l.jsx)(i.Z.Item,{label:"User Role",name:"user_role",children:(0,l.jsx)(r.default,{children:y&&Object.entries(y).map(e=>{let[s,{ui_label:t,description:a}]=e;return(0,l.jsx)(h.Z,{value:s,title:t,children:(0,l.jsxs)("div",{className:"flex",children:[t," ",(0,l.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:a})]})},s)})})}),(0,l.jsx)(i.Z.Item,{label:"Team",name:"team_id",children:(0,l.jsx)(r.default,{placeholder:"Select Team",style:{width:"100%"},children:(0,l.jsx)(M.Z,{teams:b})})}),(0,l.jsx)(i.Z.Item,{label:"Metadata",name:"metadata",children:(0,l.jsx)(n.default.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,l.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,l.jsx)(d.ZP,{htmlType:"submit",children:"Create User"})})]}):(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)(x.Z,{className:"mb-0",onClick:()=>U(!0),children:"+ Invite User"}),(0,l.jsx)(T,{accessToken:t,teams:b,possibleUIRoles:y}),(0,l.jsxs)(o.Z,{title:"Invite User",visible:Z,width:800,footer:null,onOk:()=>{U(!1),S.resetFields()},onCancel:()=>{U(!1),V(!1),S.resetFields()},children:[(0,l.jsx)(f.Z,{className:"mb-1",children:"Create a User who can own keys"}),(0,l.jsxs)(i.Z,{form:S,onFinish:$,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,l.jsx)(i.Z.Item,{label:"User Email",name:"user_email",children:(0,l.jsx)(p.Z,{placeholder:""})}),(0,l.jsx)(i.Z.Item,{label:(0,l.jsxs)("span",{children:["Global Proxy Role"," ",(0,l.jsx)(z.Z,{title:"This is the role that the user will globally on the proxy. This role is independent of any team/org specific roles.",children:(0,l.jsx)(F.Z,{})})]}),name:"user_role",children:(0,l.jsx)(r.default,{children:y&&Object.entries(y).map(e=>{let[s,{ui_label:t,description:a}]=e;return(0,l.jsx)(h.Z,{value:s,title:t,children:(0,l.jsxs)("div",{className:"flex",children:[t," ",(0,l.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:a})]})},s)})})}),(0,l.jsx)(i.Z.Item,{label:"Team",className:"gap-2",name:"team_id",help:"If selected, user will be added as a 'user' role to the team.",children:(0,l.jsx)(M.Z,{teams:b})}),(0,l.jsx)(i.Z.Item,{label:"Metadata",name:"metadata",children:(0,l.jsx)(n.default.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,l.jsxs)(c.Z,{children:[(0,l.jsx)(u.Z,{children:(0,l.jsx)(j.Z,{children:"Personal Key Creation"})}),(0,l.jsx)(m.Z,{children:(0,l.jsx)(i.Z.Item,{className:"gap-2",label:(0,l.jsxs)("span",{children:["Models"," ",(0,l.jsx)(z.Z,{title:"Models user has access to, outside of team scope.",children:(0,l.jsx)(F.Z,{style:{marginLeft:"4px"}})})]}),name:"models",help:"Models user has access to, outside of team scope.",children:(0,l.jsxs)(r.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:[(0,l.jsx)(r.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),(0,l.jsx)(r.default.Option,{value:"no-default-models",children:"No Default Models"},"no-default-models"),L.map(e=>(0,l.jsx)(r.default.Option,{value:e,children:(0,B.W0)(e)},e))]})})})]}),(0,l.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,l.jsx)(d.ZP,{htmlType:"submit",children:"Create User"})})]})]}),I&&(0,l.jsx)(g.Z,{isInvitationLinkModalVisible:R,setIsInvitationLinkModalVisible:E,baseUrl:K||"",invitationLinkData:A})]})}},98187:function(e,s,t){t.d(s,{Z:function(){return o}});var l=t(57437);t(2265);var a=t(57840),r=t(22116),i=t(29233),n=t(19431),d=t(9114);function o(e){let{isInvitationLinkModalVisible:s,setIsInvitationLinkModalVisible:t,baseUrl:o,invitationLinkData:c,modalType:m="invitation"}=e,{Title:u,Paragraph:x}=a.default,h=()=>{if(!o)return"";let e=new URL(o).pathname,s=e&&"/"!==e?"".concat(e,"/ui"):"ui";if(null==c?void 0:c.has_user_setup_sso)return new URL(s,o).toString();let t="".concat(s,"?invitation_id=").concat(null==c?void 0:c.id);return"resetPassword"===m&&(t+="&action=reset_password"),new URL(t,o).toString()};return(0,l.jsxs)(r.Z,{title:"invitation"===m?"Invitation Link":"Reset Password Link",visible:s,width:800,footer:null,onOk:()=>{t(!1)},onCancel:()=>{t(!1)},children:[(0,l.jsx)(x,{children:"invitation"===m?"Copy and send the generated link to onboard this user to the proxy.":"Copy and send the generated link to the user to reset their password."}),(0,l.jsxs)("div",{className:"flex justify-between pt-5 pb-2",children:[(0,l.jsx)(n.x,{className:"text-base",children:"User ID"}),(0,l.jsx)(n.x,{children:null==c?void 0:c.user_id})]}),(0,l.jsxs)("div",{className:"flex justify-between pt-5 pb-2",children:[(0,l.jsx)(n.x,{children:"invitation"===m?"Invitation Link":"Reset Password Link"}),(0,l.jsx)(n.x,{children:(0,l.jsx)(n.x,{children:h()})})]}),(0,l.jsx)("div",{className:"flex justify-end mt-5",children:(0,l.jsx)(i.CopyToClipboard,{text:h(),onCopy:()=>d.Z.success("Copied!"),children:(0,l.jsx)(n.z,{variant:"primary",children:"invitation"===m?"Copy invitation link":"Copy password reset link"})})})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2202-859c1cb8c2214ee1.js b/litellm/proxy/_experimental/out/_next/static/chunks/2202-859c1cb8c2214ee1.js new file mode 100644 index 00000000000..2e8353debb2 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/2202-859c1cb8c2214ee1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2202],{19431:function(e,s,t){t.d(s,{x:function(){return a.Z},z:function(){return l.Z}});var l=t(78489),a=t(84264)},65925:function(e,s,t){t.d(s,{m:function(){return i}});var l=t(57437);t(2265);var a=t(37592);let{Option:r}=a.default,i=e=>e?({"24h":"daily","7d":"weekly","30d":"monthly"})[e]||e:"Not set";s.Z=e=>{let{value:s,onChange:t,className:i="",style:n={}}=e;return(0,l.jsxs)(a.default,{style:{width:"100%",...n},value:s||void 0,onChange:t,className:i,placeholder:"n/a",children:[(0,l.jsx)(r,{value:"24h",children:"daily"}),(0,l.jsx)(r,{value:"7d",children:"weekly"}),(0,l.jsx)(r,{value:"30d",children:"monthly"})]})}},84376:function(e,s,t){var l=t(57437);t(2265);var a=t(37592);s.Z=e=>{let{teams:s,value:t,onChange:r,disabled:i}=e;return console.log("disabled",i),(0,l.jsx)(a.default,{showSearch:!0,placeholder:"Search or select a team",value:t,onChange:r,disabled:i,filterOption:(e,t)=>{if(!t)return!1;let l=null==s?void 0:s.find(e=>e.team_id===t.key);if(!l)return!1;let a=e.toLowerCase().trim(),r=(l.team_alias||"").toLowerCase(),i=(l.team_id||"").toLowerCase();return r.includes(a)||i.includes(a)},optionFilterProp:"children",children:null==s?void 0:s.map(e=>(0,l.jsxs)(a.default.Option,{value:e.team_id,children:[(0,l.jsx)("span",{className:"font-medium",children:e.team_alias})," ",(0,l.jsxs)("span",{className:"text-gray-500",children:["(",e.team_id,")"]})]},e.team_id))})}},7765:function(e,s,t){t.d(s,{Z:function(){return K}});var l=t(57437),a=t(2265),r=t(37592),i=t(10032),n=t(4260),d=t(5545),o=t(22116),c=t(87452),m=t(88829),u=t(72208),x=t(78489),h=t(43227),f=t(84264),p=t(49566),j=t(96761),g=t(98187),v=t(19250),b=t(19431),y=t(57840),N=t(65319),w=t(56609),_=t(73879),C=t(34310),k=t(38434),S=t(26349),Z=t(35291),U=t(3632),I=t(15452),V=t.n(I),L=t(71157),P=t(44643),R=t(88532),E=t(29233),O=t(9114),T=e=>{let{accessToken:s,teams:t,possibleUIRoles:r,onUsersCreated:i}=e,[n,d]=(0,a.useState)(!1),[c,m]=(0,a.useState)([]),[u,x]=(0,a.useState)(!1),[h,f]=(0,a.useState)(null),[p,j]=(0,a.useState)(null),[g,I]=(0,a.useState)(null),[T,z]=(0,a.useState)(null),[F,B]=(0,a.useState)(null),[D,M]=(0,a.useState)("http://localhost:4000");(0,a.useEffect)(()=>{(async()=>{try{let e=await (0,v.getProxyUISettings)(s);B(e)}catch(e){console.error("Error fetching UI settings:",e)}})(),M(new URL("/",window.location.href).toString())},[s]);let A=async()=>{x(!0);let e=c.map(e=>({...e,status:"pending"}));m(e);let t=!1;for(let i=0;ie.trim()).filter(Boolean),0===e.teams.length&&delete e.teams),n.models&&"string"==typeof n.models&&""!==n.models.trim()&&(e.models=n.models.split(",").map(e=>e.trim()).filter(Boolean),0===e.models.length&&delete e.models),n.max_budget&&""!==n.max_budget.toString().trim()){let s=parseFloat(n.max_budget.toString());!isNaN(s)&&s>0&&(e.max_budget=s)}n.budget_duration&&""!==n.budget_duration.trim()&&(e.budget_duration=n.budget_duration.trim()),n.metadata&&"string"==typeof n.metadata&&""!==n.metadata.trim()&&(e.metadata=n.metadata.trim()),console.log("Sending user data:",e);let a=await (0,v.userCreateCall)(s,null,e);if(console.log("Full response:",a),a&&(a.key||a.user_id)){t=!0,console.log("Success case triggered");let e=(null===(l=a.data)||void 0===l?void 0:l.user_id)||a.user_id;try{if(null==F?void 0:F.SSO_ENABLED){let e=new URL("/ui",D).toString();m(s=>s.map((s,t)=>t===i?{...s,status:"success",key:a.key||a.user_id,invitation_link:e}:s))}else{let t=await (0,v.invitationCreateCall)(s,e),l=new URL("/ui?invitation_id=".concat(t.id),D).toString();m(e=>e.map((e,s)=>s===i?{...e,status:"success",key:a.key||a.user_id,invitation_link:l}:e))}}catch(e){console.error("Error creating invitation:",e),m(e=>e.map((e,s)=>s===i?{...e,status:"success",key:a.key||a.user_id,error:"User created but failed to generate invitation link"}:e))}}else{console.log("Error case triggered");let e=(null==a?void 0:a.error)||"Failed to create user";console.log("Error message:",e),m(s=>s.map((s,t)=>t===i?{...s,status:"failed",error:e}:s))}}catch(s){console.error("Caught error:",s);let e=(null==s?void 0:null===(r=s.response)||void 0===r?void 0:null===(a=r.data)||void 0===a?void 0:a.error)||(null==s?void 0:s.message)||String(s);m(s=>s.map((s,t)=>t===i?{...s,status:"failed",error:e}:s))}}x(!1),t&&i&&i()};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(b.z,{className:"mb-0",onClick:()=>d(!0),children:"+ Bulk Invite Users"}),(0,l.jsx)(o.Z,{title:"Bulk Invite Users",visible:n,width:800,onCancel:()=>d(!1),bodyStyle:{maxHeight:"70vh",overflow:"auto"},footer:null,children:(0,l.jsx)("div",{className:"flex flex-col",children:0===c.length?(0,l.jsxs)("div",{className:"mb-6",children:[(0,l.jsxs)("div",{className:"flex items-center mb-4",children:[(0,l.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-500 text-white flex items-center justify-center mr-3",children:"1"}),(0,l.jsx)("h3",{className:"text-lg font-medium",children:"Download and fill the template"})]}),(0,l.jsxs)("div",{className:"ml-11 mb-6",children:[(0,l.jsx)("p",{className:"mb-4",children:"Add multiple users at once by following these steps:"}),(0,l.jsxs)("ol",{className:"list-decimal list-inside space-y-2 ml-2 mb-4",children:[(0,l.jsx)("li",{children:"Download our CSV template"}),(0,l.jsx)("li",{children:"Add your users' information to the spreadsheet"}),(0,l.jsx)("li",{children:"Save the file and upload it here"}),(0,l.jsx)("li",{children:"After creation, download the results file containing the Virtual Keys for each user"})]}),(0,l.jsxs)("div",{className:"bg-gray-50 p-4 rounded-md border border-gray-200 mb-4",children:[(0,l.jsx)("h4",{className:"font-medium mb-2",children:"Template Column Names"}),(0,l.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-red-500 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"user_email"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:"User's email address (required)"})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-red-500 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"user_role"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'User\'s role (one of: "proxy_admin", "proxy_admin_viewer", "internal_user", "internal_user_viewer")'})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"teams"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'Comma-separated team IDs (e.g., "team-1,team-2")'})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"max_budget"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'Maximum budget as a number (e.g., "100")'})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"budget_duration"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'Budget reset period (e.g., "30d", "1mo")'})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"models"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'Comma-separated allowed models (e.g., "gpt-3.5-turbo,gpt-4")'})]})]})]})]}),(0,l.jsxs)(b.z,{onClick:()=>{let e=new Blob([V().unparse([["user_email","user_role","teams","max_budget","budget_duration","models"],["user@example.com","internal_user","team-id-1,team-id-2","100","30d","gpt-3.5-turbo,gpt-4"]])],{type:"text/csv"}),s=window.URL.createObjectURL(e),t=document.createElement("a");t.href=s,t.download="bulk_users_template.csv",document.body.appendChild(t),t.click(),document.body.removeChild(t),window.URL.revokeObjectURL(s)},size:"lg",className:"w-full md:w-auto",children:[(0,l.jsx)(_.Z,{className:"mr-2"})," Download CSV Template"]})]}),(0,l.jsxs)("div",{className:"flex items-center mb-4",children:[(0,l.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-500 text-white flex items-center justify-center mr-3",children:"2"}),(0,l.jsx)("h3",{className:"text-lg font-medium",children:"Upload your completed CSV"})]}),(0,l.jsxs)("div",{className:"ml-11",children:[T?(0,l.jsxs)("div",{className:"mb-4 p-4 rounded-md border ".concat(g?"bg-red-50 border-red-200":"bg-blue-50 border-blue-200"),children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex items-center",children:[g?(0,l.jsx)(C.Z,{className:"text-red-500 text-xl mr-3"}):(0,l.jsx)(k.Z,{className:"text-blue-500 text-xl mr-3"}),(0,l.jsxs)("div",{children:[(0,l.jsx)(y.default.Text,{strong:!0,className:g?"text-red-800":"text-blue-800",children:T.name}),(0,l.jsxs)(y.default.Text,{className:"block text-xs ".concat(g?"text-red-600":"text-blue-600"),children:[(T.size/1024).toFixed(1)," KB • ",new Date().toLocaleDateString()]})]})]}),(0,l.jsxs)(b.z,{size:"xs",variant:"secondary",onClick:()=>{z(null),m([]),f(null),j(null),I(null)},className:"flex items-center",children:[(0,l.jsx)(S.Z,{className:"mr-1"})," Remove"]})]}),g?(0,l.jsxs)("div",{className:"mt-3 text-red-600 text-sm flex items-start",children:[(0,l.jsx)(Z.Z,{className:"mr-2 mt-0.5"}),(0,l.jsx)("span",{children:g})]}):!p&&(0,l.jsxs)("div",{className:"mt-3 flex items-center",children:[(0,l.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-1.5",children:(0,l.jsx)("div",{className:"bg-blue-500 h-1.5 rounded-full w-full animate-pulse"})}),(0,l.jsx)("span",{className:"ml-2 text-xs text-blue-600",children:"Processing..."})]})]}):(0,l.jsx)(N.default,{beforeUpload:e=>((f(null),j(null),I(null),z(e),"text/csv"===e.type||e.name.endsWith(".csv"))?e.size>5242880?I("File is too large (".concat((e.size/1048576).toFixed(1)," MB). Please upload a CSV file smaller than 5MB.")):V().parse(e,{complete:e=>{if(!e.data||0===e.data.length){j("The CSV file appears to be empty. Please upload a file with data."),m([]);return}if(1===e.data.length){j("The CSV file only contains headers but no user data. Please add user data to your CSV."),m([]);return}let s=e.data[0];if(0===s.length||1===s.length&&""===s[0]){j("The CSV file doesn't contain any column headers. Please make sure your CSV has headers."),m([]);return}let l=["user_email","user_role"].filter(e=>!s.includes(e));if(l.length>0){j("Your CSV is missing these required columns: ".concat(l.join(", "),". Please add these columns to your CSV file.")),m([]);return}try{let l=e.data.slice(1).map((e,l)=>{var a,r,i,n,d,o;if(0===e.length||1===e.length&&""===e[0])return null;if(e.length=parseFloat(c.max_budget.toString())&&m.push("Max budget must be greater than 0")),c.budget_duration&&!c.budget_duration.match(/^\d+[dhmwy]$|^\d+mo$/)&&m.push('Invalid budget duration format "'.concat(c.budget_duration,'". Use format like "30d", "1mo", "2w", "6h"')),c.teams&&"string"==typeof c.teams&&t&&t.length>0){let e=t.map(e=>e.team_id),s=c.teams.split(",").map(e=>e.trim()).filter(s=>!e.includes(s));s.length>0&&m.push("Unknown team(s): ".concat(s.join(", ")))}return m.length>0&&(c.isValid=!1,c.error=m.join(", ")),c}).filter(Boolean),a=l.filter(e=>e.isValid);m(l),0===l.length?j("No valid data rows found in the CSV file. Please check your file format."):0===a.length?f("No valid users found in the CSV. Please check the errors below and fix your CSV file."):a.length{f("Failed to parse CSV file: ".concat(e.message)),m([])},header:!1}):(I("Invalid file type: ".concat(e.name,". Please upload a CSV file (.csv extension).")),O.Z.fromBackend("Invalid file type. Please upload a CSV file.")),!1),accept:".csv",maxCount:1,showUploadList:!1,children:(0,l.jsxs)("div",{className:"border-2 border-dashed border-gray-300 rounded-lg p-8 text-center hover:border-blue-500 transition-colors cursor-pointer",children:[(0,l.jsx)(U.Z,{className:"text-3xl text-gray-400 mb-2"}),(0,l.jsx)("p",{className:"mb-1",children:"Drag and drop your CSV file here"}),(0,l.jsx)("p",{className:"text-sm text-gray-500 mb-3",children:"or"}),(0,l.jsx)(b.z,{size:"sm",children:"Browse files"}),(0,l.jsx)("p",{className:"text-xs text-gray-500 mt-4",children:"Only CSV files (.csv) are supported"})]})}),p&&(0,l.jsx)("div",{className:"mb-4 p-4 bg-yellow-50 border border-yellow-200 rounded-md",children:(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)(R.Z,{className:"h-5 w-5 text-yellow-500 mr-2 mt-0.5"}),(0,l.jsxs)("div",{children:[(0,l.jsx)(y.default.Text,{strong:!0,className:"text-yellow-800",children:"CSV Structure Error"}),(0,l.jsx)(y.default.Paragraph,{className:"text-yellow-700 mt-1 mb-0",children:p}),(0,l.jsx)(y.default.Paragraph,{className:"text-yellow-700 mt-2 mb-0",children:"Please download our template and ensure your CSV follows the required format."})]})]})})]})]}):(0,l.jsxs)("div",{className:"mb-6",children:[(0,l.jsxs)("div",{className:"flex items-center mb-4",children:[(0,l.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-500 text-white flex items-center justify-center mr-3",children:"3"}),(0,l.jsx)("h3",{className:"text-lg font-medium",children:c.some(e=>"success"===e.status||"failed"===e.status)?"User Creation Results":"Review and create users"})]}),h&&(0,l.jsx)("div",{className:"ml-11 mb-4 p-4 bg-red-50 border border-red-200 rounded-md",children:(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)(Z.Z,{className:"text-red-500 mr-2 mt-1"}),(0,l.jsxs)("div",{children:[(0,l.jsx)(b.x,{className:"text-red-600 font-medium",children:h}),c.some(e=>!e.isValid)&&(0,l.jsxs)("ul",{className:"mt-2 list-disc list-inside text-red-600 text-sm",children:[(0,l.jsx)("li",{children:"Check the table below for specific errors in each row"}),(0,l.jsx)("li",{children:"Common issues include invalid email formats, missing required fields, or incorrect role values"}),(0,l.jsx)("li",{children:"Fix these issues in your CSV file and upload again"})]})]})]})}),(0,l.jsxs)("div",{className:"ml-11",children:[(0,l.jsxs)("div",{className:"flex justify-between items-center mb-3",children:[(0,l.jsx)("div",{className:"flex items-center",children:c.some(e=>"success"===e.status||"failed"===e.status)?(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(b.x,{className:"text-lg font-medium mr-3",children:"Creation Summary"}),(0,l.jsxs)(b.x,{className:"text-sm bg-green-100 text-green-800 px-2 py-1 rounded mr-2",children:[c.filter(e=>"success"===e.status).length," Successful"]}),c.some(e=>"failed"===e.status)&&(0,l.jsxs)(b.x,{className:"text-sm bg-red-100 text-red-800 px-2 py-1 rounded",children:[c.filter(e=>"failed"===e.status).length," Failed"]})]}):(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(b.x,{className:"text-lg font-medium mr-3",children:"User Preview"}),(0,l.jsxs)(b.x,{className:"text-sm bg-blue-100 text-blue-800 px-2 py-1 rounded",children:[c.filter(e=>e.isValid).length," of ",c.length," users valid"]})]})}),!c.some(e=>"success"===e.status||"failed"===e.status)&&(0,l.jsxs)("div",{className:"flex space-x-3",children:[(0,l.jsx)(b.z,{onClick:()=>{m([]),f(null)},variant:"secondary",children:"Back"}),(0,l.jsx)(b.z,{onClick:A,disabled:0===c.filter(e=>e.isValid).length||u,children:u?"Creating...":"Create ".concat(c.filter(e=>e.isValid).length," Users")})]})]}),c.some(e=>"success"===e.status)&&(0,l.jsx)("div",{className:"mb-4 p-4 bg-blue-50 border border-blue-200 rounded-md",children:(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"mr-3 mt-1",children:(0,l.jsx)(P.Z,{className:"h-5 w-5 text-blue-500"})}),(0,l.jsxs)("div",{children:[(0,l.jsx)(b.x,{className:"font-medium text-blue-800",children:"User creation complete"}),(0,l.jsxs)(b.x,{className:"block text-sm text-blue-700 mt-1",children:[(0,l.jsx)("span",{className:"font-medium",children:"Next step:"})," Download the credentials file containing Virtual Keys and invitation links. Users will need these Virtual Keys to make LLM requests through LiteLLM."]})]})]})}),(0,l.jsx)(w.Z,{dataSource:c,columns:[{title:"Row",dataIndex:"rowNumber",key:"rowNumber",width:80},{title:"Email",dataIndex:"user_email",key:"user_email"},{title:"Role",dataIndex:"user_role",key:"user_role"},{title:"Teams",dataIndex:"teams",key:"teams"},{title:"Budget",dataIndex:"max_budget",key:"max_budget"},{title:"Status",key:"status",render:(e,s)=>s.isValid?s.status&&"pending"!==s.status?"success"===s.status?(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(P.Z,{className:"h-5 w-5 text-green-500 mr-2"}),(0,l.jsx)("span",{className:"text-green-500",children:"Success"})]}),s.invitation_link&&(0,l.jsx)("div",{className:"mt-1",children:(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)("span",{className:"text-xs text-gray-500 truncate max-w-[150px]",children:s.invitation_link}),(0,l.jsx)(E.CopyToClipboard,{text:s.invitation_link,onCopy:()=>O.Z.success("Invitation link copied!"),children:(0,l.jsx)("button",{className:"ml-1 text-blue-500 text-xs hover:text-blue-700",children:"Copy"})})]})})]}):(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(L.Z,{className:"h-5 w-5 text-red-500 mr-2"}),(0,l.jsx)("span",{className:"text-red-500",children:"Failed"})]}),s.error&&(0,l.jsx)("span",{className:"text-sm text-red-500 ml-7",children:JSON.stringify(s.error)})]}):(0,l.jsx)("span",{className:"text-gray-500",children:"Pending"}):(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(L.Z,{className:"h-5 w-5 text-red-500 mr-2"}),(0,l.jsx)("span",{className:"text-red-500",children:"Invalid"})]}),s.error&&(0,l.jsx)("span",{className:"text-sm text-red-500 ml-7",children:s.error})]})}],size:"small",pagination:{pageSize:5},scroll:{y:300},rowClassName:e=>e.isValid?"":"bg-red-50"}),!c.some(e=>"success"===e.status||"failed"===e.status)&&(0,l.jsxs)("div",{className:"flex justify-end mt-4",children:[(0,l.jsx)(b.z,{onClick:()=>{m([]),f(null)},variant:"secondary",className:"mr-3",children:"Back"}),(0,l.jsx)(b.z,{onClick:A,disabled:0===c.filter(e=>e.isValid).length||u,children:u?"Creating...":"Create ".concat(c.filter(e=>e.isValid).length," Users")})]}),c.some(e=>"success"===e.status||"failed"===e.status)&&(0,l.jsxs)("div",{className:"flex justify-end mt-4",children:[(0,l.jsx)(b.z,{onClick:()=>{m([]),f(null)},variant:"secondary",className:"mr-3",children:"Start New Bulk Import"}),(0,l.jsxs)(b.z,{onClick:()=>{let e=c.map(e=>({user_email:e.user_email,user_role:e.user_role,status:e.status,key:e.key||"",invitation_link:e.invitation_link||"",error:e.error||""})),s=new Blob([V().unparse(e)],{type:"text/csv"}),t=window.URL.createObjectURL(s),l=document.createElement("a");l.href=t,l.download="bulk_users_results.csv",document.body.appendChild(l),l.click(),document.body.removeChild(l),window.URL.revokeObjectURL(t)},variant:"primary",className:"flex items-center",children:[(0,l.jsx)(_.Z,{className:"mr-2"})," Download User Credentials"]})]})]})]})})})]})},z=t(99981),F=t(15424),B=t(46468),D=t(29827),M=t(84376);let{Option:A}=r.default,q=()=>"undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let s=16*Math.random()|0;return("x"==e?s:3&s|8).toString(16)});var K=e=>{let{userID:s,accessToken:t,teams:b,possibleUIRoles:y,onUserCreated:N,isEmbedded:w=!1}=e,_=(0,D.NL)(),[C,k]=(0,a.useState)(null),[S]=i.Z.useForm(),[Z,U]=(0,a.useState)(!1),[I,V]=(0,a.useState)(!1),[L,P]=(0,a.useState)([]),[R,E]=(0,a.useState)(!1),[A,K]=(0,a.useState)(null),[J,W]=(0,a.useState)(null);(0,a.useEffect)(()=>{let e=async()=>{try{let e=await (0,v.modelAvailableCall)(t,s,"any"),l=[];for(let s=0;s{var l,a,r;try{O.Z.info("Making API Call"),w||U(!0),e.models&&0!==e.models.length||"proxy_admin"===e.user_role||(console.log("formValues.user_role",e.user_role),e.models=["no-default-models"]),console.log("formValues in create user:",e);let a=await (0,v.userCreateCall)(t,null,e);await _.invalidateQueries({queryKey:["userList"]}),console.log("user create Response:",a),V(!0);let r=(null===(l=a.data)||void 0===l?void 0:l.user_id)||a.user_id;if(N&&w){N(r),S.resetFields();return}if(null==C?void 0:C.SSO_ENABLED){let e={id:q(),user_id:r,is_accepted:!1,accepted_at:null,expires_at:new Date(Date.now()+6048e5),created_at:new Date,created_by:s,updated_at:new Date,updated_by:s,has_user_setup_sso:!0};K(e),E(!0)}else(0,v.invitationCreateCall)(t,r).then(e=>{e.has_user_setup_sso=!1,K(e),E(!0)});O.Z.success("API user Created"),S.resetFields(),localStorage.removeItem("userData"+s)}catch(s){let e=(null===(r=s.response)||void 0===r?void 0:null===(a=r.data)||void 0===a?void 0:a.detail)||(null==s?void 0:s.message)||"Error creating the user";O.Z.fromBackend(e),console.error("Error creating the user:",s)}};return w?(0,l.jsxs)(i.Z,{form:S,onFinish:$,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,l.jsx)(i.Z.Item,{label:"User Email",name:"user_email",children:(0,l.jsx)(p.Z,{placeholder:""})}),(0,l.jsx)(i.Z.Item,{label:"User Role",name:"user_role",children:(0,l.jsx)(r.default,{children:y&&Object.entries(y).map(e=>{let[s,{ui_label:t,description:a}]=e;return(0,l.jsx)(h.Z,{value:s,title:t,children:(0,l.jsxs)("div",{className:"flex",children:[t," ",(0,l.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:a})]})},s)})})}),(0,l.jsx)(i.Z.Item,{label:"Team",name:"team_id",children:(0,l.jsx)(r.default,{placeholder:"Select Team",style:{width:"100%"},children:(0,l.jsx)(M.Z,{teams:b})})}),(0,l.jsx)(i.Z.Item,{label:"Metadata",name:"metadata",children:(0,l.jsx)(n.default.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,l.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,l.jsx)(d.ZP,{htmlType:"submit",children:"Create User"})})]}):(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)(x.Z,{className:"mb-0",onClick:()=>U(!0),children:"+ Invite User"}),(0,l.jsx)(T,{accessToken:t,teams:b,possibleUIRoles:y}),(0,l.jsxs)(o.Z,{title:"Invite User",visible:Z,width:800,footer:null,onOk:()=>{U(!1),S.resetFields()},onCancel:()=>{U(!1),V(!1),S.resetFields()},children:[(0,l.jsx)(f.Z,{className:"mb-1",children:"Create a User who can own keys"}),(0,l.jsxs)(i.Z,{form:S,onFinish:$,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,l.jsx)(i.Z.Item,{label:"User Email",name:"user_email",children:(0,l.jsx)(p.Z,{placeholder:""})}),(0,l.jsx)(i.Z.Item,{label:(0,l.jsxs)("span",{children:["Global Proxy Role"," ",(0,l.jsx)(z.Z,{title:"This is the role that the user will globally on the proxy. This role is independent of any team/org specific roles.",children:(0,l.jsx)(F.Z,{})})]}),name:"user_role",children:(0,l.jsx)(r.default,{children:y&&Object.entries(y).map(e=>{let[s,{ui_label:t,description:a}]=e;return(0,l.jsx)(h.Z,{value:s,title:t,children:(0,l.jsxs)("div",{className:"flex",children:[t," ",(0,l.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:a})]})},s)})})}),(0,l.jsx)(i.Z.Item,{label:"Team",className:"gap-2",name:"team_id",help:"If selected, user will be added as a 'user' role to the team.",children:(0,l.jsx)(M.Z,{teams:b})}),(0,l.jsx)(i.Z.Item,{label:"Metadata",name:"metadata",children:(0,l.jsx)(n.default.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,l.jsxs)(c.Z,{children:[(0,l.jsx)(u.Z,{children:(0,l.jsx)(j.Z,{children:"Personal Key Creation"})}),(0,l.jsx)(m.Z,{children:(0,l.jsx)(i.Z.Item,{className:"gap-2",label:(0,l.jsxs)("span",{children:["Models"," ",(0,l.jsx)(z.Z,{title:"Models user has access to, outside of team scope.",children:(0,l.jsx)(F.Z,{style:{marginLeft:"4px"}})})]}),name:"models",help:"Models user has access to, outside of team scope.",children:(0,l.jsxs)(r.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:[(0,l.jsx)(r.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),(0,l.jsx)(r.default.Option,{value:"no-default-models",children:"No Default Models"},"no-default-models"),L.map(e=>(0,l.jsx)(r.default.Option,{value:e,children:(0,B.W0)(e)},e))]})})})]}),(0,l.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,l.jsx)(d.ZP,{htmlType:"submit",children:"Create User"})})]})]}),I&&(0,l.jsx)(g.Z,{isInvitationLinkModalVisible:R,setIsInvitationLinkModalVisible:E,baseUrl:J||"",invitationLinkData:A})]})}},98187:function(e,s,t){t.d(s,{Z:function(){return o}});var l=t(57437);t(2265);var a=t(57840),r=t(22116),i=t(29233),n=t(19431),d=t(9114);function o(e){let{isInvitationLinkModalVisible:s,setIsInvitationLinkModalVisible:t,baseUrl:o,invitationLinkData:c,modalType:m="invitation"}=e,{Title:u,Paragraph:x}=a.default,h=()=>{if(!o)return"";let e=new URL(o).pathname,s=e&&"/"!==e?"".concat(e,"/ui"):"ui";if(null==c?void 0:c.has_user_setup_sso)return new URL(s,o).toString();let t="".concat(s,"?invitation_id=").concat(null==c?void 0:c.id);return"resetPassword"===m&&(t+="&action=reset_password"),new URL(t,o).toString()};return(0,l.jsxs)(r.Z,{title:"invitation"===m?"Invitation Link":"Reset Password Link",visible:s,width:800,footer:null,onOk:()=>{t(!1)},onCancel:()=>{t(!1)},children:[(0,l.jsx)(x,{children:"invitation"===m?"Copy and send the generated link to onboard this user to the proxy.":"Copy and send the generated link to the user to reset their password."}),(0,l.jsxs)("div",{className:"flex justify-between pt-5 pb-2",children:[(0,l.jsx)(n.x,{className:"text-base",children:"User ID"}),(0,l.jsx)(n.x,{children:null==c?void 0:c.user_id})]}),(0,l.jsxs)("div",{className:"flex justify-between pt-5 pb-2",children:[(0,l.jsx)(n.x,{children:"invitation"===m?"Invitation Link":"Reset Password Link"}),(0,l.jsx)(n.x,{children:(0,l.jsx)(n.x,{children:h()})})]}),(0,l.jsx)("div",{className:"flex justify-end mt-5",children:(0,l.jsx)(i.CopyToClipboard,{text:h(),onCopy:()=>d.Z.success("Copied!"),children:(0,l.jsx)(n.z,{variant:"primary",children:"invitation"===m?"Copy invitation link":"Copy password reset link"})})})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2249-01a36f26b1cecba3.js b/litellm/proxy/_experimental/out/_next/static/chunks/2249-01a36f26b1cecba3.js deleted file mode 100644 index b21241beec0..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/2249-01a36f26b1cecba3.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2249],{64748:function(e,s,l){l.d(s,{Ct:function(){return a.Z},Dx:function(){return m.Z},OK:function(){return n.Z},Zb:function(){return r.Z},nP:function(){return o.Z},td:function(){return c.Z},v0:function(){return i.Z},x4:function(){return d.Z},xv:function(){return x.Z},zx:function(){return t.Z}});var a=l(41649),t=l(78489),r=l(12514),n=l(12485),i=l(18135),c=l(35242),d=l(29706),o=l(77991),x=l(84264),m=l(96761)},78801:function(e,s,l){l.d(s,{Z:function(){return a.Z},x:function(){return t.Z}});var a=l(12514),t=l(84264)},92249:function(e,s,l){l.d(s,{Z:function(){return W}});var a=l(57437),t=l(23639),r=l(64748),n=l(22116),i=l(78867),c=l(99376),d=l(2265),o=l(17906),x=l(20347),m=l(41649),h=l(78489),u=l(84264),p=l(99981),g=l(3810),j=l(15424),v=l(15690),b=l(10032),N=l(61994),f=l(5545),y=l(96761),_=l(19250),k=l(9114);let{Step:w}=v.default;var Z=e=>{let{visible:s,onClose:l,accessToken:t,agentHubData:r,onSuccess:i}=e,[c,o]=(0,d.useState)(0),[x,h]=(0,d.useState)(new Set),[p,g]=(0,d.useState)(!1),[j]=b.Z.useForm(),Z=()=>{o(0),h(new Set),j.resetFields(),l()},C=(e,s)=>{let l=new Set(x);s?l.add(e):l.delete(e),h(l)},S=e=>{e?h(new Set(r.map(e=>e.agent_id||e.name))):h(new Set)};(0,d.useEffect)(()=>{s&&r.length>0&&h(new Set(r.filter(e=>!0===e.is_public).map(e=>e.agent_id||e.name)))},[s,r]);let P=async()=>{if(0===x.size){k.Z.fromBackend("Please select at least one agent to make public");return}g(!0);try{let e=Array.from(x);await (0,_.makeAgentsPublicCall)(t,e),k.Z.success("Successfully made ".concat(e.length," agent(s) public!")),Z(),i()}catch(e){console.error("Error making agents public:",e),k.Z.fromBackend("Failed to make agents public. Please try again.")}finally{g(!1)}},M=()=>{let e=r.length>0&&r.every(e=>x.has(e.agent_id||e.name)),s=x.size>0&&!e;return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)(y.Z,{children:"Select Agents to Make Public"}),(0,a.jsx)("div",{className:"flex items-center space-x-2",children:(0,a.jsxs)(N.Z,{checked:e,indeterminate:s,onChange:e=>S(e.target.checked),disabled:0===r.length,children:["Select All ",r.length>0&&"(".concat(r.length,")")]})})]}),(0,a.jsx)(u.Z,{className:"text-sm text-gray-600",children:"Select the agents you want to be visible on the public model hub. Users will still require a valid API key to use these agents."}),(0,a.jsx)("div",{className:"max-h-96 overflow-y-auto border rounded-lg p-4",children:(0,a.jsx)("div",{className:"space-y-3",children:0===r.length?(0,a.jsx)("div",{className:"text-center py-8 text-gray-500",children:(0,a.jsx)(u.Z,{children:"No agents available."})}):r.map(e=>{let s=e.agent_id||e.name;return(0,a.jsxs)("div",{className:"flex items-center space-x-3 p-3 border rounded-lg hover:bg-gray-50",children:[(0,a.jsx)(N.Z,{checked:x.has(s),onChange:e=>C(s,e.target.checked)}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:e.name}),(0,a.jsxs)(m.Z,{color:"blue",size:"sm",children:["v",e.version]})]}),(0,a.jsx)(u.Z,{className:"text-xs text-gray-600 mt-1",children:e.description}),e.skills&&e.skills.length>0&&(0,a.jsxs)("div",{className:"flex flex-wrap gap-1 mt-1",children:[e.skills.slice(0,3).map(e=>(0,a.jsx)(m.Z,{color:"purple",size:"xs",children:e.name},e.id)),e.skills.length>3&&(0,a.jsxs)(u.Z,{className:"text-xs text-gray-500",children:["+",e.skills.length-3," more"]})]})]})]},s)})})}),x.size>0&&(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:[(0,a.jsx)("strong",{children:x.size})," agent",1!==x.size?"s":""," selected"]})})]})},z=()=>(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(y.Z,{children:"Confirm Making Agents Public"}),(0,a.jsx)("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:(0,a.jsxs)(u.Z,{className:"text-sm text-yellow-800",children:[(0,a.jsx)("strong",{children:"Warning:"})," Once you make these agents public, anyone who can go to the"," ",(0,a.jsx)("code",{children:"/ui/model_hub_table"})," will be able to know they exist on the proxy."]})}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:"Agents to be made public:"}),(0,a.jsx)("div",{className:"max-h-48 overflow-y-auto border rounded-lg p-3",children:(0,a.jsx)("div",{className:"space-y-2",children:Array.from(x).map(e=>{let s=r.find(s=>(s.agent_id||s.name)===e);return(0,a.jsx)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:(null==s?void 0:s.name)||e}),s&&(0,a.jsxs)(m.Z,{color:"blue",size:"xs",children:["v",s.version]})]}),(null==s?void 0:s.description)&&(0,a.jsx)(u.Z,{className:"text-xs text-gray-600 mt-1",children:s.description})]})},e)})})})]}),(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:["Total: ",(0,a.jsx)("strong",{children:x.size})," agent",1!==x.size?"s":""," will be made public"]})})]});return(0,a.jsx)(n.Z,{title:"Make Agents Public",open:s,onCancel:Z,footer:null,width:1200,maskClosable:!1,children:(0,a.jsxs)(b.Z,{form:j,layout:"vertical",children:[(0,a.jsxs)(v.default,{current:c,className:"mb-6",children:[(0,a.jsx)(w,{title:"Select Agents"}),(0,a.jsx)(w,{title:"Confirm"})]}),(()=>{switch(c){case 0:return M();case 1:return z();default:return null}})(),(0,a.jsxs)("div",{className:"flex justify-between mt-6",children:[(0,a.jsx)(f.ZP,{onClick:0===c?Z:()=>{1===c&&o(0)},children:0===c?"Cancel":"Previous"}),(0,a.jsxs)("div",{className:"flex space-x-2",children:[0===c&&(0,a.jsx)(f.ZP,{onClick:()=>{if(0===c){if(0===x.size){k.Z.fromBackend("Please select at least one agent to make public");return}o(1)}},disabled:0===x.size,children:"Next"}),1===c&&(0,a.jsx)(f.ZP,{onClick:P,loading:p,children:"Make Public"})]})]})]})})};let{Step:C}=v.default;var S=e=>{let{visible:s,onClose:l,accessToken:t,mcpHubData:r,onSuccess:i}=e,[c,o]=(0,d.useState)(0),[x,h]=(0,d.useState)(new Set),[p,g]=(0,d.useState)(!1),[j]=b.Z.useForm(),w=()=>{o(0),h(new Set),j.resetFields(),l()},Z=(e,s)=>{let l=new Set(x);s?l.add(e):l.delete(e),h(l)},S=e=>{e?h(new Set(r.map(e=>e.server_id))):h(new Set)};(0,d.useEffect)(()=>{s&&r.length>0&&h(new Set(r.filter(e=>{var s;return(null===(s=e.mcp_info)||void 0===s?void 0:s.is_public)===!0}).map(e=>e.server_id)))},[s]);let P=async()=>{if(0===x.size){k.Z.fromBackend("Please select at least one MCP server to make public");return}g(!0);try{let e=Array.from(x);await (0,_.makeMCPPublicCall)(t,e),k.Z.success("Successfully made ".concat(e.length," MCP server(s) public!")),w(),i()}catch(e){console.error("Error making MCP servers public:",e),k.Z.fromBackend("Failed to make MCP servers public. Please try again.")}finally{g(!1)}},M=()=>{let e=r.length>0&&r.every(e=>x.has(e.server_id)),s=x.size>0&&!e;return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)(y.Z,{children:"Select MCP Servers to Make Public"}),(0,a.jsx)("div",{className:"flex items-center space-x-2",children:(0,a.jsxs)(N.Z,{checked:e,indeterminate:s,onChange:e=>S(e.target.checked),disabled:0===r.length,children:["Select All ",r.length>0&&"(".concat(r.length,")")]})})]}),(0,a.jsx)(u.Z,{className:"text-sm text-gray-600",children:"Select the MCP servers you want to be visible on the public model hub. Users will still require a valid API key to use these servers."}),(0,a.jsx)("div",{className:"max-h-96 overflow-y-auto border rounded-lg p-4",children:(0,a.jsx)("div",{className:"space-y-3",children:0===r.length?(0,a.jsx)("div",{className:"text-center py-8 text-gray-500",children:(0,a.jsx)(u.Z,{children:"No MCP servers available."})}):r.map(e=>{var s;let l=(null===(s=e.mcp_info)||void 0===s?void 0:s.is_public)===!0;return(0,a.jsxs)("div",{className:"flex items-center space-x-3 p-3 border rounded-lg hover:bg-gray-50",children:[(0,a.jsx)(N.Z,{checked:x.has(e.server_id),onChange:s=>Z(e.server_id,s.target.checked)}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:e.server_name}),l&&(0,a.jsx)(m.Z,{color:"emerald",size:"sm",children:"Public"}),(0,a.jsx)(m.Z,{color:"blue",size:"sm",children:e.transport}),(0,a.jsx)(m.Z,{color:"active"===e.status||"healthy"===e.status?"green":"inactive"===e.status||"unhealthy"===e.status?"red":"gray",size:"sm",children:e.status||"unknown"})]}),(0,a.jsx)(u.Z,{className:"text-xs text-gray-600 mt-1",children:e.description||e.url}),e.allowed_tools&&e.allowed_tools.length>0&&(0,a.jsxs)("div",{className:"flex flex-wrap gap-1 mt-1",children:[e.allowed_tools.slice(0,3).map((e,s)=>(0,a.jsx)(m.Z,{color:"purple",size:"xs",children:e},s)),e.allowed_tools.length>3&&(0,a.jsxs)(u.Z,{className:"text-xs text-gray-500",children:["+",e.allowed_tools.length-3," more"]})]})]})]},e.server_id)})})}),x.size>0&&(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:[(0,a.jsx)("strong",{children:x.size})," MCP server",1!==x.size?"s":""," selected"]})})]})},z=()=>(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(y.Z,{children:"Confirm Making MCP Servers Public"}),(0,a.jsx)("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:(0,a.jsxs)(u.Z,{className:"text-sm text-yellow-800",children:[(0,a.jsx)("strong",{children:"Warning:"})," Once you make these MCP servers public, anyone who can go to the"," ",(0,a.jsx)("code",{children:"/ui/model_hub_table"})," will be able to know they exist on the proxy."]})}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:"MCP Servers to be made public:"}),(0,a.jsx)("div",{className:"max-h-48 overflow-y-auto border rounded-lg p-3",children:(0,a.jsx)("div",{className:"space-y-2",children:Array.from(x).map(e=>{let s=r.find(s=>s.server_id===e);return(0,a.jsx)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:(null==s?void 0:s.server_name)||e}),s&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(m.Z,{color:"blue",size:"xs",children:s.transport}),(0,a.jsx)(m.Z,{color:"active"===s.status||"healthy"===s.status?"green":"inactive"===s.status||"unhealthy"===s.status?"red":"gray",size:"xs",children:s.status||"unknown"})]})]}),(null==s?void 0:s.description)&&(0,a.jsx)(u.Z,{className:"text-xs text-gray-600 mt-1",children:s.description}),(null==s?void 0:s.url)&&(0,a.jsx)(u.Z,{className:"text-xs text-gray-500 mt-1",children:s.url})]})},e)})})})]}),(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:["Total: ",(0,a.jsx)("strong",{children:x.size})," MCP server",1!==x.size?"s":""," will be made public"]})})]});return(0,a.jsx)(n.Z,{title:"Make MCP Servers Public",open:s,onCancel:w,footer:null,width:1200,maskClosable:!1,children:(0,a.jsxs)(b.Z,{form:j,layout:"vertical",children:[(0,a.jsxs)(v.default,{current:c,className:"mb-6",children:[(0,a.jsx)(C,{title:"Select Servers"}),(0,a.jsx)(C,{title:"Confirm"})]}),(()=>{switch(c){case 0:return M();case 1:return z();default:return null}})(),(0,a.jsxs)("div",{className:"flex justify-between mt-6",children:[(0,a.jsx)(f.ZP,{onClick:0===c?w:()=>{1===c&&o(0)},children:0===c?"Cancel":"Previous"}),(0,a.jsxs)("div",{className:"flex space-x-2",children:[0===c&&(0,a.jsx)(f.ZP,{onClick:()=>{if(0===c){if(0===x.size){k.Z.fromBackend("Please select at least one MCP server to make public");return}o(1)}},disabled:0===x.size,children:"Next"}),1===c&&(0,a.jsx)(f.ZP,{onClick:P,loading:p,children:"Make Public"})]})]})]})})},P=l(78801),M=e=>{let{modelHubData:s,onFilteredDataChange:l,showFiltersCard:t=!0,className:r=""}=e,[n,i]=(0,d.useState)(""),[c,o]=(0,d.useState)(""),[x,m]=(0,d.useState)(""),[h,u]=(0,d.useState)(""),p=(0,d.useRef)([]),g=(0,d.useMemo)(()=>(null==s?void 0:s.filter(e=>{let s=e.model_group.toLowerCase().includes(n.toLowerCase()),l=""===c||e.providers.includes(c),a=""===x||e.mode===x,t=""===h||Object.entries(e).filter(e=>{let[s,l]=e;return s.startsWith("supports_")&&!0===l}).some(e=>{let[s]=e;return s.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")===h});return s&&l&&a&&t}))||[],[s,n,c,x,h]);(0,d.useEffect)(()=>{(g.length!==p.current.length||g.some((e,s)=>{var l;return e.model_group!==(null===(l=p.current[s])||void 0===l?void 0:l.model_group)}))&&(p.current=g,l(g))},[g,l]);let j=(0,a.jsxs)("div",{className:"flex flex-wrap gap-4 items-center",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(P.x,{className:"text-sm font-medium mb-2",children:"Search Models:"}),(0,a.jsx)("input",{type:"text",placeholder:"Search model names...",value:n,onChange:e=>i(e.target.value),className:"border rounded px-3 py-2 w-64 h-10 text-sm"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(P.x,{className:"text-sm font-medium mb-2",children:"Provider:"}),(0,a.jsxs)("select",{value:c,onChange:e=>o(e.target.value),className:"border rounded px-3 py-2 text-sm text-gray-600 w-40 h-10",children:[(0,a.jsx)("option",{value:"",className:"text-sm text-gray-600",children:"All Providers"}),s&&(e=>{let s=new Set;return e.forEach(e=>{e.providers.forEach(e=>s.add(e))}),Array.from(s)})(s).map(e=>(0,a.jsx)("option",{value:e,className:"text-sm text-gray-800",children:e},e))]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(P.x,{className:"text-sm font-medium mb-2",children:"Mode:"}),(0,a.jsxs)("select",{value:x,onChange:e=>m(e.target.value),className:"border rounded px-3 py-2 text-sm text-gray-600 w-32 h-10",children:[(0,a.jsx)("option",{value:"",className:"text-sm text-gray-600",children:"All Modes"}),s&&(e=>{let s=new Set;return e.forEach(e=>{e.mode&&s.add(e.mode)}),Array.from(s)})(s).map(e=>(0,a.jsx)("option",{value:e,className:"text-sm text-gray-800",children:e},e))]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(P.x,{className:"text-sm font-medium mb-2",children:"Features:"}),(0,a.jsxs)("select",{value:h,onChange:e=>u(e.target.value),className:"border rounded px-3 py-2 text-sm text-gray-600 w-48 h-10",children:[(0,a.jsx)("option",{value:"",className:"text-sm text-gray-600",children:"All Features"}),s&&(e=>{let s=new Set;return e.forEach(e=>{Object.entries(e).filter(e=>{let[s,l]=e;return s.startsWith("supports_")&&!0===l}).forEach(e=>{let[l]=e,a=l.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");s.add(a)})}),Array.from(s).sort()})(s).map(e=>(0,a.jsx)("option",{value:e,className:"text-sm text-gray-800",children:e},e))]})]}),(n||c||x||h)&&(0,a.jsx)("div",{className:"flex items-end",children:(0,a.jsx)("button",{onClick:()=>{i(""),o(""),m(""),u("")},className:"text-blue-600 hover:text-blue-800 text-sm underline h-10 flex items-center",children:"Clear Filters"})})]});return t?(0,a.jsx)(P.Z,{className:"mb-6 ".concat(r),children:j}):(0,a.jsx)("div",{className:r,children:j})};let{Step:z}=v.default;var A=e=>{let{visible:s,onClose:l,accessToken:t,modelHubData:r,onSuccess:i}=e,[c,o]=(0,d.useState)(0),[x,h]=(0,d.useState)(new Set),[p,g]=(0,d.useState)([]),[j,w]=(0,d.useState)(!1),[Z]=b.Z.useForm(),C=()=>{o(0),h(new Set),g([]),Z.resetFields(),l()},S=(e,s)=>{let l=new Set(x);s?l.add(e):l.delete(e),h(l)},P=e=>{e?h(new Set(p.map(e=>e.model_group))):h(new Set)},A=(0,d.useCallback)(e=>{g(e)},[]);(0,d.useEffect)(()=>{s&&r.length>0&&(g(r),h(new Set(r.filter(e=>!0===e.is_public_model_group).map(e=>e.model_group))))},[s,r]);let F=async()=>{if(0===x.size){k.Z.fromBackend("Please select at least one model to make public");return}w(!0);try{let e=Array.from(x);await (0,_.makeModelGroupPublic)(t,e),k.Z.success("Successfully made ".concat(e.length," model group(s) public!")),C(),i()}catch(e){console.error("Error making model groups public:",e),k.Z.fromBackend("Failed to make model groups public. Please try again.")}finally{w(!1)}},L=()=>{let e=p.length>0&&p.every(e=>x.has(e.model_group)),s=x.size>0&&!e;return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)(y.Z,{children:"Select Models to Make Public"}),(0,a.jsx)("div",{className:"flex items-center space-x-2",children:(0,a.jsxs)(N.Z,{checked:e,indeterminate:s,onChange:e=>P(e.target.checked),disabled:0===p.length,children:["Select All ",p.length>0&&"(".concat(p.length,")")]})})]}),(0,a.jsx)(u.Z,{className:"text-sm text-gray-600",children:"Select the models you want to be visible on the public model hub. Users will still require a valid API key to use these models."}),(0,a.jsx)(M,{modelHubData:r,onFilteredDataChange:A,showFiltersCard:!1,className:"border rounded-lg p-4 bg-gray-50"}),(0,a.jsx)("div",{className:"max-h-96 overflow-y-auto border rounded-lg p-4",children:(0,a.jsx)("div",{className:"space-y-3",children:0===p.length?(0,a.jsx)("div",{className:"text-center py-8 text-gray-500",children:(0,a.jsx)(u.Z,{children:"No models match the current filters."})}):p.map(e=>(0,a.jsxs)("div",{className:"flex items-center space-x-3 p-3 border rounded-lg hover:bg-gray-50",children:[(0,a.jsx)(N.Z,{checked:x.has(e.model_group),onChange:s=>S(e.model_group,s.target.checked)}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:e.model_group}),e.mode&&(0,a.jsx)(m.Z,{color:"green",size:"sm",children:e.mode})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:e.providers.map(e=>(0,a.jsx)(m.Z,{color:"blue",size:"xs",children:e},e))})]})]},e.model_group))})}),x.size>0&&(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:[(0,a.jsx)("strong",{children:x.size})," model",1!==x.size?"s":""," selected"]})})]})},D=()=>(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(y.Z,{children:"Confirm Making Models Public"}),(0,a.jsx)("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:(0,a.jsxs)(u.Z,{className:"text-sm text-yellow-800",children:[(0,a.jsx)("strong",{children:"Warning:"})," Once you make these models public, anyone who can go to the"," ",(0,a.jsx)("code",{children:"/ui/model_hub_table"})," will be able to know they exist on the proxy."]})}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:"Models to be made public:"}),(0,a.jsx)("div",{className:"max-h-48 overflow-y-auto border rounded-lg p-3",children:(0,a.jsx)("div",{className:"space-y-2",children:Array.from(x).map(e=>{let s=r.find(s=>s.model_group===e);return(0,a.jsx)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:(0,a.jsxs)("div",{children:[(0,a.jsx)(u.Z,{className:"font-medium",children:e}),s&&(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:s.providers.map(e=>(0,a.jsx)(m.Z,{color:"blue",size:"xs",children:e},e))})]})},e)})})})]}),(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:["Total: ",(0,a.jsx)("strong",{children:x.size})," model",1!==x.size?"s":""," will be made public"]})})]});return(0,a.jsx)(n.Z,{title:"Make Models Public",open:s,onCancel:C,footer:null,width:1200,maskClosable:!1,children:(0,a.jsxs)(b.Z,{form:Z,layout:"vertical",children:[(0,a.jsxs)(v.default,{current:c,className:"mb-6",children:[(0,a.jsx)(z,{title:"Select Models"}),(0,a.jsx)(z,{title:"Confirm"})]}),(()=>{switch(c){case 0:return L();case 1:return D();default:return null}})(),(0,a.jsxs)("div",{className:"flex justify-between mt-6",children:[(0,a.jsx)(f.ZP,{onClick:0===c?C:()=>{1===c&&o(0)},children:0===c?"Cancel":"Previous"}),(0,a.jsxs)("div",{className:"flex space-x-2",children:[0===c&&(0,a.jsx)(f.ZP,{onClick:()=>{if(0===c){if(0===x.size){k.Z.fromBackend("Please select at least one model to make public");return}o(1)}},disabled:0===x.size,children:"Next"}),1===c&&(0,a.jsx)(f.ZP,{onClick:F,loading:j,children:"Make Public"})]})]})]})})},F=l(8048);let L=e=>e.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),D=e=>Object.entries(e).filter(e=>{let[s,l]=e;return s.startsWith("supports_")&&!0===l}).map(e=>{let[s]=e;return s}),O=e=>"$".concat((1e6*e).toFixed(2)),U=e=>e>=1e6?"".concat((e/1e6).toFixed(1),"M"):e>=1e3?"".concat((e/1e3).toFixed(1),"K"):e.toString(),E=function(e,s){let l=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=[{header:"Public Model Name",accessorKey:"model_group",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,r=l.original;return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium text-sm",children:r.model_group}),(0,a.jsx)(p.Z,{title:"Copy model name",children:(0,a.jsx)(t.Z,{onClick:()=>s(r.model_group),className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs"})})]}),(0,a.jsx)("div",{className:"md:hidden",children:(0,a.jsx)(u.Z,{className:"text-xs text-gray-600",children:r.providers.join(", ")})})]})}},{header:"Provider",accessorKey:"providers",enableSorting:!0,sortingFn:(e,s)=>{let l=e.original.providers.join(", "),a=s.original.providers.join(", ");return l.localeCompare(a)},cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsxs)("div",{className:"flex flex-wrap gap-1",children:[l.providers.slice(0,2).map(e=>(0,a.jsx)(g.Z,{color:"blue",className:"text-xs",children:e},e)),l.providers.length>2&&(0,a.jsxs)(u.Z,{className:"text-xs text-gray-500",children:["+",l.providers.length-2]})]})},meta:{className:"hidden md:table-cell"}},{header:"Mode",accessorKey:"mode",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return l.mode?(0,a.jsx)(m.Z,{color:"green",size:"sm",children:l.mode}):(0,a.jsx)(u.Z,{className:"text-gray-500",children:"-"})},meta:{className:"hidden lg:table-cell"}},{header:"Tokens",accessorKey:"max_input_tokens",enableSorting:!0,sortingFn:(e,s)=>(e.original.max_input_tokens||0)+(e.original.max_output_tokens||0)-((s.original.max_input_tokens||0)+(s.original.max_output_tokens||0)),cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)("div",{className:"space-y-1",children:(0,a.jsxs)(u.Z,{className:"text-xs",children:[l.max_input_tokens?U(l.max_input_tokens):"-"," /"," ",l.max_output_tokens?U(l.max_output_tokens):"-"]})})},meta:{className:"hidden lg:table-cell"}},{header:"Cost/1M",accessorKey:"input_cost_per_token",enableSorting:!0,sortingFn:(e,s)=>(e.original.input_cost_per_token||0)+(e.original.output_cost_per_token||0)-((s.original.input_cost_per_token||0)+(s.original.output_cost_per_token||0)),cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(u.Z,{className:"text-xs",children:l.input_cost_per_token?O(l.input_cost_per_token):"-"}),(0,a.jsx)(u.Z,{className:"text-xs text-gray-500",children:l.output_cost_per_token?O(l.output_cost_per_token):"-"})]})}},{header:"Features",accessorKey:"capabilities",enableSorting:!1,cell:e=>{let{row:s}=e,l=D(s.original),t=["green","blue","purple","orange","red","yellow"];return(0,a.jsx)("div",{className:"flex flex-wrap gap-1",children:0===l.length?(0,a.jsx)(u.Z,{className:"text-gray-500 text-xs",children:"-"}):l.map((e,s)=>(0,a.jsx)(m.Z,{color:t[s%t.length],size:"xs",children:L(e)},e))})}},{header:"Public",accessorKey:"is_public_model_group",enableSorting:!0,sortingFn:(e,s)=>(!0===e.original.is_public_model_group?1:0)-(!0===s.original.is_public_model_group?1:0),cell:e=>{let{row:s}=e;return!0===s.original.is_public_model_group?(0,a.jsx)(m.Z,{color:"green",size:"xs",children:"Yes"}):(0,a.jsx)(m.Z,{color:"gray",size:"xs",children:"No"})},meta:{className:"hidden md:table-cell"}},{header:"Details",id:"details",enableSorting:!1,cell:s=>{let{row:l}=s,t=l.original;return(0,a.jsxs)(h.Z,{size:"xs",variant:"secondary",onClick:()=>e(t),icon:j.Z,children:[(0,a.jsx)("span",{className:"hidden lg:inline",children:"Details"}),(0,a.jsx)("span",{className:"lg:hidden",children:"Info"})]})}}];return l?r.filter(e=>!("accessorKey"in e)||"is_public_model_group"!==e.accessorKey):r};var K=l(87526),T=l(86462),H=l(47686),I=l(77355),R=l(93416),B=l(74998),Y=l(95704),V=e=>{let{accessToken:s,userRole:l}=e,[t,r]=(0,d.useState)([]),[i,c]=(0,d.useState)({url:"",displayName:""}),[o,m]=(0,d.useState)(null),[h,u]=(0,d.useState)(!1),[p,g]=(0,d.useState)(!0),j=async()=>{if(s)try{u(!0);let e=await (0,_.getPublicModelHubInfo)();if(e&&e.useful_links){let s=e.useful_links||{},l=Object.entries(s).map((e,s)=>{let[l,a]=e;return{id:"".concat(s,"-").concat(l),displayName:l,url:a}});r(l)}else r([])}catch(e){console.error("Error fetching useful links:",e),r([])}finally{u(!1)}};if((0,d.useEffect)(()=>{j()},[s]),!(0,x.tY)(l||""))return null;let v=async e=>{if(!s)return!1;try{let l={};return e.forEach(e=>{l[e.displayName]=e.url}),await (0,_.updateUsefulLinksCall)(s,l),n.Z.success({title:"Links Saved Successfully",content:(0,a.jsxs)("div",{className:"py-4",children:[(0,a.jsx)("p",{className:"text-gray-600 mb-4",children:"Your useful links have been saved and are now visible on the public model hub."}),(0,a.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:[(0,a.jsx)("p",{className:"text-sm text-blue-800 mb-2 font-medium",children:"View your updated model hub:"}),(0,a.jsx)("a",{href:"".concat((0,_.getProxyBaseUrl)(),"/ui/model_hub_table"),target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center text-blue-600 hover:text-blue-800 underline text-sm font-medium",children:"Open Public Model Hub →"})]})]}),width:500,okText:"Close",maskClosable:!0,keyboard:!0}),!0}catch(e){return console.error("Error saving links:",e),k.Z.fromBackend("Failed to save links - ".concat(e)),!1}},b=async()=>{if(!i.url||!i.displayName)return;try{new URL(i.url)}catch(e){k.Z.fromBackend("Please enter a valid URL");return}if(t.some(e=>e.displayName===i.displayName)){k.Z.fromBackend("A link with this display name already exists");return}let e=[...t,{id:"".concat(Date.now(),"-").concat(i.displayName),displayName:i.displayName,url:i.url}];await v(e)&&(r(e),c({url:"",displayName:""}),k.Z.success("Link added successfully"))},N=e=>{m({...e})},f=async()=>{if(!o)return;try{new URL(o.url)}catch(e){k.Z.fromBackend("Please enter a valid URL");return}if(t.some(e=>e.id!==o.id&&e.displayName===o.displayName)){k.Z.fromBackend("A link with this display name already exists");return}let e=t.map(e=>e.id===o.id?o:e);await v(e)&&(r(e),m(null),k.Z.success("Link updated successfully"))},y=()=>{m(null)},w=async e=>{let s=t.filter(s=>s.id!==e);await v(s)&&(r(s),k.Z.success("Link deleted successfully"))},Z=e=>{window.open(e,"_blank")};return(0,a.jsxs)(Y.Zb,{className:"mb-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between cursor-pointer",onClick:()=>g(!p),children:[(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)(Y.Dx,{className:"mb-0",children:"Link Management"}),(0,a.jsx)("p",{className:"text-sm text-gray-500",children:"Manage the links that are displayed under 'Useful Links' on the public model hub."})]}),(0,a.jsx)("div",{className:"flex items-center",children:p?(0,a.jsx)(T.Z,{className:"w-5 h-5 text-gray-500"}):(0,a.jsx)(H.Z,{className:"w-5 h-5 text-gray-500"})})]}),p&&(0,a.jsxs)("div",{className:"mt-4",children:[(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsx)(Y.xv,{className:"text-sm font-medium text-gray-700 mb-2",children:"Add New Link"}),(0,a.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"URL"}),(0,a.jsx)("input",{type:"text",value:i.url,onChange:e=>c({...i,url:e.target.value}),placeholder:"https://example.com",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Display Name"}),(0,a.jsx)("input",{type:"text",value:i.displayName,onChange:e=>c({...i,displayName:e.target.value}),placeholder:"Friendly name",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,a.jsx)("div",{className:"flex items-end",children:(0,a.jsxs)("button",{onClick:b,disabled:!i.url||!i.displayName,className:"flex items-center px-4 py-2 rounded-md text-sm ".concat(i.url&&i.displayName?"bg-green-600 text-white hover:bg-green-700":"bg-gray-300 text-gray-500 cursor-not-allowed"),children:[(0,a.jsx)(I.Z,{className:"w-4 h-4 mr-1"}),"Add Link"]})})]})]}),(0,a.jsx)(Y.xv,{className:"text-sm font-medium text-gray-700 mb-2",children:"Manage Existing Links"}),(0,a.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)(Y.iA,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,a.jsx)(Y.ss,{children:(0,a.jsxs)(Y.SC,{children:[(0,a.jsx)(Y.xs,{className:"py-1 h-8",children:"Display Name"}),(0,a.jsx)(Y.xs,{className:"py-1 h-8",children:"URL"}),(0,a.jsx)(Y.xs,{className:"py-1 h-8",children:"Actions"})]})}),(0,a.jsxs)(Y.RM,{children:[t.map(e=>(0,a.jsx)(Y.SC,{className:"h-8",children:o&&o.id===e.id?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Y.pj,{className:"py-0.5",children:(0,a.jsx)("input",{type:"text",value:o.displayName,onChange:e=>m({...o,displayName:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,a.jsx)(Y.pj,{className:"py-0.5",children:(0,a.jsx)("input",{type:"text",value:o.url,onChange:e=>m({...o,url:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,a.jsx)(Y.pj,{className:"py-0.5 whitespace-nowrap",children:(0,a.jsxs)("div",{className:"flex space-x-2",children:[(0,a.jsx)("button",{onClick:f,className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:"Save"}),(0,a.jsx)("button",{onClick:y,className:"text-xs bg-gray-50 text-gray-600 px-2 py-1 rounded hover:bg-gray-100",children:"Cancel"})]})})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Y.pj,{className:"py-0.5 text-sm text-gray-900",children:e.displayName}),(0,a.jsx)(Y.pj,{className:"py-0.5 text-sm text-gray-500",children:e.url}),(0,a.jsx)(Y.pj,{className:"py-0.5 whitespace-nowrap",children:(0,a.jsxs)("div",{className:"flex space-x-2",children:[(0,a.jsx)("button",{onClick:()=>Z(e.url),className:"text-xs bg-green-50 text-green-600 px-2 py-1 rounded hover:bg-green-100",children:"Use"}),(0,a.jsx)("button",{onClick:()=>N(e),className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:(0,a.jsx)(R.Z,{className:"w-3 h-3"})}),(0,a.jsx)("button",{onClick:()=>w(e.id),className:"text-xs bg-red-50 text-red-600 px-2 py-1 rounded hover:bg-red-100",children:(0,a.jsx)(B.Z,{className:"w-3 h-3"})})]})})]})},e.id)),0===t.length&&(0,a.jsx)(Y.SC,{children:(0,a.jsx)(Y.pj,{colSpan:3,className:"py-0.5 text-sm text-gray-500 text-center",children:"No links added yet. Add a new link above."})})]})]})})})]})]})},W=e=>{var s,l,v,b;let{accessToken:N,publicPage:f,premiumUser:y,userRole:w}=e,[C,P]=(0,d.useState)(!1),[z,L]=(0,d.useState)(null),[D,O]=(0,d.useState)(!0),[U,T]=(0,d.useState)(!1),[H,I]=(0,d.useState)(!1),[R,B]=(0,d.useState)(null),[Y,W]=(0,d.useState)([]),[q,G]=(0,d.useState)(!1),[J,$]=(0,d.useState)(null),[Q,X]=(0,d.useState)(!1),[ee,es]=(0,d.useState)(!0),[el,ea]=(0,d.useState)(null),[et,er]=(0,d.useState)(!1),[en,ei]=(0,d.useState)(null),[ec,ed]=(0,d.useState)(!0),[eo,ex]=(0,d.useState)(null),[em,eh]=(0,d.useState)(!1),[eu,ep]=(0,d.useState)(!1),eg=(0,c.useRouter)(),ej=(0,d.useRef)(null),ev=(0,d.useRef)(null),eb=(0,d.useRef)(null);(0,d.useEffect)(()=>{let e=async e=>{try{O(!0);let s=await (0,_.modelHubCall)(e);console.log("ModelHubData:",s),L(s.data),(0,_.getConfigFieldSetting)(e,"enable_public_model_hub").then(e=>{console.log("data: ".concat(JSON.stringify(e))),!0==e.field_value&&P(!0)}).catch(e=>{})}catch(e){console.error("There was an error fetching the model data",e)}finally{O(!1)}},s=async()=>{try{var e,s;O(!0),await (0,_.getUiConfig)();let l=await (0,_.modelHubPublicModelsCall)();console.log("ModelHubData:",l),console.log("First model structure:",l[0]),console.log("Model has model_group?",null===(e=l[0])||void 0===e?void 0:e.model_group),console.log("Model has providers?",null===(s=l[0])||void 0===s?void 0:s.providers),L(l),P(!0)}catch(e){console.error("There was an error fetching the public model data",e)}finally{O(!1)}};N?e(N):f&&s()},[N,f]),(0,d.useEffect)(()=>{let e=async()=>{if(N)try{es(!0);let e=await (0,_.getAgentsList)(N);console.log("AgentHubData:",e);let s=e.agents.map(e=>({agent_id:e.agent_id,...e.agent_card_params,is_public:e.litellm_params.is_public}));$(s)}catch(e){console.error("There was an error fetching the agent data",e)}finally{es(!1)}};f||e()},[f,N]),(0,d.useEffect)(()=>{let e=async()=>{if(N)try{ed(!0);let e=await (0,_.fetchMCPServers)(N);console.log("MCPHubData:",e),ei(e)}catch(e){console.error("There was an error fetching the MCP server data",e)}finally{ed(!1)}};f||e()},[f,N]);let eN=()=>{N&&G(!0)},ef=()=>{N&&X(!0)},ey=()=>{N&&ep(!0)},e_=()=>{T(!1),I(!1),B(null),er(!1),ea(null),eh(!1),ex(null)},ek=()=>{T(!1),I(!1),B(null),er(!1),ea(null),eh(!1),ex(null)},ew=e=>{navigator.clipboard.writeText(e),k.Z.success("Copied to clipboard!")},eZ=e=>e.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),eC=e=>Object.entries(e).filter(e=>{let[s,l]=e;return s.startsWith("supports_")&&!0===l}).map(e=>{let[s]=e;return s}),eS=e=>"$".concat((1e6*e).toFixed(2)),eP=(0,d.useCallback)(e=>{W(e)},[]);return(console.log("publicPage: ",f),console.log("publicPageAllowed: ",C),f&&C)?(0,a.jsx)(K.Z,{accessToken:N}):(0,a.jsxs)("div",{className:"w-full mx-4 h-[75vh]",children:[!1==f?(0,a.jsxs)("div",{className:"w-full m-2 mt-2 p-8",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,a.jsxs)("div",{className:"flex flex-col items-start",children:[(0,a.jsx)(r.Dx,{className:"text-center",children:"AI Hub"}),(0,x.tY)(w||"")?(0,a.jsx)("p",{className:"text-sm text-gray-600",children:"Make models, agents, and MCP servers public for developers to know what's available."}):(0,a.jsx)("p",{className:"text-sm text-gray-600",children:"A list of all public model names personally available to you."})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,a.jsx)(r.xv,{children:"Model Hub URL:"}),(0,a.jsxs)("div",{className:"flex items-center bg-gray-200 px-2 py-1 rounded",children:[(0,a.jsx)(r.xv,{className:"mr-2",children:"".concat((0,_.getProxyBaseUrl)(),"/ui/model_hub_table")}),(0,a.jsx)("button",{onClick:()=>ew("".concat((0,_.getProxyBaseUrl)(),"/ui/model_hub_table")),className:"p-1 hover:bg-gray-300 rounded transition-colors",title:"Copy URL",children:(0,a.jsx)(i.Z,{size:16,className:"text-gray-600"})})]})]})]}),(0,x.tY)(w||"")&&(0,a.jsx)("div",{className:"mt-8 mb-2",children:(0,a.jsx)(V,{accessToken:N,userRole:w})}),(0,a.jsxs)(r.v0,{children:[(0,a.jsxs)(r.td,{className:"mb-4",children:[(0,a.jsx)(r.OK,{children:"Model Hub"}),(0,a.jsx)(r.OK,{children:"Agent Hub"}),(0,a.jsx)(r.OK,{children:"MCP Hub"})]}),(0,a.jsxs)(r.nP,{children:[(0,a.jsxs)(r.x4,{children:[(0,a.jsxs)(r.Zb,{children:[!1==f&&(0,x.tY)(w||"")&&(0,a.jsx)("div",{className:"flex justify-end mb-4",children:(0,a.jsx)(r.zx,{onClick:()=>eN(),children:"Select Models to Make Public"})}),(0,a.jsx)(M,{modelHubData:z||[],onFilteredDataChange:eP}),(0,a.jsx)(F.C,{columns:E(e=>{B(e),T(!0)},ew,f),data:Y,isLoading:D,table:ej,defaultSorting:[{id:"model_group",desc:!1}]})]}),(0,a.jsx)("div",{className:"mt-4 text-center space-y-2",children:(0,a.jsxs)(r.xv,{className:"text-sm text-gray-600",children:["Showing ",Y.length," of ",(null==z?void 0:z.length)||0," models"]})})]}),(0,a.jsxs)(r.x4,{children:[(0,a.jsxs)(r.Zb,{children:[!1==f&&(0,x.tY)(w||"")&&(0,a.jsx)("div",{className:"flex justify-end mb-4",children:(0,a.jsx)(r.zx,{onClick:()=>ef(),children:"Select Agents to Make Public"})}),(0,a.jsx)(F.C,{columns:function(e,s){return arguments.length>2&&void 0!==arguments[2]&&arguments[2],[{header:"Agent Name",accessorKey:"name",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,r=l.original;return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium text-sm",children:r.name}),(0,a.jsx)(p.Z,{title:"Copy agent name",children:(0,a.jsx)(t.Z,{onClick:()=>s(r.name),className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs"})})]}),(0,a.jsx)("div",{className:"md:hidden",children:(0,a.jsx)(u.Z,{className:"text-xs text-gray-600",children:r.description})})]})}},{header:"Description",accessorKey:"description",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)(u.Z,{className:"text-xs line-clamp-2",children:l.description||"-"})},meta:{className:"hidden md:table-cell"}},{header:"Version",accessorKey:"version",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsxs)(m.Z,{color:"blue",size:"sm",children:["v",l.version]})},meta:{className:"hidden lg:table-cell"}},{header:"Protocol",accessorKey:"protocolVersion",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)(u.Z,{className:"text-xs",children:l.protocolVersion||"-"})},meta:{className:"hidden lg:table-cell"}},{header:"Skills",accessorKey:"skills",enableSorting:!1,cell:e=>{let{row:s}=e,l=s.original.skills||[];return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)(u.Z,{className:"text-xs font-medium",children:[l.length," skill",1!==l.length?"s":""]}),l.length>0&&(0,a.jsxs)("div",{className:"flex flex-wrap gap-1",children:[l.slice(0,2).map(e=>(0,a.jsx)(g.Z,{color:"purple",className:"text-xs",children:e.name},e.id)),l.length>2&&(0,a.jsxs)(u.Z,{className:"text-xs text-gray-500",children:["+",l.length-2]})]})]})}},{header:"Capabilities",accessorKey:"capabilities",enableSorting:!1,cell:e=>{let{row:s}=e,l=Object.entries(s.original.capabilities||{}).filter(e=>{let[s,l]=e;return!0===l}).map(e=>{let[s]=e;return s});return(0,a.jsx)("div",{className:"flex flex-wrap gap-1",children:0===l.length?(0,a.jsx)(u.Z,{className:"text-gray-500 text-xs",children:"-"}):l.map(e=>(0,a.jsx)(m.Z,{color:"green",size:"xs",children:e},e))})}},{header:"I/O Modes",accessorKey:"defaultInputModes",enableSorting:!1,cell:e=>{let{row:s}=e,l=s.original,t=l.defaultInputModes||[],r=l.defaultOutputModes||[];return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)(u.Z,{className:"text-xs",children:[(0,a.jsx)("span",{className:"font-medium",children:"In:"})," ",t.join(", ")||"-"]}),(0,a.jsxs)(u.Z,{className:"text-xs",children:[(0,a.jsx)("span",{className:"font-medium",children:"Out:"})," ",r.join(", ")||"-"]})]})},meta:{className:"hidden xl:table-cell"}},{header:"Public",accessorKey:"is_public",enableSorting:!0,sortingFn:(e,s)=>(!0===e.original.is_public?1:0)-(!0===s.original.is_public?1:0),cell:e=>{let{row:s}=e;return console.log("CHECKPOINT 1: ".concat(JSON.stringify(s.original))),!0===s.original.is_public?(0,a.jsx)(m.Z,{color:"green",size:"xs",children:"Yes"}):(0,a.jsx)(m.Z,{color:"gray",size:"xs",children:"No"})},meta:{className:"hidden md:table-cell"}},{header:"Details",id:"details",enableSorting:!1,cell:s=>{let{row:l}=s,t=l.original;return(0,a.jsxs)(h.Z,{size:"xs",variant:"secondary",onClick:()=>e(t),icon:j.Z,children:[(0,a.jsx)("span",{className:"hidden lg:inline",children:"Details"}),(0,a.jsx)("span",{className:"lg:hidden",children:"Info"})]})}}]}(e=>{ea(e),er(!0)},ew,f),data:J||[],isLoading:ee,table:ev,defaultSorting:[{id:"name",desc:!1}]})]}),(0,a.jsx)("div",{className:"mt-4 text-center space-y-2",children:(0,a.jsxs)(r.xv,{className:"text-sm text-gray-600",children:["Showing ",(null==J?void 0:J.length)||0," agent",(null==J?void 0:J.length)!==1?"s":""]})})]}),(0,a.jsxs)(r.x4,{children:[(0,a.jsxs)(r.Zb,{children:[!1==f&&(0,x.tY)(w||"")&&(0,a.jsx)("div",{className:"flex justify-end mb-4",children:(0,a.jsx)(r.zx,{onClick:()=>ey(),children:"Select MCP Servers to Make Public"})}),(0,a.jsx)(F.C,{columns:function(e,s){return arguments.length>2&&void 0!==arguments[2]&&arguments[2],[{header:"Server Name",accessorKey:"server_name",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,r=l.original;return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium text-sm",children:r.server_name}),(0,a.jsx)(p.Z,{title:"Copy server name",children:(0,a.jsx)(t.Z,{onClick:()=>s(r.server_name),className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs"})})]}),(0,a.jsx)("div",{className:"md:hidden",children:(0,a.jsx)(u.Z,{className:"text-xs text-gray-600",children:r.description||"-"})})]})}},{header:"Description",accessorKey:"description",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)(u.Z,{className:"text-xs line-clamp-2",children:l.description||"-"})},meta:{className:"hidden md:table-cell"}},{header:"URL",accessorKey:"url",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,r=l.original;return(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"text-xs truncate max-w-xs",children:r.url}),(0,a.jsx)(p.Z,{title:"Copy URL",children:(0,a.jsx)(t.Z,{onClick:()=>s(r.url),className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs flex-shrink-0"})})]})},meta:{className:"hidden lg:table-cell"}},{header:"Transport",accessorKey:"transport",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)(m.Z,{color:"blue",size:"sm",children:l.transport})},meta:{className:"hidden md:table-cell"}},{header:"Auth Type",accessorKey:"auth_type",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original,t="none"===l.auth_type?"gray":"green";return(0,a.jsx)(m.Z,{color:t,size:"sm",children:l.auth_type})},meta:{className:"hidden md:table-cell"}},{header:"Status",accessorKey:"status",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original,t={active:"green",inactive:"red",unknown:"gray",healthy:"green",unhealthy:"red"}[l.status]||"gray";return(0,a.jsx)(m.Z,{color:t,size:"sm",children:l.status||"unknown"})}},{header:"Tools",accessorKey:"allowed_tools",enableSorting:!1,cell:e=>{let{row:s}=e,l=s.original.allowed_tools||[];return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(u.Z,{className:"text-xs font-medium",children:l.length>0?"".concat(l.length," tool").concat(1!==l.length?"s":""):"All tools"}),l.length>0&&(0,a.jsxs)("div",{className:"flex flex-wrap gap-1",children:[l.slice(0,2).map((e,s)=>(0,a.jsx)(g.Z,{color:"purple",className:"text-xs",children:e},s)),l.length>2&&(0,a.jsxs)(u.Z,{className:"text-xs text-gray-500",children:["+",l.length-2]})]})]})},meta:{className:"hidden lg:table-cell"}},{header:"Created By",accessorKey:"created_by",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)(u.Z,{className:"text-xs",children:l.created_by||"-"})},meta:{className:"hidden xl:table-cell"}},{header:"Public",accessorKey:"mcp_info.is_public",enableSorting:!0,sortingFn:(e,s)=>{var l,a;return((null===(l=e.original.mcp_info)||void 0===l?void 0:l.is_public)===!0?1:0)-((null===(a=s.original.mcp_info)||void 0===a?void 0:a.is_public)===!0?1:0)},cell:e=>{var s;let{row:l}=e;return(null===(s=l.original.mcp_info)||void 0===s?void 0:s.is_public)===!0?(0,a.jsx)(m.Z,{color:"green",size:"xs",children:"Yes"}):(0,a.jsx)(m.Z,{color:"gray",size:"xs",children:"No"})},meta:{className:"hidden md:table-cell"}},{header:"Details",id:"details",enableSorting:!1,cell:s=>{let{row:l}=s,t=l.original;return(0,a.jsxs)(h.Z,{size:"xs",variant:"secondary",onClick:()=>e(t),icon:j.Z,children:[(0,a.jsx)("span",{className:"hidden lg:inline",children:"Details"}),(0,a.jsx)("span",{className:"lg:hidden",children:"Info"})]})}}]}(e=>{ex(e),eh(!0)},ew,f),data:en||[],isLoading:ec,table:eb,defaultSorting:[{id:"server_name",desc:!1}]})]}),(0,a.jsx)("div",{className:"mt-4 text-center space-y-2",children:(0,a.jsxs)(r.xv,{className:"text-sm text-gray-600",children:["Showing ",(null==en?void 0:en.length)||0," MCP server",(null==en?void 0:en.length)!==1?"s":""]})})]})]})]})]}):(0,a.jsxs)(r.Zb,{className:"mx-auto max-w-xl mt-10",children:[(0,a.jsx)(r.xv,{className:"text-xl text-center mb-2 text-black",children:"Public Model Hub not enabled."}),(0,a.jsx)("p",{className:"text-base text-center text-slate-800",children:"Ask your proxy admin to enable this on their Admin UI."})]}),(0,a.jsx)(n.Z,{title:"Public Model Hub",width:600,visible:H,footer:null,onOk:e_,onCancel:ek,children:(0,a.jsxs)("div",{className:"pt-5 pb-5",children:[(0,a.jsxs)("div",{className:"flex justify-between mb-4",children:[(0,a.jsx)(r.xv,{className:"text-base mr-2",children:"Shareable Link:"}),(0,a.jsx)(r.xv,{className:"max-w-sm ml-2 bg-gray-200 pr-2 pl-2 pt-1 pb-1 text-center rounded",children:"".concat((0,_.getProxyBaseUrl)(),"/ui/model_hub_table")})]}),(0,a.jsx)("div",{className:"flex justify-end",children:(0,a.jsx)(r.zx,{onClick:()=>{eg.replace("/model_hub_table?key=".concat(N))},children:"See Page"})})]})}),(0,a.jsx)(n.Z,{title:(null==R?void 0:R.model_group)||"Model Details",width:1e3,visible:U,footer:null,onOk:e_,onCancel:ek,children:R&&(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Model Overview"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Model Group:"}),(0,a.jsx)(r.xv,{children:R.model_group})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Mode:"}),(0,a.jsx)(r.xv,{children:R.mode||"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Providers:"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:R.providers.map(e=>(0,a.jsx)(r.Ct,{color:"blue",children:e},e))})]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Token & Cost Information"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Max Input Tokens:"}),(0,a.jsx)(r.xv,{children:(null===(s=R.max_input_tokens)||void 0===s?void 0:s.toLocaleString())||"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Max Output Tokens:"}),(0,a.jsx)(r.xv,{children:(null===(l=R.max_output_tokens)||void 0===l?void 0:l.toLocaleString())||"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Input Cost per 1M Tokens:"}),(0,a.jsx)(r.xv,{children:R.input_cost_per_token?eS(R.input_cost_per_token):"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Output Cost per 1M Tokens:"}),(0,a.jsx)(r.xv,{children:R.output_cost_per_token?eS(R.output_cost_per_token):"Not specified"})]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Capabilities"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:(()=>{let e=eC(R),s=["green","blue","purple","orange","red","yellow"];return 0===e.length?(0,a.jsx)(r.xv,{className:"text-gray-500",children:"No special capabilities listed"}):e.map((e,l)=>(0,a.jsx)(r.Ct,{color:s[l%s.length],children:eZ(e)},e))})()})]}),(R.tpm||R.rpm)&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Rate Limits"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[R.tpm&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Tokens per Minute:"}),(0,a.jsx)(r.xv,{children:R.tpm.toLocaleString()})]}),R.rpm&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Requests per Minute:"}),(0,a.jsx)(r.xv,{children:R.rpm.toLocaleString()})]})]})]}),R.supported_openai_params&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Supported OpenAI Parameters"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:R.supported_openai_params.map(e=>(0,a.jsx)(r.Ct,{color:"green",children:e},e))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Usage Example"}),(0,a.jsx)(o.Z,{language:"python",className:"text-sm",children:'import openai\n\nclient = openai.OpenAI(\n api_key="your_api_key",\n base_url="http://0.0.0.0:4000" # Your LiteLLM Proxy URL\n)\n\nresponse = client.chat.completions.create(\n model="'.concat(R.model_group,'",\n messages=[\n {\n "role": "user",\n "content": "Hello, how are you?"\n }\n ]\n)\n\nprint(response.choices[0].message.content)')})]})]})}),(0,a.jsx)(n.Z,{title:(null==el?void 0:el.name)||"Agent Details",width:1e3,visible:et,footer:null,onOk:e_,onCancel:ek,children:el&&(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Agent Overview"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Name:"}),(0,a.jsx)(r.xv,{children:el.name})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Version:"}),(0,a.jsxs)(r.Ct,{color:"blue",children:["v",el.version]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Protocol Version:"}),(0,a.jsx)(r.xv,{children:el.protocolVersion})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"URL:"}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(r.xv,{className:"truncate",children:el.url}),(0,a.jsx)(t.Z,{onClick:()=>ew(el.url),className:"cursor-pointer text-gray-500 hover:text-blue-500"})]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Description:"}),(0,a.jsx)(r.xv,{className:"mt-1",children:el.description})]})]}),el.capabilities&&Object.keys(el.capabilities).length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Capabilities"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(el.capabilities).filter(e=>{let[s,l]=e;return!0===l}).map(e=>{let[s]=e;return(0,a.jsx)(r.Ct,{color:"green",children:s},s)})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Input/Output Modes"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Input Modes:"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:(null===(v=el.defaultInputModes)||void 0===v?void 0:v.map(e=>(0,a.jsx)(r.Ct,{color:"blue",children:e},e)))||(0,a.jsx)(r.xv,{children:"Not specified"})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Output Modes:"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:(null===(b=el.defaultOutputModes)||void 0===b?void 0:b.map(e=>(0,a.jsx)(r.Ct,{color:"purple",children:e},e)))||(0,a.jsx)(r.xv,{children:"Not specified"})})]})]})]}),el.skills&&el.skills.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Skills"}),(0,a.jsx)("div",{className:"space-y-4",children:el.skills.map(e=>(0,a.jsxs)("div",{className:"border border-gray-200 rounded p-4",children:[(0,a.jsxs)("div",{className:"flex justify-between items-start mb-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium text-base",children:e.name}),(0,a.jsxs)(r.xv,{className:"text-xs text-gray-500",children:["ID: ",e.id]})]}),e.tags&&e.tags.length>0&&(0,a.jsx)("div",{className:"flex flex-wrap gap-1",children:e.tags.map(e=>(0,a.jsx)(r.Ct,{color:"purple",size:"xs",children:e},e))})]}),(0,a.jsx)(r.xv,{className:"text-sm mb-2",children:e.description}),e.examples&&e.examples.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-xs font-medium text-gray-700",children:"Examples:"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:e.examples.map((e,s)=>(0,a.jsx)(r.Ct,{color:"gray",size:"xs",children:e},s))})]})]},e.id))})]}),el.supportsAuthenticatedExtendedCard&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Additional Features"}),(0,a.jsx)(r.Ct,{color:"green",children:"Supports Authenticated Extended Card"})]})]})}),(0,a.jsx)(n.Z,{title:(null==eo?void 0:eo.server_name)||"MCP Server Details",width:1e3,visible:em,footer:null,onOk:e_,onCancel:ek,children:eo&&(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Server Overview"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Server Name:"}),(0,a.jsx)(r.xv,{children:eo.server_name})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Server ID:"}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(r.xv,{className:"text-xs truncate",children:eo.server_id}),(0,a.jsx)(t.Z,{onClick:()=>ew(eo.server_id),className:"cursor-pointer text-gray-500 hover:text-blue-500"})]})]}),eo.alias&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Alias:"}),(0,a.jsx)(r.xv,{children:eo.alias})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Transport:"}),(0,a.jsx)(r.Ct,{color:"blue",children:eo.transport})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Auth Type:"}),(0,a.jsx)(r.Ct,{color:"none"===eo.auth_type?"gray":"green",children:eo.auth_type})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Status:"}),(0,a.jsx)(r.Ct,{color:"active"===eo.status||"healthy"===eo.status?"green":"inactive"===eo.status||"unhealthy"===eo.status?"red":"gray",children:eo.status||"unknown"})]})]}),eo.description&&(0,a.jsxs)("div",{className:"mt-2",children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Description:"}),(0,a.jsx)(r.xv,{className:"mt-1",children:eo.description})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Connection Details"}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"URL:"}),(0,a.jsxs)("div",{className:"flex items-center space-x-2 mt-1",children:[(0,a.jsx)(r.xv,{className:"text-sm break-all bg-gray-100 p-2 rounded flex-1",children:eo.url}),(0,a.jsx)(t.Z,{onClick:()=>ew(eo.url),className:"cursor-pointer text-gray-500 hover:text-blue-500 flex-shrink-0"})]})]}),eo.command&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Command:"}),(0,a.jsx)(r.xv,{className:"text-sm bg-gray-100 p-2 rounded mt-1 font-mono",children:eo.command})]})]})]}),eo.allowed_tools&&eo.allowed_tools.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Allowed Tools"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:eo.allowed_tools.map((e,s)=>(0,a.jsx)(r.Ct,{color:"purple",children:e},s))})]}),eo.teams&&eo.teams.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Teams"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:eo.teams.map((e,s)=>(0,a.jsx)(r.Ct,{color:"blue",children:e},s))})]}),eo.mcp_access_groups&&eo.mcp_access_groups.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Access Groups"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:eo.mcp_access_groups.map((e,s)=>(0,a.jsx)(r.Ct,{color:"green",children:e},s))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Metadata"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Created By:"}),(0,a.jsx)(r.xv,{children:eo.created_by})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Updated By:"}),(0,a.jsx)(r.xv,{children:eo.updated_by})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Created At:"}),(0,a.jsx)(r.xv,{className:"text-sm",children:new Date(eo.created_at).toLocaleString()})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Updated At:"}),(0,a.jsx)(r.xv,{className:"text-sm",children:new Date(eo.updated_at).toLocaleString()})]}),eo.last_health_check&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Last Health Check:"}),(0,a.jsx)(r.xv,{className:"text-sm",children:new Date(eo.last_health_check).toLocaleString()})]})]}),eo.health_check_error&&(0,a.jsxs)("div",{className:"mt-2 p-2 bg-red-50 rounded",children:[(0,a.jsx)(r.xv,{className:"font-medium text-red-700",children:"Health Check Error:"}),(0,a.jsx)(r.xv,{className:"text-sm text-red-600 mt-1",children:eo.health_check_error})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Usage Example"}),(0,a.jsx)(o.Z,{language:"python",className:"text-sm",children:'from fastmcp import Client\nimport asyncio\n\n# Standard MCP configuration\nconfig = {\n "mcpServers": {\n "'.concat(eo.server_name,'": {\n "url": "http://localhost:4000/').concat(eo.server_name,'/mcp",\n "headers": {\n "x-litellm-api-key": "Bearer sk-1234"\n }\n }\n }\n}\n\n# Create a client that connects to the server\nclient = Client(config)\n\nasync def main():\n async with client:\n # List available tools\n tools = await client.list_tools()\n print(f"Available tools: {[tool.name for tool in tools]}")\n\n # Call a tool\n response = await client.call_tool(\n name="tool_name", \n arguments={"arg": "value"}\n )\n print(f"Response: {response}")\n\nif __name__ == "__main__":\n asyncio.run(main())')})]})]})}),(0,a.jsx)(A,{visible:q,onClose:()=>G(!1),accessToken:N||"",modelHubData:z||[],onSuccess:()=>{N&&(async()=>{try{let e=await (0,_.modelHubCall)(N);L(e.data)}catch(e){console.error("Error refreshing model data:",e)}})()}}),(0,a.jsx)(Z,{visible:Q,onClose:()=>X(!1),accessToken:N||"",agentHubData:J||[],onSuccess:()=>{N&&(async()=>{try{let e=(await (0,_.getAgentsList)(N)).agents.map(e=>({agent_id:e.agent_id,...e.agent_card_params,is_public:e.is_public}));$(e)}catch(e){console.error("Error refreshing agent data:",e)}})()}}),(0,a.jsx)(S,{visible:eu,onClose:()=>ep(!1),accessToken:N||"",mcpHubData:en||[],onSuccess:()=>{N&&(async()=>{try{let e=await (0,_.fetchMCPServers)(N);ei(e)}catch(e){console.error("Error refreshing MCP server data:",e)}})()}})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2249-3be1a049d707c166.js b/litellm/proxy/_experimental/out/_next/static/chunks/2249-3be1a049d707c166.js new file mode 100644 index 00000000000..e255730d8cd --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/2249-3be1a049d707c166.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2249],{64748:function(e,s,l){l.d(s,{Ct:function(){return a.Z},Dx:function(){return m.Z},OK:function(){return n.Z},Zb:function(){return r.Z},nP:function(){return o.Z},td:function(){return c.Z},v0:function(){return i.Z},x4:function(){return d.Z},xv:function(){return x.Z},zx:function(){return t.Z}});var a=l(41649),t=l(78489),r=l(12514),n=l(12485),i=l(18135),c=l(35242),d=l(29706),o=l(77991),x=l(84264),m=l(96761)},78801:function(e,s,l){l.d(s,{Z:function(){return a.Z},x:function(){return t.Z}});var a=l(12514),t=l(84264)},92249:function(e,s,l){l.d(s,{Z:function(){return W}});var a=l(57437),t=l(23639),r=l(64748),n=l(22116),i=l(78867),c=l(99376),d=l(2265),o=l(17906),x=l(20347),m=l(41649),h=l(78489),u=l(84264),p=l(99981),g=l(3810),j=l(15424),v=l(15690),b=l(10032),N=l(61994),f=l(5545),y=l(96761),_=l(19250),k=l(9114);let{Step:w}=v.default;var Z=e=>{let{visible:s,onClose:l,accessToken:t,agentHubData:r,onSuccess:i}=e,[c,o]=(0,d.useState)(0),[x,h]=(0,d.useState)(new Set),[p,g]=(0,d.useState)(!1),[j]=b.Z.useForm(),Z=()=>{o(0),h(new Set),j.resetFields(),l()},C=(e,s)=>{let l=new Set(x);s?l.add(e):l.delete(e),h(l)},S=e=>{e?h(new Set(r.map(e=>e.agent_id||e.name))):h(new Set)};(0,d.useEffect)(()=>{s&&r.length>0&&h(new Set(r.filter(e=>!0===e.is_public).map(e=>e.agent_id||e.name)))},[s,r]);let P=async()=>{if(0===x.size){k.Z.fromBackend("Please select at least one agent to make public");return}g(!0);try{let e=Array.from(x);await (0,_.makeAgentsPublicCall)(t,e),k.Z.success("Successfully made ".concat(e.length," agent(s) public!")),Z(),i()}catch(e){console.error("Error making agents public:",e),k.Z.fromBackend("Failed to make agents public. Please try again.")}finally{g(!1)}},M=()=>{let e=r.length>0&&r.every(e=>x.has(e.agent_id||e.name)),s=x.size>0&&!e;return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)(y.Z,{children:"Select Agents to Make Public"}),(0,a.jsx)("div",{className:"flex items-center space-x-2",children:(0,a.jsxs)(N.Z,{checked:e,indeterminate:s,onChange:e=>S(e.target.checked),disabled:0===r.length,children:["Select All ",r.length>0&&"(".concat(r.length,")")]})})]}),(0,a.jsx)(u.Z,{className:"text-sm text-gray-600",children:"Select the agents you want to be visible on the public model hub. Users will still require a valid Virtual Key to use these agents."}),(0,a.jsx)("div",{className:"max-h-96 overflow-y-auto border rounded-lg p-4",children:(0,a.jsx)("div",{className:"space-y-3",children:0===r.length?(0,a.jsx)("div",{className:"text-center py-8 text-gray-500",children:(0,a.jsx)(u.Z,{children:"No agents available."})}):r.map(e=>{let s=e.agent_id||e.name;return(0,a.jsxs)("div",{className:"flex items-center space-x-3 p-3 border rounded-lg hover:bg-gray-50",children:[(0,a.jsx)(N.Z,{checked:x.has(s),onChange:e=>C(s,e.target.checked)}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:e.name}),(0,a.jsxs)(m.Z,{color:"blue",size:"sm",children:["v",e.version]})]}),(0,a.jsx)(u.Z,{className:"text-xs text-gray-600 mt-1",children:e.description}),e.skills&&e.skills.length>0&&(0,a.jsxs)("div",{className:"flex flex-wrap gap-1 mt-1",children:[e.skills.slice(0,3).map(e=>(0,a.jsx)(m.Z,{color:"purple",size:"xs",children:e.name},e.id)),e.skills.length>3&&(0,a.jsxs)(u.Z,{className:"text-xs text-gray-500",children:["+",e.skills.length-3," more"]})]})]})]},s)})})}),x.size>0&&(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:[(0,a.jsx)("strong",{children:x.size})," agent",1!==x.size?"s":""," selected"]})})]})},z=()=>(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(y.Z,{children:"Confirm Making Agents Public"}),(0,a.jsx)("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:(0,a.jsxs)(u.Z,{className:"text-sm text-yellow-800",children:[(0,a.jsx)("strong",{children:"Warning:"})," Once you make these agents public, anyone who can go to the"," ",(0,a.jsx)("code",{children:"/ui/model_hub_table"})," will be able to know they exist on the proxy."]})}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:"Agents to be made public:"}),(0,a.jsx)("div",{className:"max-h-48 overflow-y-auto border rounded-lg p-3",children:(0,a.jsx)("div",{className:"space-y-2",children:Array.from(x).map(e=>{let s=r.find(s=>(s.agent_id||s.name)===e);return(0,a.jsx)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:(null==s?void 0:s.name)||e}),s&&(0,a.jsxs)(m.Z,{color:"blue",size:"xs",children:["v",s.version]})]}),(null==s?void 0:s.description)&&(0,a.jsx)(u.Z,{className:"text-xs text-gray-600 mt-1",children:s.description})]})},e)})})})]}),(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:["Total: ",(0,a.jsx)("strong",{children:x.size})," agent",1!==x.size?"s":""," will be made public"]})})]});return(0,a.jsx)(n.Z,{title:"Make Agents Public",open:s,onCancel:Z,footer:null,width:1200,maskClosable:!1,children:(0,a.jsxs)(b.Z,{form:j,layout:"vertical",children:[(0,a.jsxs)(v.default,{current:c,className:"mb-6",children:[(0,a.jsx)(w,{title:"Select Agents"}),(0,a.jsx)(w,{title:"Confirm"})]}),(()=>{switch(c){case 0:return M();case 1:return z();default:return null}})(),(0,a.jsxs)("div",{className:"flex justify-between mt-6",children:[(0,a.jsx)(f.ZP,{onClick:0===c?Z:()=>{1===c&&o(0)},children:0===c?"Cancel":"Previous"}),(0,a.jsxs)("div",{className:"flex space-x-2",children:[0===c&&(0,a.jsx)(f.ZP,{onClick:()=>{if(0===c){if(0===x.size){k.Z.fromBackend("Please select at least one agent to make public");return}o(1)}},disabled:0===x.size,children:"Next"}),1===c&&(0,a.jsx)(f.ZP,{onClick:P,loading:p,children:"Make Public"})]})]})]})})};let{Step:C}=v.default;var S=e=>{let{visible:s,onClose:l,accessToken:t,mcpHubData:r,onSuccess:i}=e,[c,o]=(0,d.useState)(0),[x,h]=(0,d.useState)(new Set),[p,g]=(0,d.useState)(!1),[j]=b.Z.useForm(),w=()=>{o(0),h(new Set),j.resetFields(),l()},Z=(e,s)=>{let l=new Set(x);s?l.add(e):l.delete(e),h(l)},S=e=>{e?h(new Set(r.map(e=>e.server_id))):h(new Set)};(0,d.useEffect)(()=>{s&&r.length>0&&h(new Set(r.filter(e=>{var s;return(null===(s=e.mcp_info)||void 0===s?void 0:s.is_public)===!0}).map(e=>e.server_id)))},[s]);let P=async()=>{if(0===x.size){k.Z.fromBackend("Please select at least one MCP server to make public");return}g(!0);try{let e=Array.from(x);await (0,_.makeMCPPublicCall)(t,e),k.Z.success("Successfully made ".concat(e.length," MCP server(s) public!")),w(),i()}catch(e){console.error("Error making MCP servers public:",e),k.Z.fromBackend("Failed to make MCP servers public. Please try again.")}finally{g(!1)}},M=()=>{let e=r.length>0&&r.every(e=>x.has(e.server_id)),s=x.size>0&&!e;return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)(y.Z,{children:"Select MCP Servers to Make Public"}),(0,a.jsx)("div",{className:"flex items-center space-x-2",children:(0,a.jsxs)(N.Z,{checked:e,indeterminate:s,onChange:e=>S(e.target.checked),disabled:0===r.length,children:["Select All ",r.length>0&&"(".concat(r.length,")")]})})]}),(0,a.jsx)(u.Z,{className:"text-sm text-gray-600",children:"Select the MCP servers you want to be visible on the public model hub. Users will still require a valid Virtual Key to use these servers."}),(0,a.jsx)("div",{className:"max-h-96 overflow-y-auto border rounded-lg p-4",children:(0,a.jsx)("div",{className:"space-y-3",children:0===r.length?(0,a.jsx)("div",{className:"text-center py-8 text-gray-500",children:(0,a.jsx)(u.Z,{children:"No MCP servers available."})}):r.map(e=>{var s;let l=(null===(s=e.mcp_info)||void 0===s?void 0:s.is_public)===!0;return(0,a.jsxs)("div",{className:"flex items-center space-x-3 p-3 border rounded-lg hover:bg-gray-50",children:[(0,a.jsx)(N.Z,{checked:x.has(e.server_id),onChange:s=>Z(e.server_id,s.target.checked)}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:e.server_name}),l&&(0,a.jsx)(m.Z,{color:"emerald",size:"sm",children:"Public"}),(0,a.jsx)(m.Z,{color:"blue",size:"sm",children:e.transport}),(0,a.jsx)(m.Z,{color:"active"===e.status||"healthy"===e.status?"green":"inactive"===e.status||"unhealthy"===e.status?"red":"gray",size:"sm",children:e.status||"unknown"})]}),(0,a.jsx)(u.Z,{className:"text-xs text-gray-600 mt-1",children:e.description||e.url}),e.allowed_tools&&e.allowed_tools.length>0&&(0,a.jsxs)("div",{className:"flex flex-wrap gap-1 mt-1",children:[e.allowed_tools.slice(0,3).map((e,s)=>(0,a.jsx)(m.Z,{color:"purple",size:"xs",children:e},s)),e.allowed_tools.length>3&&(0,a.jsxs)(u.Z,{className:"text-xs text-gray-500",children:["+",e.allowed_tools.length-3," more"]})]})]})]},e.server_id)})})}),x.size>0&&(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:[(0,a.jsx)("strong",{children:x.size})," MCP server",1!==x.size?"s":""," selected"]})})]})},z=()=>(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(y.Z,{children:"Confirm Making MCP Servers Public"}),(0,a.jsx)("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:(0,a.jsxs)(u.Z,{className:"text-sm text-yellow-800",children:[(0,a.jsx)("strong",{children:"Warning:"})," Once you make these MCP servers public, anyone who can go to the"," ",(0,a.jsx)("code",{children:"/ui/model_hub_table"})," will be able to know they exist on the proxy."]})}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:"MCP Servers to be made public:"}),(0,a.jsx)("div",{className:"max-h-48 overflow-y-auto border rounded-lg p-3",children:(0,a.jsx)("div",{className:"space-y-2",children:Array.from(x).map(e=>{let s=r.find(s=>s.server_id===e);return(0,a.jsx)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:(null==s?void 0:s.server_name)||e}),s&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(m.Z,{color:"blue",size:"xs",children:s.transport}),(0,a.jsx)(m.Z,{color:"active"===s.status||"healthy"===s.status?"green":"inactive"===s.status||"unhealthy"===s.status?"red":"gray",size:"xs",children:s.status||"unknown"})]})]}),(null==s?void 0:s.description)&&(0,a.jsx)(u.Z,{className:"text-xs text-gray-600 mt-1",children:s.description}),(null==s?void 0:s.url)&&(0,a.jsx)(u.Z,{className:"text-xs text-gray-500 mt-1",children:s.url})]})},e)})})})]}),(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:["Total: ",(0,a.jsx)("strong",{children:x.size})," MCP server",1!==x.size?"s":""," will be made public"]})})]});return(0,a.jsx)(n.Z,{title:"Make MCP Servers Public",open:s,onCancel:w,footer:null,width:1200,maskClosable:!1,children:(0,a.jsxs)(b.Z,{form:j,layout:"vertical",children:[(0,a.jsxs)(v.default,{current:c,className:"mb-6",children:[(0,a.jsx)(C,{title:"Select Servers"}),(0,a.jsx)(C,{title:"Confirm"})]}),(()=>{switch(c){case 0:return M();case 1:return z();default:return null}})(),(0,a.jsxs)("div",{className:"flex justify-between mt-6",children:[(0,a.jsx)(f.ZP,{onClick:0===c?w:()=>{1===c&&o(0)},children:0===c?"Cancel":"Previous"}),(0,a.jsxs)("div",{className:"flex space-x-2",children:[0===c&&(0,a.jsx)(f.ZP,{onClick:()=>{if(0===c){if(0===x.size){k.Z.fromBackend("Please select at least one MCP server to make public");return}o(1)}},disabled:0===x.size,children:"Next"}),1===c&&(0,a.jsx)(f.ZP,{onClick:P,loading:p,children:"Make Public"})]})]})]})})},P=l(78801),M=e=>{let{modelHubData:s,onFilteredDataChange:l,showFiltersCard:t=!0,className:r=""}=e,[n,i]=(0,d.useState)(""),[c,o]=(0,d.useState)(""),[x,m]=(0,d.useState)(""),[h,u]=(0,d.useState)(""),p=(0,d.useRef)([]),g=(0,d.useMemo)(()=>(null==s?void 0:s.filter(e=>{let s=e.model_group.toLowerCase().includes(n.toLowerCase()),l=""===c||e.providers.includes(c),a=""===x||e.mode===x,t=""===h||Object.entries(e).filter(e=>{let[s,l]=e;return s.startsWith("supports_")&&!0===l}).some(e=>{let[s]=e;return s.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")===h});return s&&l&&a&&t}))||[],[s,n,c,x,h]);(0,d.useEffect)(()=>{(g.length!==p.current.length||g.some((e,s)=>{var l;return e.model_group!==(null===(l=p.current[s])||void 0===l?void 0:l.model_group)}))&&(p.current=g,l(g))},[g,l]);let j=(0,a.jsxs)("div",{className:"flex flex-wrap gap-4 items-center",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(P.x,{className:"text-sm font-medium mb-2",children:"Search Models:"}),(0,a.jsx)("input",{type:"text",placeholder:"Search model names...",value:n,onChange:e=>i(e.target.value),className:"border rounded px-3 py-2 w-64 h-10 text-sm"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(P.x,{className:"text-sm font-medium mb-2",children:"Provider:"}),(0,a.jsxs)("select",{value:c,onChange:e=>o(e.target.value),className:"border rounded px-3 py-2 text-sm text-gray-600 w-40 h-10",children:[(0,a.jsx)("option",{value:"",className:"text-sm text-gray-600",children:"All Providers"}),s&&(e=>{let s=new Set;return e.forEach(e=>{e.providers.forEach(e=>s.add(e))}),Array.from(s)})(s).map(e=>(0,a.jsx)("option",{value:e,className:"text-sm text-gray-800",children:e},e))]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(P.x,{className:"text-sm font-medium mb-2",children:"Mode:"}),(0,a.jsxs)("select",{value:x,onChange:e=>m(e.target.value),className:"border rounded px-3 py-2 text-sm text-gray-600 w-32 h-10",children:[(0,a.jsx)("option",{value:"",className:"text-sm text-gray-600",children:"All Modes"}),s&&(e=>{let s=new Set;return e.forEach(e=>{e.mode&&s.add(e.mode)}),Array.from(s)})(s).map(e=>(0,a.jsx)("option",{value:e,className:"text-sm text-gray-800",children:e},e))]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(P.x,{className:"text-sm font-medium mb-2",children:"Features:"}),(0,a.jsxs)("select",{value:h,onChange:e=>u(e.target.value),className:"border rounded px-3 py-2 text-sm text-gray-600 w-48 h-10",children:[(0,a.jsx)("option",{value:"",className:"text-sm text-gray-600",children:"All Features"}),s&&(e=>{let s=new Set;return e.forEach(e=>{Object.entries(e).filter(e=>{let[s,l]=e;return s.startsWith("supports_")&&!0===l}).forEach(e=>{let[l]=e,a=l.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");s.add(a)})}),Array.from(s).sort()})(s).map(e=>(0,a.jsx)("option",{value:e,className:"text-sm text-gray-800",children:e},e))]})]}),(n||c||x||h)&&(0,a.jsx)("div",{className:"flex items-end",children:(0,a.jsx)("button",{onClick:()=>{i(""),o(""),m(""),u("")},className:"text-blue-600 hover:text-blue-800 text-sm underline h-10 flex items-center",children:"Clear Filters"})})]});return t?(0,a.jsx)(P.Z,{className:"mb-6 ".concat(r),children:j}):(0,a.jsx)("div",{className:r,children:j})};let{Step:z}=v.default;var A=e=>{let{visible:s,onClose:l,accessToken:t,modelHubData:r,onSuccess:i}=e,[c,o]=(0,d.useState)(0),[x,h]=(0,d.useState)(new Set),[p,g]=(0,d.useState)([]),[j,w]=(0,d.useState)(!1),[Z]=b.Z.useForm(),C=()=>{o(0),h(new Set),g([]),Z.resetFields(),l()},S=(e,s)=>{let l=new Set(x);s?l.add(e):l.delete(e),h(l)},P=e=>{e?h(new Set(p.map(e=>e.model_group))):h(new Set)},A=(0,d.useCallback)(e=>{g(e)},[]);(0,d.useEffect)(()=>{s&&r.length>0&&(g(r),h(new Set(r.filter(e=>!0===e.is_public_model_group).map(e=>e.model_group))))},[s,r]);let F=async()=>{if(0===x.size){k.Z.fromBackend("Please select at least one model to make public");return}w(!0);try{let e=Array.from(x);await (0,_.makeModelGroupPublic)(t,e),k.Z.success("Successfully made ".concat(e.length," model group(s) public!")),C(),i()}catch(e){console.error("Error making model groups public:",e),k.Z.fromBackend("Failed to make model groups public. Please try again.")}finally{w(!1)}},L=()=>{let e=p.length>0&&p.every(e=>x.has(e.model_group)),s=x.size>0&&!e;return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)(y.Z,{children:"Select Models to Make Public"}),(0,a.jsx)("div",{className:"flex items-center space-x-2",children:(0,a.jsxs)(N.Z,{checked:e,indeterminate:s,onChange:e=>P(e.target.checked),disabled:0===p.length,children:["Select All ",p.length>0&&"(".concat(p.length,")")]})})]}),(0,a.jsx)(u.Z,{className:"text-sm text-gray-600",children:"Select the models you want to be visible on the public model hub. Users will still require a valid Virtual Key to use these models."}),(0,a.jsx)(M,{modelHubData:r,onFilteredDataChange:A,showFiltersCard:!1,className:"border rounded-lg p-4 bg-gray-50"}),(0,a.jsx)("div",{className:"max-h-96 overflow-y-auto border rounded-lg p-4",children:(0,a.jsx)("div",{className:"space-y-3",children:0===p.length?(0,a.jsx)("div",{className:"text-center py-8 text-gray-500",children:(0,a.jsx)(u.Z,{children:"No models match the current filters."})}):p.map(e=>(0,a.jsxs)("div",{className:"flex items-center space-x-3 p-3 border rounded-lg hover:bg-gray-50",children:[(0,a.jsx)(N.Z,{checked:x.has(e.model_group),onChange:s=>S(e.model_group,s.target.checked)}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:e.model_group}),e.mode&&(0,a.jsx)(m.Z,{color:"green",size:"sm",children:e.mode})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:e.providers.map(e=>(0,a.jsx)(m.Z,{color:"blue",size:"xs",children:e},e))})]})]},e.model_group))})}),x.size>0&&(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:[(0,a.jsx)("strong",{children:x.size})," model",1!==x.size?"s":""," selected"]})})]})},D=()=>(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(y.Z,{children:"Confirm Making Models Public"}),(0,a.jsx)("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:(0,a.jsxs)(u.Z,{className:"text-sm text-yellow-800",children:[(0,a.jsx)("strong",{children:"Warning:"})," Once you make these models public, anyone who can go to the"," ",(0,a.jsx)("code",{children:"/ui/model_hub_table"})," will be able to know they exist on the proxy."]})}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)(u.Z,{className:"font-medium",children:"Models to be made public:"}),(0,a.jsx)("div",{className:"max-h-48 overflow-y-auto border rounded-lg p-3",children:(0,a.jsx)("div",{className:"space-y-2",children:Array.from(x).map(e=>{let s=r.find(s=>s.model_group===e);return(0,a.jsx)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:(0,a.jsxs)("div",{children:[(0,a.jsx)(u.Z,{className:"font-medium",children:e}),s&&(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:s.providers.map(e=>(0,a.jsx)(m.Z,{color:"blue",size:"xs",children:e},e))})]})},e)})})})]}),(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,a.jsxs)(u.Z,{className:"text-sm text-blue-800",children:["Total: ",(0,a.jsx)("strong",{children:x.size})," model",1!==x.size?"s":""," will be made public"]})})]});return(0,a.jsx)(n.Z,{title:"Make Models Public",open:s,onCancel:C,footer:null,width:1200,maskClosable:!1,children:(0,a.jsxs)(b.Z,{form:Z,layout:"vertical",children:[(0,a.jsxs)(v.default,{current:c,className:"mb-6",children:[(0,a.jsx)(z,{title:"Select Models"}),(0,a.jsx)(z,{title:"Confirm"})]}),(()=>{switch(c){case 0:return L();case 1:return D();default:return null}})(),(0,a.jsxs)("div",{className:"flex justify-between mt-6",children:[(0,a.jsx)(f.ZP,{onClick:0===c?C:()=>{1===c&&o(0)},children:0===c?"Cancel":"Previous"}),(0,a.jsxs)("div",{className:"flex space-x-2",children:[0===c&&(0,a.jsx)(f.ZP,{onClick:()=>{if(0===c){if(0===x.size){k.Z.fromBackend("Please select at least one model to make public");return}o(1)}},disabled:0===x.size,children:"Next"}),1===c&&(0,a.jsx)(f.ZP,{onClick:F,loading:j,children:"Make Public"})]})]})]})})},F=l(8048);let L=e=>e.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),D=e=>Object.entries(e).filter(e=>{let[s,l]=e;return s.startsWith("supports_")&&!0===l}).map(e=>{let[s]=e;return s}),O=e=>"$".concat((1e6*e).toFixed(2)),K=e=>e>=1e6?"".concat((e/1e6).toFixed(1),"M"):e>=1e3?"".concat((e/1e3).toFixed(1),"K"):e.toString(),U=function(e,s){let l=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=[{header:"Public Model Name",accessorKey:"model_group",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,r=l.original;return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium text-sm",children:r.model_group}),(0,a.jsx)(p.Z,{title:"Copy model name",children:(0,a.jsx)(t.Z,{onClick:()=>s(r.model_group),className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs"})})]}),(0,a.jsx)("div",{className:"md:hidden",children:(0,a.jsx)(u.Z,{className:"text-xs text-gray-600",children:r.providers.join(", ")})})]})}},{header:"Provider",accessorKey:"providers",enableSorting:!0,sortingFn:(e,s)=>{let l=e.original.providers.join(", "),a=s.original.providers.join(", ");return l.localeCompare(a)},cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsxs)("div",{className:"flex flex-wrap gap-1",children:[l.providers.slice(0,2).map(e=>(0,a.jsx)(g.Z,{color:"blue",className:"text-xs",children:e},e)),l.providers.length>2&&(0,a.jsxs)(u.Z,{className:"text-xs text-gray-500",children:["+",l.providers.length-2]})]})},meta:{className:"hidden md:table-cell"}},{header:"Mode",accessorKey:"mode",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return l.mode?(0,a.jsx)(m.Z,{color:"green",size:"sm",children:l.mode}):(0,a.jsx)(u.Z,{className:"text-gray-500",children:"-"})},meta:{className:"hidden lg:table-cell"}},{header:"Tokens",accessorKey:"max_input_tokens",enableSorting:!0,sortingFn:(e,s)=>(e.original.max_input_tokens||0)+(e.original.max_output_tokens||0)-((s.original.max_input_tokens||0)+(s.original.max_output_tokens||0)),cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)("div",{className:"space-y-1",children:(0,a.jsxs)(u.Z,{className:"text-xs",children:[l.max_input_tokens?K(l.max_input_tokens):"-"," /"," ",l.max_output_tokens?K(l.max_output_tokens):"-"]})})},meta:{className:"hidden lg:table-cell"}},{header:"Cost/1M",accessorKey:"input_cost_per_token",enableSorting:!0,sortingFn:(e,s)=>(e.original.input_cost_per_token||0)+(e.original.output_cost_per_token||0)-((s.original.input_cost_per_token||0)+(s.original.output_cost_per_token||0)),cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(u.Z,{className:"text-xs",children:l.input_cost_per_token?O(l.input_cost_per_token):"-"}),(0,a.jsx)(u.Z,{className:"text-xs text-gray-500",children:l.output_cost_per_token?O(l.output_cost_per_token):"-"})]})}},{header:"Features",accessorKey:"capabilities",enableSorting:!1,cell:e=>{let{row:s}=e,l=D(s.original),t=["green","blue","purple","orange","red","yellow"];return(0,a.jsx)("div",{className:"flex flex-wrap gap-1",children:0===l.length?(0,a.jsx)(u.Z,{className:"text-gray-500 text-xs",children:"-"}):l.map((e,s)=>(0,a.jsx)(m.Z,{color:t[s%t.length],size:"xs",children:L(e)},e))})}},{header:"Public",accessorKey:"is_public_model_group",enableSorting:!0,sortingFn:(e,s)=>(!0===e.original.is_public_model_group?1:0)-(!0===s.original.is_public_model_group?1:0),cell:e=>{let{row:s}=e;return!0===s.original.is_public_model_group?(0,a.jsx)(m.Z,{color:"green",size:"xs",children:"Yes"}):(0,a.jsx)(m.Z,{color:"gray",size:"xs",children:"No"})},meta:{className:"hidden md:table-cell"}},{header:"Details",id:"details",enableSorting:!1,cell:s=>{let{row:l}=s,t=l.original;return(0,a.jsxs)(h.Z,{size:"xs",variant:"secondary",onClick:()=>e(t),icon:j.Z,children:[(0,a.jsx)("span",{className:"hidden lg:inline",children:"Details"}),(0,a.jsx)("span",{className:"lg:hidden",children:"Info"})]})}}];return l?r.filter(e=>!("accessorKey"in e)||"is_public_model_group"!==e.accessorKey):r};var E=l(87526),T=l(86462),H=l(47686),R=l(77355),B=l(93416),I=l(74998),Y=l(95704),V=e=>{let{accessToken:s,userRole:l}=e,[t,r]=(0,d.useState)([]),[i,c]=(0,d.useState)({url:"",displayName:""}),[o,m]=(0,d.useState)(null),[h,u]=(0,d.useState)(!1),[p,g]=(0,d.useState)(!0),j=async()=>{if(s)try{u(!0);let e=await (0,_.getPublicModelHubInfo)();if(e&&e.useful_links){let s=e.useful_links||{},l=Object.entries(s).map((e,s)=>{let[l,a]=e;return{id:"".concat(s,"-").concat(l),displayName:l,url:a}});r(l)}else r([])}catch(e){console.error("Error fetching useful links:",e),r([])}finally{u(!1)}};if((0,d.useEffect)(()=>{j()},[s]),!(0,x.tY)(l||""))return null;let v=async e=>{if(!s)return!1;try{let l={};return e.forEach(e=>{l[e.displayName]=e.url}),await (0,_.updateUsefulLinksCall)(s,l),n.Z.success({title:"Links Saved Successfully",content:(0,a.jsxs)("div",{className:"py-4",children:[(0,a.jsx)("p",{className:"text-gray-600 mb-4",children:"Your useful links have been saved and are now visible on the public model hub."}),(0,a.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:[(0,a.jsx)("p",{className:"text-sm text-blue-800 mb-2 font-medium",children:"View your updated model hub:"}),(0,a.jsx)("a",{href:"".concat((0,_.getProxyBaseUrl)(),"/ui/model_hub_table"),target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center text-blue-600 hover:text-blue-800 underline text-sm font-medium",children:"Open Public Model Hub →"})]})]}),width:500,okText:"Close",maskClosable:!0,keyboard:!0}),!0}catch(e){return console.error("Error saving links:",e),k.Z.fromBackend("Failed to save links - ".concat(e)),!1}},b=async()=>{if(!i.url||!i.displayName)return;try{new URL(i.url)}catch(e){k.Z.fromBackend("Please enter a valid URL");return}if(t.some(e=>e.displayName===i.displayName)){k.Z.fromBackend("A link with this display name already exists");return}let e=[...t,{id:"".concat(Date.now(),"-").concat(i.displayName),displayName:i.displayName,url:i.url}];await v(e)&&(r(e),c({url:"",displayName:""}),k.Z.success("Link added successfully"))},N=e=>{m({...e})},f=async()=>{if(!o)return;try{new URL(o.url)}catch(e){k.Z.fromBackend("Please enter a valid URL");return}if(t.some(e=>e.id!==o.id&&e.displayName===o.displayName)){k.Z.fromBackend("A link with this display name already exists");return}let e=t.map(e=>e.id===o.id?o:e);await v(e)&&(r(e),m(null),k.Z.success("Link updated successfully"))},y=()=>{m(null)},w=async e=>{let s=t.filter(s=>s.id!==e);await v(s)&&(r(s),k.Z.success("Link deleted successfully"))},Z=e=>{window.open(e,"_blank")};return(0,a.jsxs)(Y.Zb,{className:"mb-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between cursor-pointer",onClick:()=>g(!p),children:[(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)(Y.Dx,{className:"mb-0",children:"Link Management"}),(0,a.jsx)("p",{className:"text-sm text-gray-500",children:"Manage the links that are displayed under 'Useful Links' on the public model hub."})]}),(0,a.jsx)("div",{className:"flex items-center",children:p?(0,a.jsx)(T.Z,{className:"w-5 h-5 text-gray-500"}):(0,a.jsx)(H.Z,{className:"w-5 h-5 text-gray-500"})})]}),p&&(0,a.jsxs)("div",{className:"mt-4",children:[(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsx)(Y.xv,{className:"text-sm font-medium text-gray-700 mb-2",children:"Add New Link"}),(0,a.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"URL"}),(0,a.jsx)("input",{type:"text",value:i.url,onChange:e=>c({...i,url:e.target.value}),placeholder:"https://example.com",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Display Name"}),(0,a.jsx)("input",{type:"text",value:i.displayName,onChange:e=>c({...i,displayName:e.target.value}),placeholder:"Friendly name",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,a.jsx)("div",{className:"flex items-end",children:(0,a.jsxs)("button",{onClick:b,disabled:!i.url||!i.displayName,className:"flex items-center px-4 py-2 rounded-md text-sm ".concat(i.url&&i.displayName?"bg-green-600 text-white hover:bg-green-700":"bg-gray-300 text-gray-500 cursor-not-allowed"),children:[(0,a.jsx)(R.Z,{className:"w-4 h-4 mr-1"}),"Add Link"]})})]})]}),(0,a.jsx)(Y.xv,{className:"text-sm font-medium text-gray-700 mb-2",children:"Manage Existing Links"}),(0,a.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)(Y.iA,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,a.jsx)(Y.ss,{children:(0,a.jsxs)(Y.SC,{children:[(0,a.jsx)(Y.xs,{className:"py-1 h-8",children:"Display Name"}),(0,a.jsx)(Y.xs,{className:"py-1 h-8",children:"URL"}),(0,a.jsx)(Y.xs,{className:"py-1 h-8",children:"Actions"})]})}),(0,a.jsxs)(Y.RM,{children:[t.map(e=>(0,a.jsx)(Y.SC,{className:"h-8",children:o&&o.id===e.id?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Y.pj,{className:"py-0.5",children:(0,a.jsx)("input",{type:"text",value:o.displayName,onChange:e=>m({...o,displayName:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,a.jsx)(Y.pj,{className:"py-0.5",children:(0,a.jsx)("input",{type:"text",value:o.url,onChange:e=>m({...o,url:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,a.jsx)(Y.pj,{className:"py-0.5 whitespace-nowrap",children:(0,a.jsxs)("div",{className:"flex space-x-2",children:[(0,a.jsx)("button",{onClick:f,className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:"Save"}),(0,a.jsx)("button",{onClick:y,className:"text-xs bg-gray-50 text-gray-600 px-2 py-1 rounded hover:bg-gray-100",children:"Cancel"})]})})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Y.pj,{className:"py-0.5 text-sm text-gray-900",children:e.displayName}),(0,a.jsx)(Y.pj,{className:"py-0.5 text-sm text-gray-500",children:e.url}),(0,a.jsx)(Y.pj,{className:"py-0.5 whitespace-nowrap",children:(0,a.jsxs)("div",{className:"flex space-x-2",children:[(0,a.jsx)("button",{onClick:()=>Z(e.url),className:"text-xs bg-green-50 text-green-600 px-2 py-1 rounded hover:bg-green-100",children:"Use"}),(0,a.jsx)("button",{onClick:()=>N(e),className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:(0,a.jsx)(B.Z,{className:"w-3 h-3"})}),(0,a.jsx)("button",{onClick:()=>w(e.id),className:"text-xs bg-red-50 text-red-600 px-2 py-1 rounded hover:bg-red-100",children:(0,a.jsx)(I.Z,{className:"w-3 h-3"})})]})})]})},e.id)),0===t.length&&(0,a.jsx)(Y.SC,{children:(0,a.jsx)(Y.pj,{colSpan:3,className:"py-0.5 text-sm text-gray-500 text-center",children:"No links added yet. Add a new link above."})})]})]})})})]})]})},W=e=>{var s,l,v,b;let{accessToken:N,publicPage:f,premiumUser:y,userRole:w}=e,[C,P]=(0,d.useState)(!1),[z,L]=(0,d.useState)(null),[D,O]=(0,d.useState)(!0),[K,T]=(0,d.useState)(!1),[H,R]=(0,d.useState)(!1),[B,I]=(0,d.useState)(null),[Y,W]=(0,d.useState)([]),[q,G]=(0,d.useState)(!1),[J,$]=(0,d.useState)(null),[Q,X]=(0,d.useState)(!1),[ee,es]=(0,d.useState)(!0),[el,ea]=(0,d.useState)(null),[et,er]=(0,d.useState)(!1),[en,ei]=(0,d.useState)(null),[ec,ed]=(0,d.useState)(!0),[eo,ex]=(0,d.useState)(null),[em,eh]=(0,d.useState)(!1),[eu,ep]=(0,d.useState)(!1),eg=(0,c.useRouter)(),ej=(0,d.useRef)(null),ev=(0,d.useRef)(null),eb=(0,d.useRef)(null);(0,d.useEffect)(()=>{let e=async e=>{try{O(!0);let s=await (0,_.modelHubCall)(e);console.log("ModelHubData:",s),L(s.data),(0,_.getConfigFieldSetting)(e,"enable_public_model_hub").then(e=>{console.log("data: ".concat(JSON.stringify(e))),!0==e.field_value&&P(!0)}).catch(e=>{})}catch(e){console.error("There was an error fetching the model data",e)}finally{O(!1)}},s=async()=>{try{var e,s;O(!0),await (0,_.getUiConfig)();let l=await (0,_.modelHubPublicModelsCall)();console.log("ModelHubData:",l),console.log("First model structure:",l[0]),console.log("Model has model_group?",null===(e=l[0])||void 0===e?void 0:e.model_group),console.log("Model has providers?",null===(s=l[0])||void 0===s?void 0:s.providers),L(l),P(!0)}catch(e){console.error("There was an error fetching the public model data",e)}finally{O(!1)}};N?e(N):f&&s()},[N,f]),(0,d.useEffect)(()=>{let e=async()=>{if(N)try{es(!0);let e=await (0,_.getAgentsList)(N);console.log("AgentHubData:",e);let s=e.agents.map(e=>({agent_id:e.agent_id,...e.agent_card_params,is_public:e.litellm_params.is_public}));$(s)}catch(e){console.error("There was an error fetching the agent data",e)}finally{es(!1)}};f||e()},[f,N]),(0,d.useEffect)(()=>{let e=async()=>{if(N)try{ed(!0);let e=await (0,_.fetchMCPServers)(N);console.log("MCPHubData:",e),ei(e)}catch(e){console.error("There was an error fetching the MCP server data",e)}finally{ed(!1)}};f||e()},[f,N]);let eN=()=>{N&&G(!0)},ef=()=>{N&&X(!0)},ey=()=>{N&&ep(!0)},e_=()=>{T(!1),R(!1),I(null),er(!1),ea(null),eh(!1),ex(null)},ek=()=>{T(!1),R(!1),I(null),er(!1),ea(null),eh(!1),ex(null)},ew=e=>{navigator.clipboard.writeText(e),k.Z.success("Copied to clipboard!")},eZ=e=>e.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),eC=e=>Object.entries(e).filter(e=>{let[s,l]=e;return s.startsWith("supports_")&&!0===l}).map(e=>{let[s]=e;return s}),eS=e=>"$".concat((1e6*e).toFixed(2)),eP=(0,d.useCallback)(e=>{W(e)},[]);return(console.log("publicPage: ",f),console.log("publicPageAllowed: ",C),f&&C)?(0,a.jsx)(E.Z,{accessToken:N}):(0,a.jsxs)("div",{className:"w-full mx-4 h-[75vh]",children:[!1==f?(0,a.jsxs)("div",{className:"w-full m-2 mt-2 p-8",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,a.jsxs)("div",{className:"flex flex-col items-start",children:[(0,a.jsx)(r.Dx,{className:"text-center",children:"AI Hub"}),(0,x.tY)(w||"")?(0,a.jsx)("p",{className:"text-sm text-gray-600",children:"Make models, agents, and MCP servers public for developers to know what's available."}):(0,a.jsx)("p",{className:"text-sm text-gray-600",children:"A list of all public model names personally available to you."})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,a.jsx)(r.xv,{children:"Model Hub URL:"}),(0,a.jsxs)("div",{className:"flex items-center bg-gray-200 px-2 py-1 rounded",children:[(0,a.jsx)(r.xv,{className:"mr-2",children:"".concat((0,_.getProxyBaseUrl)(),"/ui/model_hub_table")}),(0,a.jsx)("button",{onClick:()=>ew("".concat((0,_.getProxyBaseUrl)(),"/ui/model_hub_table")),className:"p-1 hover:bg-gray-300 rounded transition-colors",title:"Copy URL",children:(0,a.jsx)(i.Z,{size:16,className:"text-gray-600"})})]})]})]}),(0,x.tY)(w||"")&&(0,a.jsx)("div",{className:"mt-8 mb-2",children:(0,a.jsx)(V,{accessToken:N,userRole:w})}),(0,a.jsxs)(r.v0,{children:[(0,a.jsxs)(r.td,{className:"mb-4",children:[(0,a.jsx)(r.OK,{children:"Model Hub"}),(0,a.jsx)(r.OK,{children:"Agent Hub"}),(0,a.jsx)(r.OK,{children:"MCP Hub"})]}),(0,a.jsxs)(r.nP,{children:[(0,a.jsxs)(r.x4,{children:[(0,a.jsxs)(r.Zb,{children:[!1==f&&(0,x.tY)(w||"")&&(0,a.jsx)("div",{className:"flex justify-end mb-4",children:(0,a.jsx)(r.zx,{onClick:()=>eN(),children:"Select Models to Make Public"})}),(0,a.jsx)(M,{modelHubData:z||[],onFilteredDataChange:eP}),(0,a.jsx)(F.C,{columns:U(e=>{I(e),T(!0)},ew,f),data:Y,isLoading:D,table:ej,defaultSorting:[{id:"model_group",desc:!1}]})]}),(0,a.jsx)("div",{className:"mt-4 text-center space-y-2",children:(0,a.jsxs)(r.xv,{className:"text-sm text-gray-600",children:["Showing ",Y.length," of ",(null==z?void 0:z.length)||0," models"]})})]}),(0,a.jsxs)(r.x4,{children:[(0,a.jsxs)(r.Zb,{children:[!1==f&&(0,x.tY)(w||"")&&(0,a.jsx)("div",{className:"flex justify-end mb-4",children:(0,a.jsx)(r.zx,{onClick:()=>ef(),children:"Select Agents to Make Public"})}),(0,a.jsx)(F.C,{columns:function(e,s){return arguments.length>2&&void 0!==arguments[2]&&arguments[2],[{header:"Agent Name",accessorKey:"name",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,r=l.original;return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium text-sm",children:r.name}),(0,a.jsx)(p.Z,{title:"Copy agent name",children:(0,a.jsx)(t.Z,{onClick:()=>s(r.name),className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs"})})]}),(0,a.jsx)("div",{className:"md:hidden",children:(0,a.jsx)(u.Z,{className:"text-xs text-gray-600",children:r.description})})]})}},{header:"Description",accessorKey:"description",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)(u.Z,{className:"text-xs line-clamp-2",children:l.description||"-"})},meta:{className:"hidden md:table-cell"}},{header:"Version",accessorKey:"version",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsxs)(m.Z,{color:"blue",size:"sm",children:["v",l.version]})},meta:{className:"hidden lg:table-cell"}},{header:"Protocol",accessorKey:"protocolVersion",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)(u.Z,{className:"text-xs",children:l.protocolVersion||"-"})},meta:{className:"hidden lg:table-cell"}},{header:"Skills",accessorKey:"skills",enableSorting:!1,cell:e=>{let{row:s}=e,l=s.original.skills||[];return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)(u.Z,{className:"text-xs font-medium",children:[l.length," skill",1!==l.length?"s":""]}),l.length>0&&(0,a.jsxs)("div",{className:"flex flex-wrap gap-1",children:[l.slice(0,2).map(e=>(0,a.jsx)(g.Z,{color:"purple",className:"text-xs",children:e.name},e.id)),l.length>2&&(0,a.jsxs)(u.Z,{className:"text-xs text-gray-500",children:["+",l.length-2]})]})]})}},{header:"Capabilities",accessorKey:"capabilities",enableSorting:!1,cell:e=>{let{row:s}=e,l=Object.entries(s.original.capabilities||{}).filter(e=>{let[s,l]=e;return!0===l}).map(e=>{let[s]=e;return s});return(0,a.jsx)("div",{className:"flex flex-wrap gap-1",children:0===l.length?(0,a.jsx)(u.Z,{className:"text-gray-500 text-xs",children:"-"}):l.map(e=>(0,a.jsx)(m.Z,{color:"green",size:"xs",children:e},e))})}},{header:"I/O Modes",accessorKey:"defaultInputModes",enableSorting:!1,cell:e=>{let{row:s}=e,l=s.original,t=l.defaultInputModes||[],r=l.defaultOutputModes||[];return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)(u.Z,{className:"text-xs",children:[(0,a.jsx)("span",{className:"font-medium",children:"In:"})," ",t.join(", ")||"-"]}),(0,a.jsxs)(u.Z,{className:"text-xs",children:[(0,a.jsx)("span",{className:"font-medium",children:"Out:"})," ",r.join(", ")||"-"]})]})},meta:{className:"hidden xl:table-cell"}},{header:"Public",accessorKey:"is_public",enableSorting:!0,sortingFn:(e,s)=>(!0===e.original.is_public?1:0)-(!0===s.original.is_public?1:0),cell:e=>{let{row:s}=e;return console.log("CHECKPOINT 1: ".concat(JSON.stringify(s.original))),!0===s.original.is_public?(0,a.jsx)(m.Z,{color:"green",size:"xs",children:"Yes"}):(0,a.jsx)(m.Z,{color:"gray",size:"xs",children:"No"})},meta:{className:"hidden md:table-cell"}},{header:"Details",id:"details",enableSorting:!1,cell:s=>{let{row:l}=s,t=l.original;return(0,a.jsxs)(h.Z,{size:"xs",variant:"secondary",onClick:()=>e(t),icon:j.Z,children:[(0,a.jsx)("span",{className:"hidden lg:inline",children:"Details"}),(0,a.jsx)("span",{className:"lg:hidden",children:"Info"})]})}}]}(e=>{ea(e),er(!0)},ew,f),data:J||[],isLoading:ee,table:ev,defaultSorting:[{id:"name",desc:!1}]})]}),(0,a.jsx)("div",{className:"mt-4 text-center space-y-2",children:(0,a.jsxs)(r.xv,{className:"text-sm text-gray-600",children:["Showing ",(null==J?void 0:J.length)||0," agent",(null==J?void 0:J.length)!==1?"s":""]})})]}),(0,a.jsxs)(r.x4,{children:[(0,a.jsxs)(r.Zb,{children:[!1==f&&(0,x.tY)(w||"")&&(0,a.jsx)("div",{className:"flex justify-end mb-4",children:(0,a.jsx)(r.zx,{onClick:()=>ey(),children:"Select MCP Servers to Make Public"})}),(0,a.jsx)(F.C,{columns:function(e,s){return arguments.length>2&&void 0!==arguments[2]&&arguments[2],[{header:"Server Name",accessorKey:"server_name",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,r=l.original;return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"font-medium text-sm",children:r.server_name}),(0,a.jsx)(p.Z,{title:"Copy server name",children:(0,a.jsx)(t.Z,{onClick:()=>s(r.server_name),className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs"})})]}),(0,a.jsx)("div",{className:"md:hidden",children:(0,a.jsx)(u.Z,{className:"text-xs text-gray-600",children:r.description||"-"})})]})}},{header:"Description",accessorKey:"description",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)(u.Z,{className:"text-xs line-clamp-2",children:l.description||"-"})},meta:{className:"hidden md:table-cell"}},{header:"URL",accessorKey:"url",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,r=l.original;return(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"text-xs truncate max-w-xs",children:r.url}),(0,a.jsx)(p.Z,{title:"Copy URL",children:(0,a.jsx)(t.Z,{onClick:()=>s(r.url),className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs flex-shrink-0"})})]})},meta:{className:"hidden lg:table-cell"}},{header:"Transport",accessorKey:"transport",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)(m.Z,{color:"blue",size:"sm",children:l.transport})},meta:{className:"hidden md:table-cell"}},{header:"Auth Type",accessorKey:"auth_type",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original,t="none"===l.auth_type?"gray":"green";return(0,a.jsx)(m.Z,{color:t,size:"sm",children:l.auth_type})},meta:{className:"hidden md:table-cell"}},{header:"Status",accessorKey:"status",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original,t={active:"green",inactive:"red",unknown:"gray",healthy:"green",unhealthy:"red"}[l.status]||"gray";return(0,a.jsx)(m.Z,{color:t,size:"sm",children:l.status||"unknown"})}},{header:"Tools",accessorKey:"allowed_tools",enableSorting:!1,cell:e=>{let{row:s}=e,l=s.original.allowed_tools||[];return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(u.Z,{className:"text-xs font-medium",children:l.length>0?"".concat(l.length," tool").concat(1!==l.length?"s":""):"All tools"}),l.length>0&&(0,a.jsxs)("div",{className:"flex flex-wrap gap-1",children:[l.slice(0,2).map((e,s)=>(0,a.jsx)(g.Z,{color:"purple",className:"text-xs",children:e},s)),l.length>2&&(0,a.jsxs)(u.Z,{className:"text-xs text-gray-500",children:["+",l.length-2]})]})]})},meta:{className:"hidden lg:table-cell"}},{header:"Created By",accessorKey:"created_by",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,a.jsx)(u.Z,{className:"text-xs",children:l.created_by||"-"})},meta:{className:"hidden xl:table-cell"}},{header:"Public",accessorKey:"mcp_info.is_public",enableSorting:!0,sortingFn:(e,s)=>{var l,a;return((null===(l=e.original.mcp_info)||void 0===l?void 0:l.is_public)===!0?1:0)-((null===(a=s.original.mcp_info)||void 0===a?void 0:a.is_public)===!0?1:0)},cell:e=>{var s;let{row:l}=e;return(null===(s=l.original.mcp_info)||void 0===s?void 0:s.is_public)===!0?(0,a.jsx)(m.Z,{color:"green",size:"xs",children:"Yes"}):(0,a.jsx)(m.Z,{color:"gray",size:"xs",children:"No"})},meta:{className:"hidden md:table-cell"}},{header:"Details",id:"details",enableSorting:!1,cell:s=>{let{row:l}=s,t=l.original;return(0,a.jsxs)(h.Z,{size:"xs",variant:"secondary",onClick:()=>e(t),icon:j.Z,children:[(0,a.jsx)("span",{className:"hidden lg:inline",children:"Details"}),(0,a.jsx)("span",{className:"lg:hidden",children:"Info"})]})}}]}(e=>{ex(e),eh(!0)},ew,f),data:en||[],isLoading:ec,table:eb,defaultSorting:[{id:"server_name",desc:!1}]})]}),(0,a.jsx)("div",{className:"mt-4 text-center space-y-2",children:(0,a.jsxs)(r.xv,{className:"text-sm text-gray-600",children:["Showing ",(null==en?void 0:en.length)||0," MCP server",(null==en?void 0:en.length)!==1?"s":""]})})]})]})]})]}):(0,a.jsxs)(r.Zb,{className:"mx-auto max-w-xl mt-10",children:[(0,a.jsx)(r.xv,{className:"text-xl text-center mb-2 text-black",children:"Public Model Hub not enabled."}),(0,a.jsx)("p",{className:"text-base text-center text-slate-800",children:"Ask your proxy admin to enable this on their Admin UI."})]}),(0,a.jsx)(n.Z,{title:"Public Model Hub",width:600,visible:H,footer:null,onOk:e_,onCancel:ek,children:(0,a.jsxs)("div",{className:"pt-5 pb-5",children:[(0,a.jsxs)("div",{className:"flex justify-between mb-4",children:[(0,a.jsx)(r.xv,{className:"text-base mr-2",children:"Shareable Link:"}),(0,a.jsx)(r.xv,{className:"max-w-sm ml-2 bg-gray-200 pr-2 pl-2 pt-1 pb-1 text-center rounded",children:"".concat((0,_.getProxyBaseUrl)(),"/ui/model_hub_table")})]}),(0,a.jsx)("div",{className:"flex justify-end",children:(0,a.jsx)(r.zx,{onClick:()=>{eg.replace("/model_hub_table?key=".concat(N))},children:"See Page"})})]})}),(0,a.jsx)(n.Z,{title:(null==B?void 0:B.model_group)||"Model Details",width:1e3,visible:K,footer:null,onOk:e_,onCancel:ek,children:B&&(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Model Overview"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Model Group:"}),(0,a.jsx)(r.xv,{children:B.model_group})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Mode:"}),(0,a.jsx)(r.xv,{children:B.mode||"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Providers:"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:B.providers.map(e=>(0,a.jsx)(r.Ct,{color:"blue",children:e},e))})]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Token & Cost Information"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Max Input Tokens:"}),(0,a.jsx)(r.xv,{children:(null===(s=B.max_input_tokens)||void 0===s?void 0:s.toLocaleString())||"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Max Output Tokens:"}),(0,a.jsx)(r.xv,{children:(null===(l=B.max_output_tokens)||void 0===l?void 0:l.toLocaleString())||"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Input Cost per 1M Tokens:"}),(0,a.jsx)(r.xv,{children:B.input_cost_per_token?eS(B.input_cost_per_token):"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Output Cost per 1M Tokens:"}),(0,a.jsx)(r.xv,{children:B.output_cost_per_token?eS(B.output_cost_per_token):"Not specified"})]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Capabilities"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:(()=>{let e=eC(B),s=["green","blue","purple","orange","red","yellow"];return 0===e.length?(0,a.jsx)(r.xv,{className:"text-gray-500",children:"No special capabilities listed"}):e.map((e,l)=>(0,a.jsx)(r.Ct,{color:s[l%s.length],children:eZ(e)},e))})()})]}),(B.tpm||B.rpm)&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Rate Limits"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[B.tpm&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Tokens per Minute:"}),(0,a.jsx)(r.xv,{children:B.tpm.toLocaleString()})]}),B.rpm&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Requests per Minute:"}),(0,a.jsx)(r.xv,{children:B.rpm.toLocaleString()})]})]})]}),B.supported_openai_params&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Supported OpenAI Parameters"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:B.supported_openai_params.map(e=>(0,a.jsx)(r.Ct,{color:"green",children:e},e))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Usage Example"}),(0,a.jsx)(o.Z,{language:"python",className:"text-sm",children:'import openai\n\nclient = openai.OpenAI(\n api_key="your_api_key",\n base_url="http://0.0.0.0:4000" # Your LiteLLM Proxy URL\n)\n\nresponse = client.chat.completions.create(\n model="'.concat(B.model_group,'",\n messages=[\n {\n "role": "user",\n "content": "Hello, how are you?"\n }\n ]\n)\n\nprint(response.choices[0].message.content)')})]})]})}),(0,a.jsx)(n.Z,{title:(null==el?void 0:el.name)||"Agent Details",width:1e3,visible:et,footer:null,onOk:e_,onCancel:ek,children:el&&(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Agent Overview"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Name:"}),(0,a.jsx)(r.xv,{children:el.name})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Version:"}),(0,a.jsxs)(r.Ct,{color:"blue",children:["v",el.version]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Protocol Version:"}),(0,a.jsx)(r.xv,{children:el.protocolVersion})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"URL:"}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(r.xv,{className:"truncate",children:el.url}),(0,a.jsx)(t.Z,{onClick:()=>ew(el.url),className:"cursor-pointer text-gray-500 hover:text-blue-500"})]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Description:"}),(0,a.jsx)(r.xv,{className:"mt-1",children:el.description})]})]}),el.capabilities&&Object.keys(el.capabilities).length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Capabilities"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(el.capabilities).filter(e=>{let[s,l]=e;return!0===l}).map(e=>{let[s]=e;return(0,a.jsx)(r.Ct,{color:"green",children:s},s)})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Input/Output Modes"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Input Modes:"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:(null===(v=el.defaultInputModes)||void 0===v?void 0:v.map(e=>(0,a.jsx)(r.Ct,{color:"blue",children:e},e)))||(0,a.jsx)(r.xv,{children:"Not specified"})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Output Modes:"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:(null===(b=el.defaultOutputModes)||void 0===b?void 0:b.map(e=>(0,a.jsx)(r.Ct,{color:"purple",children:e},e)))||(0,a.jsx)(r.xv,{children:"Not specified"})})]})]})]}),el.skills&&el.skills.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Skills"}),(0,a.jsx)("div",{className:"space-y-4",children:el.skills.map(e=>(0,a.jsxs)("div",{className:"border border-gray-200 rounded p-4",children:[(0,a.jsxs)("div",{className:"flex justify-between items-start mb-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium text-base",children:e.name}),(0,a.jsxs)(r.xv,{className:"text-xs text-gray-500",children:["ID: ",e.id]})]}),e.tags&&e.tags.length>0&&(0,a.jsx)("div",{className:"flex flex-wrap gap-1",children:e.tags.map(e=>(0,a.jsx)(r.Ct,{color:"purple",size:"xs",children:e},e))})]}),(0,a.jsx)(r.xv,{className:"text-sm mb-2",children:e.description}),e.examples&&e.examples.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-xs font-medium text-gray-700",children:"Examples:"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:e.examples.map((e,s)=>(0,a.jsx)(r.Ct,{color:"gray",size:"xs",children:e},s))})]})]},e.id))})]}),el.supportsAuthenticatedExtendedCard&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Additional Features"}),(0,a.jsx)(r.Ct,{color:"green",children:"Supports Authenticated Extended Card"})]})]})}),(0,a.jsx)(n.Z,{title:(null==eo?void 0:eo.server_name)||"MCP Server Details",width:1e3,visible:em,footer:null,onOk:e_,onCancel:ek,children:eo&&(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Server Overview"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Server Name:"}),(0,a.jsx)(r.xv,{children:eo.server_name})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Server ID:"}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(r.xv,{className:"text-xs truncate",children:eo.server_id}),(0,a.jsx)(t.Z,{onClick:()=>ew(eo.server_id),className:"cursor-pointer text-gray-500 hover:text-blue-500"})]})]}),eo.alias&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Alias:"}),(0,a.jsx)(r.xv,{children:eo.alias})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Transport:"}),(0,a.jsx)(r.Ct,{color:"blue",children:eo.transport})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Auth Type:"}),(0,a.jsx)(r.Ct,{color:"none"===eo.auth_type?"gray":"green",children:eo.auth_type})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Status:"}),(0,a.jsx)(r.Ct,{color:"active"===eo.status||"healthy"===eo.status?"green":"inactive"===eo.status||"unhealthy"===eo.status?"red":"gray",children:eo.status||"unknown"})]})]}),eo.description&&(0,a.jsxs)("div",{className:"mt-2",children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Description:"}),(0,a.jsx)(r.xv,{className:"mt-1",children:eo.description})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Connection Details"}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"URL:"}),(0,a.jsxs)("div",{className:"flex items-center space-x-2 mt-1",children:[(0,a.jsx)(r.xv,{className:"text-sm break-all bg-gray-100 p-2 rounded flex-1",children:eo.url}),(0,a.jsx)(t.Z,{onClick:()=>ew(eo.url),className:"cursor-pointer text-gray-500 hover:text-blue-500 flex-shrink-0"})]})]}),eo.command&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Command:"}),(0,a.jsx)(r.xv,{className:"text-sm bg-gray-100 p-2 rounded mt-1 font-mono",children:eo.command})]})]})]}),eo.allowed_tools&&eo.allowed_tools.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Allowed Tools"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:eo.allowed_tools.map((e,s)=>(0,a.jsx)(r.Ct,{color:"purple",children:e},s))})]}),eo.teams&&eo.teams.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Teams"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:eo.teams.map((e,s)=>(0,a.jsx)(r.Ct,{color:"blue",children:e},s))})]}),eo.mcp_access_groups&&eo.mcp_access_groups.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Access Groups"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:eo.mcp_access_groups.map((e,s)=>(0,a.jsx)(r.Ct,{color:"green",children:e},s))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Metadata"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Created By:"}),(0,a.jsx)(r.xv,{children:eo.created_by})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Updated By:"}),(0,a.jsx)(r.xv,{children:eo.updated_by})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Created At:"}),(0,a.jsx)(r.xv,{className:"text-sm",children:new Date(eo.created_at).toLocaleString()})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Updated At:"}),(0,a.jsx)(r.xv,{className:"text-sm",children:new Date(eo.updated_at).toLocaleString()})]}),eo.last_health_check&&(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"font-medium",children:"Last Health Check:"}),(0,a.jsx)(r.xv,{className:"text-sm",children:new Date(eo.last_health_check).toLocaleString()})]})]}),eo.health_check_error&&(0,a.jsxs)("div",{className:"mt-2 p-2 bg-red-50 rounded",children:[(0,a.jsx)(r.xv,{className:"font-medium text-red-700",children:"Health Check Error:"}),(0,a.jsx)(r.xv,{className:"text-sm text-red-600 mt-1",children:eo.health_check_error})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(r.xv,{className:"text-lg font-semibold mb-4",children:"Usage Example"}),(0,a.jsx)(o.Z,{language:"python",className:"text-sm",children:'from fastmcp import Client\nimport asyncio\n\n# Standard MCP configuration\nconfig = {\n "mcpServers": {\n "'.concat(eo.server_name,'": {\n "url": "http://localhost:4000/').concat(eo.server_name,'/mcp",\n "headers": {\n "x-litellm-api-key": "Bearer sk-1234"\n }\n }\n }\n}\n\n# Create a client that connects to the server\nclient = Client(config)\n\nasync def main():\n async with client:\n # List available tools\n tools = await client.list_tools()\n print(f"Available tools: {[tool.name for tool in tools]}")\n\n # Call a tool\n response = await client.call_tool(\n name="tool_name", \n arguments={"arg": "value"}\n )\n print(f"Response: {response}")\n\nif __name__ == "__main__":\n asyncio.run(main())')})]})]})}),(0,a.jsx)(A,{visible:q,onClose:()=>G(!1),accessToken:N||"",modelHubData:z||[],onSuccess:()=>{N&&(async()=>{try{let e=await (0,_.modelHubCall)(N);L(e.data)}catch(e){console.error("Error refreshing model data:",e)}})()}}),(0,a.jsx)(Z,{visible:Q,onClose:()=>X(!1),accessToken:N||"",agentHubData:J||[],onSuccess:()=>{N&&(async()=>{try{let e=(await (0,_.getAgentsList)(N)).agents.map(e=>({agent_id:e.agent_id,...e.agent_card_params,is_public:e.is_public}));$(e)}catch(e){console.error("Error refreshing agent data:",e)}})()}}),(0,a.jsx)(S,{visible:eu,onClose:()=>ep(!1),accessToken:N||"",mcpHubData:en||[],onSuccess:()=>{N&&(async()=>{try{let e=await (0,_.fetchMCPServers)(N);ei(e)}catch(e){console.error("Error refreshing MCP server data:",e)}})()}})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2273-d8bd63b2792d0fd2.js b/litellm/proxy/_experimental/out/_next/static/chunks/2273-c902438b7579c117.js similarity index 100% rename from litellm/proxy/_experimental/out/_next/static/chunks/2273-d8bd63b2792d0fd2.js rename to litellm/proxy/_experimental/out/_next/static/chunks/2273-c902438b7579c117.js diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2377-674bd40044d10e16.js b/litellm/proxy/_experimental/out/_next/static/chunks/2377-7121736141e67af2.js similarity index 100% rename from litellm/proxy/_experimental/out/_next/static/chunks/2377-674bd40044d10e16.js rename to litellm/proxy/_experimental/out/_next/static/chunks/2377-7121736141e67af2.js diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2409-e94c05c6f11bb939.js b/litellm/proxy/_experimental/out/_next/static/chunks/2409-79fdc0573d81b0e4.js similarity index 100% rename from litellm/proxy/_experimental/out/_next/static/chunks/2409-e94c05c6f11bb939.js rename to litellm/proxy/_experimental/out/_next/static/chunks/2409-79fdc0573d81b0e4.js diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2831-780a653f6bb335ce.js b/litellm/proxy/_experimental/out/_next/static/chunks/2831-780a653f6bb335ce.js new file mode 100644 index 00000000000..2d00ff62ec4 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/2831-780a653f6bb335ce.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2831],{34310:function(e,t,r){"use strict";r.d(t,{Z:function(){return o}});var n=r(1119),i=r(2265),s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM472 744a40 40 0 1080 0 40 40 0 10-80 0zm16-104h48c4.4 0 8-3.6 8-8V448c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v184c0 4.4 3.6 8 8 8z"}}]},name:"file-exclamation",theme:"outlined"},a=r(55015),o=i.forwardRef(function(e,t){return i.createElement(a.Z,(0,n.Z)({},e,{ref:t,icon:s}))})},35829:function(e,t,r){"use strict";r.d(t,{Z:function(){return u}});var n=r(5853),i=r(26898),s=r(13241),a=r(1153),o=r(2265);let u=o.forwardRef((e,t)=>{let{color:r,children:u,className:l}=e,c=(0,n._T)(e,["color","children","className"]);return o.createElement("p",Object.assign({ref:t,className:(0,s.q)("font-semibold text-tremor-metric",r?(0,a.bM)(r,i.K.darkText).textColor:"text-tremor-content-strong dark:text-dark-tremor-content-strong",l)},c),u)});u.displayName="Metric"},15452:function(e,t){var r,n,i;n=[],void 0!==(i="function"==typeof(r=function e(){var t,r="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==r?r:{},n=!r.document&&!!r.postMessage,i=r.IS_PAPA_WORKER||!1,s={},a=0,o={};function u(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(e){var t=_(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new d(t),(this._handle.streamer=this)._config=t}).call(this,e),this.parseChunk=function(e,t){var n=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0=this._config.preview,i)r.postMessage({results:s,workerId:o.WORKER_ID,finished:n});else if(k(this._config.chunk)&&!t){if(this._config.chunk(s,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=s=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(s.data),this._completeResults.errors=this._completeResults.errors.concat(s.errors),this._completeResults.meta=s.meta),this._completed||!n||!k(this._config.complete)||s&&s.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),n||s&&s.meta.paused||this._nextChunk(),s}this._halted=!0},this._sendError=function(e){k(this._config.error)?this._config.error(e):i&&this._config.error&&r.postMessage({workerId:o.WORKER_ID,error:e,finished:!1})}}function l(e){var t;(e=e||{}).chunkSize||(e.chunkSize=o.RemoteChunkSize),u.call(this,e),this._nextChunk=n?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),n||(t.onload=v(this._chunkLoaded,this),t.onerror=v(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!n),this._config.downloadRequestHeaders){var e,r,i=this._config.downloadRequestHeaders;for(r in i)t.setRequestHeader(r,i[r])}this._config.chunkSize&&(e=this._start+this._config.chunkSize-1,t.setRequestHeader("Range","bytes="+this._start+"-"+e));try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}n&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){let e;4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize||t.responseText.length,this._finished=!this._config.chunkSize||this._start>=(null!==(e=(e=t).getResponseHeader("Content-Range"))?parseInt(e.substring(e.lastIndexOf("/")+1)):-1),this.parseChunk(t.responseText)))},this._chunkError=function(e){e=t.statusText||e,this._sendError(Error(e))}}function c(e){(e=e||{}).chunkSize||(e.chunkSize=o.LocalChunkSize),u.call(this,e);var t,r,n="undefined"!=typeof FileReader;this.stream=function(e){this._input=e,r=e.slice||e.webkitSlice||e.mozSlice,n?((t=new FileReader).onload=v(this._chunkLoaded,this),t.onerror=v(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function h(e){var t;u.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){var e,r;if(!this._finished)return t=(e=this._config.chunkSize)?(r=t.substring(0,e),t.substring(e)):(r=t,""),this._finished=!t,this.parseChunk(r)}}function f(e){u.call(this,e=e||{});var t=[],r=!0,n=!1;this.pause=function(){u.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){u.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){n&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):r=!0},this._streamData=v(function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),r&&(r=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}},this),this._streamError=v(function(e){this._streamCleanUp(),this._sendError(e)},this),this._streamEnd=v(function(){this._streamCleanUp(),n=!0,this._streamData("")},this),this._streamCleanUp=v(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function d(e){var t,r,n,i,s=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,a=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,u=this,l=0,c=0,h=!1,f=!1,d=[],y={data:[],errors:[],meta:{}};function g(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function b(){if(y&&n&&(C("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+o.DefaultDelimiter+"'"),n=!1),e.skipEmptyLines&&(y.data=y.data.filter(function(e){return!g(e)})),v()){if(y){if(Array.isArray(y.data[0])){for(var t,r=0;v()&&r=d.length?"__parsed_extra":d[i]:o,l=u=e.transform?e.transform(u,o):u,(e.dynamicTypingFunction&&void 0===e.dynamicTyping[r]&&(e.dynamicTyping[r]=e.dynamicTypingFunction(r)),!0===(e.dynamicTyping[r]||e.dynamicTyping))?"true"===l||"TRUE"===l||"false"!==l&&"FALSE"!==l&&((e=>{if(s.test(e)&&-9007199254740992<(e=parseFloat(e))&&e<9007199254740992)return 1})(l)?parseFloat(l):a.test(l)?new Date(l):""===l?null:l):l);"__parsed_extra"===o?(n[o]=n[o]||[],n[o].push(u)):n[o]=u}return e.header&&(i>d.length?C("FieldMismatch","TooManyFields","Too many fields: expected "+d.length+" fields but parsed "+i,c+r):ie.preview?r.abort():(y.data=y.data[0],i(y,u))))}),this.parse=function(i,s,a){var u=e.quoteChar||'"',u=(e.newline||(e.newline=this.guessLineEndings(i,u)),n=!1,e.delimiter?k(e.delimiter)&&(e.delimiter=e.delimiter(i),y.meta.delimiter=e.delimiter):((u=((t,r,n,i,s)=>{var a,u,l,c;s=s||[","," ","|",";",o.RECORD_SEP,o.UNIT_SEP];for(var h=0;h=r.length/2?"\r\n":"\r"}}function p(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function m(e){var t=(e=e||{}).delimiter,r=e.newline,n=e.comments,i=e.step,s=e.preview,a=e.fastMode,u=null,l=!1,c=null==e.quoteChar?'"':e.quoteChar,h=c;if(void 0!==e.escapeChar&&(h=e.escapeChar),("string"!=typeof t||-1=s)return N(!0);break}E.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:w.length,index:f}),q++}}else if(n&&0===O.length&&o.substring(f,f+v)===n){if(-1===A)return N();f=A+_,A=o.indexOf(r,f),P=o.indexOf(t,f)}else if(-1!==P&&(P=s)return N(!0)}return I();function j(e){w.push(e),x=f}function F(e){return -1!==e&&(e=o.substring(q+1,e))&&""===e.trim()?e.length:0}function I(e){return y||(void 0===e&&(e=o.substring(f)),O.push(e),f=g,j(O),C&&L()),N()}function M(e){f=e,j(O),O=[],A=o.indexOf(r,f)}function N(n){if(e.header&&!m&&w.length&&!l){var i=w[0],s=Object.create(null),a=new Set(i);let t=!1;for(let r=0;r{if("object"==typeof t){if("string"!=typeof t.delimiter||o.BAD_DELIMITERS.filter(function(e){return -1!==t.delimiter.indexOf(e)}).length||(i=t.delimiter),("boolean"==typeof t.quotes||"function"==typeof t.quotes||Array.isArray(t.quotes))&&(r=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(l=t.skipEmptyLines),"string"==typeof t.newline&&(s=t.newline),"string"==typeof t.quoteChar&&(a=t.quoteChar),"boolean"==typeof t.header&&(n=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw Error("Option columns is empty");c=t.columns}void 0!==t.escapeChar&&(u=t.escapeChar+a),t.escapeFormulae instanceof RegExp?h=t.escapeFormulae:"boolean"==typeof t.escapeFormulae&&t.escapeFormulae&&(h=/^[=+\-@\t\r].*$/)}})(),RegExp(p(a),"g"));if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return d(null,e,l);if("object"==typeof e[0])return d(c||Object.keys(e[0]),e,l)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||c),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),d(e.fields||[],e.data||[],l);throw Error("Unable to serialize unrecognized input");function d(e,t,r){var a="",o=("string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t)),Array.isArray(e)&&0{for(var r=0;r=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(e,a),n=i.default.Children.only(t);return i.default.cloneElement(n,l(l({},r),{},{onClick:this.onClick}))}}],function(e,t){for(var r=0;r"boolean"==typeof e||e instanceof Boolean,s=e=>"number"==typeof e||e instanceof Number,a=e=>"bigint"==typeof e||e instanceof BigInt,o=e=>!!e&&e instanceof Date,u=e=>"string"==typeof e||e instanceof String,l=e=>Array.isArray(e),c=e=>"object"==typeof e&&null!==e,h=e=>!!e&&e instanceof Object&&"function"==typeof e;function f(e,t){return void 0===t&&(t=!1),!e||t?`"${e}"`:e}function d(e){let{field:t,value:r,data:i,lastElement:s,openBracket:a,closeBracket:o,level:u,style:l,shouldExpandNode:c,clickToExpandNode:h,outerRef:d,beforeExpandChange:p}=e,m=(0,n.useRef)(!1),[y,b]=(0,n.useState)(()=>c(u,r,t)),_=(0,n.useRef)(null);(0,n.useEffect)(()=>{m.current?b(c(u,r,t)):m.current=!0},[c]);let v=(0,n.useId)();if(0===i.length)return function(e){let{field:t,openBracket:r,closeBracket:i,lastElement:s,style:a}=e;return(0,n.createElement)("div",{className:a.basicChildStyle,role:"treeitem","aria-selected":void 0},(t||""===t)&&(0,n.createElement)("span",{className:a.label},f(t,a.quotesForFieldNames),":"),(0,n.createElement)("span",{className:a.punctuation},r),(0,n.createElement)("span",{className:a.punctuation},i),!s&&(0,n.createElement)("span",{className:a.punctuation},","))}({field:t,openBracket:a,closeBracket:o,lastElement:s,style:l});let k=y?l.collapseIcon:l.expandIcon,C=y?l.ariaLables.collapseJson:l.ariaLables.expandJson,w=u+1,E=i.length-1,O=e=>{y!==e&&(!p||p({level:u,value:r,field:t,newExpandValue:e}))&&b(e)},x=e=>{if("ArrowRight"===e.key||"ArrowLeft"===e.key)e.preventDefault(),O("ArrowRight"===e.key);else if("ArrowUp"===e.key||"ArrowDown"===e.key){e.preventDefault();let t="ArrowUp"===e.key?-1:1;if(!d.current)return;let r=d.current.querySelectorAll("[role=button]"),n=-1;for(let e=0;e{var e;O(!y);let t=_.current;if(!t)return;let r=null===(e=d.current)||void 0===e?void 0:e.querySelector('[role=button][tabindex="0"]');r&&(r.tabIndex=-1),t.tabIndex=0,t.focus()};return(0,n.createElement)("div",{className:l.basicChildStyle,role:"treeitem","aria-expanded":y,"aria-selected":void 0},(0,n.createElement)("span",{className:k,onClick:R,onKeyDown:x,role:"button","aria-label":C,"aria-expanded":y,"aria-controls":y?v:void 0,ref:_,tabIndex:0===u?0:-1}),(t||""===t)&&(h?(0,n.createElement)("span",{className:l.clickableLabel,onClick:R,onKeyDown:x},f(t,l.quotesForFieldNames),":"):(0,n.createElement)("span",{className:l.label},f(t,l.quotesForFieldNames),":")),(0,n.createElement)("span",{className:l.punctuation},a),y?(0,n.createElement)("ul",{id:v,role:"group",className:l.childFieldsContainer},i.map((e,t)=>(0,n.createElement)(g,{key:e[0]||t,field:e[0],value:e[1],style:l,lastElement:t===E,level:w,shouldExpandNode:c,clickToExpandNode:h,beforeExpandChange:p,outerRef:d}))):(0,n.createElement)("span",{className:l.collapsedContent,onClick:R,onKeyDown:x}),(0,n.createElement)("span",{className:l.punctuation},o),!s&&(0,n.createElement)("span",{className:l.punctuation},","))}function p(e){let{field:t,value:r,style:n,lastElement:i,shouldExpandNode:s,clickToExpandNode:a,level:o,outerRef:u,beforeExpandChange:l}=e;return d({field:t,value:r,lastElement:i||!1,level:o,openBracket:"{",closeBracket:"}",style:n,shouldExpandNode:s,clickToExpandNode:a,data:Object.keys(r).map(e=>[e,r[e]]),outerRef:u,beforeExpandChange:l})}function m(e){let{field:t,value:r,style:n,lastElement:i,level:s,shouldExpandNode:a,clickToExpandNode:o,outerRef:u,beforeExpandChange:l}=e;return d({field:t,value:r,lastElement:i||!1,level:s,openBracket:"[",closeBracket:"]",style:n,shouldExpandNode:a,clickToExpandNode:o,data:r.map(e=>[void 0,e]),outerRef:u,beforeExpandChange:l})}function y(e){let t,{field:r,value:l,style:c,lastElement:d}=e,p=c.otherValue;if(null===l)t="null",p=c.nullValue;else if(void 0===l)t="undefined",p=c.undefinedValue;else if(u(l)){var m;m=!c.noQuotesForStringValues,t=c.stringifyStringValues?JSON.stringify(l):m?`"${l}"`:l,p=c.stringValue}else i(l)?(t=l?"true":"false",p=c.booleanValue):s(l)?(t=l.toString(),p=c.numberValue):a(l)?(t=`${l.toString()}n`,p=c.numberValue):t=o(l)?l.toISOString():h(l)?"function() { }":l.toString();return(0,n.createElement)("div",{className:c.basicChildStyle,role:"treeitem","aria-selected":void 0},(r||""===r)&&(0,n.createElement)("span",{className:c.label},f(r,c.quotesForFieldNames),":"),(0,n.createElement)("span",{className:p},t),!d&&(0,n.createElement)("span",{className:c.punctuation},","))}function g(e){let t=e.value;return l(t)?(0,n.createElement)(m,Object.assign({},e)):!c(t)||o(t)||h(t)?(0,n.createElement)(y,Object.assign({},e)):(0,n.createElement)(p,Object.assign({},e))}let b={container:"_2IvMF _GzYRV",basicChildStyle:"_2bkNM",childFieldsContainer:"_1BXBN",label:"_1MGIk",clickableLabel:"_2YKJg _1MGIk _1MFti",nullValue:"_2T6PJ",undefinedValue:"_1Gho6",stringValue:"_vGjyY",booleanValue:"_3zQKs",numberValue:"_1bQdo",otherValue:"_1xvuR",punctuation:"_3uHL6 _3eOF8",collapseIcon:"_oLqym _f10Tu _1MFti _1LId0",expandIcon:"_2AXVT _f10Tu _1MFti _1UmXx",collapsedContent:"_2KJWg _1pNG9 _1MFti",noQuotesForStringValues:!1,quotesForFieldNames:!1,ariaLables:{collapseJson:"collapse JSON",expandJson:"expand JSON"},stringifyStringValues:!1},_=()=>!0,v=e=>{let{data:t,style:r=b,shouldExpandNode:i=_,clickToExpandNode:s=!1,beforeExpandChange:a,compactTopLevel:o,...u}=e,l=(0,n.useRef)(null);return(0,n.createElement)("div",Object.assign({"aria-label":"JSON view"},u,{className:r.container,ref:l,role:"tree"}),o&&c(t)?Object.entries(t).map(e=>{let[t,o]=e;return(0,n.createElement)(g,{key:t,field:t,value:o,style:{...b,...r},lastElement:!0,level:1,shouldExpandNode:i,clickToExpandNode:s,beforeExpandChange:a,outerRef:l})}):(0,n.createElement)(g,{value:t,style:{...b,...r},lastElement:!0,level:0,shouldExpandNode:i,clickToExpandNode:s,outerRef:l,beforeExpandChange:a}))}},52621:function(){},44643:function(e,t,r){"use strict";var n=r(2265);let i=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=i},88532:function(e,t,r){"use strict";var n=r(2265);let i=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"}))});t.Z=i},71157:function(e,t,r){"use strict";var n=r(2265);let i=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=i},2894:function(e,t,r){"use strict";r.d(t,{R:function(){return o},m:function(){return a}});var n=r(18238),i=r(7989),s=r(11255),a=class extends i.F{#e;#t;#r;#n;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#r=e.mutationCache,this.#t=[],this.state=e.state||o(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#r.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||("pending"===this.state.status?this.scheduleGc():this.#r.remove(this))}continue(){return this.#n?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:"continue"})},r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#n=(0,s.Mz)({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{this.#i({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#i({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#r.canRun(this)});let n="pending"===this.state.status,i=!this.#n.canStart();try{if(n)t();else{this.#i({type:"pending",variables:e,isPaused:i}),await this.#r.config.onMutate?.(e,this,r);let t=await this.options.onMutate?.(e,r);t!==this.state.context&&this.#i({type:"pending",context:t,variables:e,isPaused:i})}let s=await this.#n.start();return await this.#r.config.onSuccess?.(s,e,this.state.context,this,r),await this.options.onSuccess?.(s,e,this.state.context,r),await this.#r.config.onSettled?.(s,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(s,null,e,this.state.context,r),this.#i({type:"success",data:s}),s}catch(t){try{throw await this.#r.config.onError?.(t,e,this.state.context,this,r),await this.options.onError?.(t,e,this.state.context,r),await this.#r.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(void 0,t,e,this.state.context,r),t}finally{this.#i({type:"error",error:t})}}finally{this.#r.runNext(this)}}#i(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),n.Vr.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#r.notify({mutation:this,type:"updated",action:e})})}};function o(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}},21623:function(e,t,r){"use strict";r.d(t,{S:function(){return m}});var n=r(45345),i=r(21733),s=r(18238),a=r(24112),o=class extends a.l{constructor(e={}){super(),this.config=e,this.#s=new Map}#s;build(e,t,r){let s=t.queryKey,a=t.queryHash??(0,n.Rm)(s,t),o=this.get(a);return o||(o=new i.A({client:e,queryKey:s,queryHash:a,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(s)}),this.add(o)),o}add(e){this.#s.has(e.queryHash)||(this.#s.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#s.get(e.queryHash);t&&(e.destroy(),t===e&&this.#s.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){s.Vr.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#s.get(e)}getAll(){return[...this.#s.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,n._x)(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>(0,n._x)(e,t)):t}notify(e){s.Vr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){s.Vr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){s.Vr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},u=r(2894),l=class extends a.l{constructor(e={}){super(),this.config=e,this.#a=new Set,this.#o=new Map,this.#u=0}#a;#o;#u;build(e,t,r){let n=new u.m({client:e,mutationCache:this,mutationId:++this.#u,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#a.add(e);let t=c(e);if("string"==typeof t){let r=this.#o.get(t);r?r.push(e):this.#o.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#a.delete(e)){let t=c(e);if("string"==typeof t){let r=this.#o.get(t);if(r){if(r.length>1){let t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&this.#o.delete(t)}}}this.notify({type:"removed",mutation:e})}canRun(e){let t=c(e);if("string"!=typeof t)return!0;{let r=this.#o.get(t),n=r?.find(e=>"pending"===e.state.status);return!n||n===e}}runNext(e){let t=c(e);if("string"!=typeof t)return Promise.resolve();{let r=this.#o.get(t)?.find(t=>t!==e&&t.state.isPaused);return r?.continue()??Promise.resolve()}}clear(){s.Vr.batch(()=>{this.#a.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#a.clear(),this.#o.clear()})}getAll(){return Array.from(this.#a)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,n.X7)(t,e))}findAll(e={}){return this.getAll().filter(t=>(0,n.X7)(e,t))}notify(e){s.Vr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return s.Vr.batch(()=>Promise.all(e.map(e=>e.continue().catch(n.ZT))))}};function c(e){return e.options.scope?.id}var h=r(87045),f=r(57853);function d(e){return{onFetch:(t,r)=>{let i=t.options,s=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],u={pages:[],pageParams:[]},l=0,c=async()=>{let r=!1,c=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(t.signal.aborted?r=!0:t.signal.addEventListener("abort",()=>{r=!0}),t.signal)})},h=(0,n.cG)(t.options,t.fetchOptions),f=async(e,i,s)=>{if(r)return Promise.reject();if(null==i&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:i,direction:s?"backward":"forward",meta:t.options.meta};return c(e),e})(),o=await h(a),{maxPages:u}=t.options,l=s?n.Ht:n.VX;return{pages:l(e.pages,o,u),pageParams:l(e.pageParams,i,u)}};if(s&&a.length){let e="backward"===s,t={pages:a,pageParams:o},r=(e?function(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}:p)(i,t);u=await f(t,r,e)}else{let t=e??a.length;do{let e=0===l?o[0]??i.initialPageParam:p(i,u);if(l>0&&null==e)break;u=await f(u,e),l++}while(lt.options.persister?.(c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=c}}}function p(e,{pages:t,pageParams:r}){let n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}var m=class{#l;#r;#c;#h;#f;#d;#p;#m;constructor(e={}){this.#l=e.queryCache||new o,this.#r=e.mutationCache||new l,this.#c=e.defaultOptions||{},this.#h=new Map,this.#f=new Map,this.#d=0}mount(){this.#d++,1===this.#d&&(this.#p=h.j.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#l.onFocus())}),this.#m=f.N.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#l.onOnline())}))}unmount(){this.#d--,0===this.#d&&(this.#p?.(),this.#p=void 0,this.#m?.(),this.#m=void 0)}isFetching(e){return this.#l.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#r.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#l.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=this.#l.build(this,t),i=r.state.data;return void 0===i?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime((0,n.KC)(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(i))}getQueriesData(e){return this.#l.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,r){let i=this.defaultQueryOptions({queryKey:e}),s=this.#l.get(i.queryHash),a=s?.state.data,o=(0,n.SE)(t,a);if(void 0!==o)return this.#l.build(this,i).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return s.Vr.batch(()=>this.#l.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#l.get(t.queryHash)?.state}removeQueries(e){let t=this.#l;s.Vr.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let r=this.#l;return s.Vr.batch(()=>(r.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:!0,...t};return Promise.all(s.Vr.batch(()=>this.#l.findAll(e).map(e=>e.cancel(r)))).then(n.ZT).catch(n.ZT)}invalidateQueries(e,t={}){return s.Vr.batch(()=>(this.#l.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType==="none")?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t))}refetchQueries(e,t={}){let r={...t,cancelRefetch:t.cancelRefetch??!0};return Promise.all(s.Vr.batch(()=>this.#l.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,r);return r.throwOnError||(t=t.catch(n.ZT)),"paused"===e.state.fetchStatus?Promise.resolve():t}))).then(n.ZT)}fetchQuery(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let r=this.#l.build(this,t);return r.isStaleByTime((0,n.KC)(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(n.ZT).catch(n.ZT)}fetchInfiniteQuery(e){return e.behavior=d(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(n.ZT).catch(n.ZT)}ensureInfiniteQueryData(e){return e.behavior=d(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return f.N.isOnline()?this.#r.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#l}getMutationCache(){return this.#r}getDefaultOptions(){return this.#c}setDefaultOptions(e){this.#c=e}setQueryDefaults(e,t){this.#h.set((0,n.Ym)(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#h.values()],r={};return t.forEach(t=>{(0,n.to)(e,t.queryKey)&&Object.assign(r,t.defaultOptions)}),r}setMutationDefaults(e,t){this.#f.set((0,n.Ym)(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#f.values()],r={};return t.forEach(t=>{(0,n.to)(e,t.mutationKey)&&Object.assign(r,t.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#c.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=(0,n.Rm)(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===n.CN&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#c.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#l.clear(),this.#r.clear()}}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2901-964a2f81e9258ad6.js b/litellm/proxy/_experimental/out/_next/static/chunks/2901-0cdd0656eb7463d6.js similarity index 100% rename from litellm/proxy/_experimental/out/_next/static/chunks/2901-964a2f81e9258ad6.js rename to litellm/proxy/_experimental/out/_next/static/chunks/2901-0cdd0656eb7463d6.js diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/3163-8b2c3b9e10ac4f04.js b/litellm/proxy/_experimental/out/_next/static/chunks/3163-8b2c3b9e10ac4f04.js new file mode 100644 index 00000000000..9bfb3112851 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/3163-8b2c3b9e10ac4f04.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3163],{15327:function(e,o,r){r.d(o,{Z:function(){return a}});var n=r(1119),t=r(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z"}}]},name:"left",theme:"outlined"},l=r(55015),a=t.forwardRef(function(e,o){return t.createElement(l.Z,(0,n.Z)({},e,{ref:o,icon:c}))})},3632:function(e,o,r){r.d(o,{Z:function(){return a}});var n=r(1119),t=r(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"},l=r(55015),a=t.forwardRef(function(e,o){return t.createElement(l.Z,(0,n.Z)({},e,{ref:o,icon:c}))})},15883:function(e,o,r){r.d(o,{Z:function(){return a}});var n=r(1119),t=r(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M858.5 763.6a374 374 0 00-80.6-119.5 375.63 375.63 0 00-119.5-80.6c-.4-.2-.8-.3-1.2-.5C719.5 518 760 444.7 760 362c0-137-111-248-248-248S264 225 264 362c0 82.7 40.5 156 102.8 201.1-.4.2-.8.3-1.2.5-44.8 18.9-85 46-119.5 80.6a375.63 375.63 0 00-80.6 119.5A371.7 371.7 0 00136 901.8a8 8 0 008 8.2h60c4.4 0 7.9-3.5 8-7.8 2-77.2 33-149.5 87.8-204.3 56.7-56.7 132-87.9 212.2-87.9s155.5 31.2 212.2 87.9C779 752.7 810 825 812 902.2c.1 4.4 3.6 7.8 8 7.8h60a8 8 0 008-8.2c-1-47.8-10.9-94.3-29.5-138.2zM512 534c-45.9 0-89.1-17.9-121.6-50.4S340 407.9 340 362c0-45.9 17.9-89.1 50.4-121.6S466.1 190 512 190s89.1 17.9 121.6 50.4S684 316.1 684 362c0 45.9-17.9 89.1-50.4 121.6S557.9 534 512 534z"}}]},name:"user",theme:"outlined"},l=r(55015),a=t.forwardRef(function(e,o){return t.createElement(l.Z,(0,n.Z)({},e,{ref:o,icon:c}))})},67101:function(e,o,r){r.d(o,{Z:function(){return d}});var n=r(5853),t=r(13241),c=r(1153),l=r(2265),a=r(9496);let s=(0,c.fn)("Grid"),i=(e,o)=>e&&Object.keys(o).includes(String(e))?o[e]:"",d=l.forwardRef((e,o)=>{let{numItems:r=1,numItemsSm:c,numItemsMd:d,numItemsLg:u,children:g,className:m}=e,p=(0,n._T)(e,["numItems","numItemsSm","numItemsMd","numItemsLg","children","className"]),f=i(r,a._m),h=i(c,a.LH),b=i(d,a.l5),v=i(u,a.N4),k=(0,t.q)(f,h,b,v);return l.createElement("div",Object.assign({ref:o,className:(0,t.q)(s("root"),"grid",k,m)},p),g)});d.displayName="Grid"},9496:function(e,o,r){r.d(o,{LH:function(){return t},N4:function(){return l},PT:function(){return a},SP:function(){return s},VS:function(){return i},_m:function(){return n},_w:function(){return d},l5:function(){return c}});let n={0:"grid-cols-none",1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6",7:"grid-cols-7",8:"grid-cols-8",9:"grid-cols-9",10:"grid-cols-10",11:"grid-cols-11",12:"grid-cols-12"},t={0:"sm:grid-cols-none",1:"sm:grid-cols-1",2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6",7:"sm:grid-cols-7",8:"sm:grid-cols-8",9:"sm:grid-cols-9",10:"sm:grid-cols-10",11:"sm:grid-cols-11",12:"sm:grid-cols-12"},c={0:"md:grid-cols-none",1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3",4:"md:grid-cols-4",5:"md:grid-cols-5",6:"md:grid-cols-6",7:"md:grid-cols-7",8:"md:grid-cols-8",9:"md:grid-cols-9",10:"md:grid-cols-10",11:"md:grid-cols-11",12:"md:grid-cols-12"},l={0:"lg:grid-cols-none",1:"lg:grid-cols-1",2:"lg:grid-cols-2",3:"lg:grid-cols-3",4:"lg:grid-cols-4",5:"lg:grid-cols-5",6:"lg:grid-cols-6",7:"lg:grid-cols-7",8:"lg:grid-cols-8",9:"lg:grid-cols-9",10:"lg:grid-cols-10",11:"lg:grid-cols-11",12:"lg:grid-cols-12"},a={1:"col-span-1",2:"col-span-2",3:"col-span-3",4:"col-span-4",5:"col-span-5",6:"col-span-6",7:"col-span-7",8:"col-span-8",9:"col-span-9",10:"col-span-10",11:"col-span-11",12:"col-span-12",13:"col-span-13"},s={1:"sm:col-span-1",2:"sm:col-span-2",3:"sm:col-span-3",4:"sm:col-span-4",5:"sm:col-span-5",6:"sm:col-span-6",7:"sm:col-span-7",8:"sm:col-span-8",9:"sm:col-span-9",10:"sm:col-span-10",11:"sm:col-span-11",12:"sm:col-span-12",13:"sm:col-span-13"},i={1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3",4:"md:col-span-4",5:"md:col-span-5",6:"md:col-span-6",7:"md:col-span-7",8:"md:col-span-8",9:"md:col-span-9",10:"md:col-span-10",11:"md:col-span-11",12:"md:col-span-12",13:"md:col-span-13"},d={1:"lg:col-span-1",2:"lg:col-span-2",3:"lg:col-span-3",4:"lg:col-span-4",5:"lg:col-span-5",6:"lg:col-span-6",7:"lg:col-span-7",8:"lg:col-span-8",9:"lg:col-span-9",10:"lg:col-span-10",11:"lg:col-span-11",12:"lg:col-span-12",13:"lg:col-span-13"}},3810:function(e,o,r){r.d(o,{Z:function(){return N}});var n=r(2265),t=r(36760),c=r.n(t),l=r(18694),a=r(93350),s=r(53445),i=r(19722),d=r(6694),u=r(71744),g=r(93463),m=r(54558),p=r(12918),f=r(71140),h=r(99320);let b=e=>{let{paddingXXS:o,lineWidth:r,tagPaddingHorizontal:n,componentCls:t,calc:c}=e,l=c(n).sub(r).equal(),a=c(o).sub(r).equal();return{[t]:Object.assign(Object.assign({},(0,p.Wf)(e)),{display:"inline-block",height:"auto",marginInlineEnd:e.marginXS,paddingInline:l,fontSize:e.tagFontSize,lineHeight:e.tagLineHeight,whiteSpace:"nowrap",background:e.defaultBg,border:"".concat((0,g.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder),borderRadius:e.borderRadiusSM,opacity:1,transition:"all ".concat(e.motionDurationMid),textAlign:"start",position:"relative",["&".concat(t,"-rtl")]:{direction:"rtl"},"&, a, a:hover":{color:e.defaultColor},["".concat(t,"-close-icon")]:{marginInlineStart:a,fontSize:e.tagIconSize,color:e.colorIcon,cursor:"pointer",transition:"all ".concat(e.motionDurationMid),"&:hover":{color:e.colorTextHeading}},["&".concat(t,"-has-color")]:{borderColor:"transparent",["&, a, a:hover, ".concat(e.iconCls,"-close, ").concat(e.iconCls,"-close:hover")]:{color:e.colorTextLightSolid}},"&-checkable":{backgroundColor:"transparent",borderColor:"transparent",cursor:"pointer",["&:not(".concat(t,"-checkable-checked):hover")]:{color:e.colorPrimary,backgroundColor:e.colorFillSecondary},"&:active, &-checked":{color:e.colorTextLightSolid},"&-checked":{backgroundColor:e.colorPrimary,"&:hover":{backgroundColor:e.colorPrimaryHover}},"&:active":{backgroundColor:e.colorPrimaryActive}},"&-hidden":{display:"none"},["> ".concat(e.iconCls," + span, > span + ").concat(e.iconCls)]:{marginInlineStart:l}}),["".concat(t,"-borderless")]:{borderColor:"transparent",background:e.tagBorderlessBg}}},v=e=>{let{lineWidth:o,fontSizeIcon:r,calc:n}=e,t=e.fontSizeSM;return(0,f.IX)(e,{tagFontSize:t,tagLineHeight:(0,g.bf)(n(e.lineHeightSM).mul(t).equal()),tagIconSize:n(r).sub(n(o).mul(2)).equal(),tagPaddingHorizontal:8,tagBorderlessBg:e.defaultBg})},k=e=>({defaultBg:new m.t(e.colorFillQuaternary).onBackground(e.colorBgContainer).toHexString(),defaultColor:e.colorText});var w=(0,h.I$)("Tag",e=>b(v(e)),k),C=function(e,o){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>o.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var t=0,n=Object.getOwnPropertySymbols(e);to.indexOf(n[t])&&Object.prototype.propertyIsEnumerable.call(e,n[t])&&(r[n[t]]=e[n[t]]);return r};let y=n.forwardRef((e,o)=>{let{prefixCls:r,style:t,className:l,checked:a,children:s,icon:i,onChange:d,onClick:g}=e,m=C(e,["prefixCls","style","className","checked","children","icon","onChange","onClick"]),{getPrefixCls:p,tag:f}=n.useContext(u.E_),h=p("tag",r),[b,v,k]=w(h),y=c()(h,"".concat(h,"-checkable"),{["".concat(h,"-checkable-checked")]:a},null==f?void 0:f.className,l,v,k);return b(n.createElement("span",Object.assign({},m,{ref:o,style:Object.assign(Object.assign({},t),null==f?void 0:f.style),className:y,onClick:e=>{null==d||d(!a),null==g||g(e)}}),i,n.createElement("span",null,s)))});var x=r(18536);let E=e=>(0,x.Z)(e,(o,r)=>{let{textColor:n,lightBorderColor:t,lightColor:c,darkColor:l}=r;return{["".concat(e.componentCls).concat(e.componentCls,"-").concat(o)]:{color:n,background:c,borderColor:t,"&-inverse":{color:e.colorTextLightSolid,background:l,borderColor:l},["&".concat(e.componentCls,"-borderless")]:{borderColor:"transparent"}}}});var O=(0,h.bk)(["Tag","preset"],e=>E(v(e)),k);let S=(e,o,r)=>{let n="string"!=typeof r?r:r.charAt(0).toUpperCase()+r.slice(1);return{["".concat(e.componentCls).concat(e.componentCls,"-").concat(o)]:{color:e["color".concat(r)],background:e["color".concat(n,"Bg")],borderColor:e["color".concat(n,"Border")],["&".concat(e.componentCls,"-borderless")]:{borderColor:"transparent"}}}};var j=(0,h.bk)(["Tag","status"],e=>{let o=v(e);return[S(o,"success","Success"),S(o,"processing","Info"),S(o,"error","Error"),S(o,"warning","Warning")]},k),L=function(e,o){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>o.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var t=0,n=Object.getOwnPropertySymbols(e);to.indexOf(n[t])&&Object.prototype.propertyIsEnumerable.call(e,n[t])&&(r[n[t]]=e[n[t]]);return r};let Z=n.forwardRef((e,o)=>{let{prefixCls:r,className:t,rootClassName:g,style:m,children:p,icon:f,color:h,onClose:b,bordered:v=!0,visible:k}=e,C=L(e,["prefixCls","className","rootClassName","style","children","icon","color","onClose","bordered","visible"]),{getPrefixCls:y,direction:x,tag:E}=n.useContext(u.E_),[S,Z]=n.useState(!0),N=(0,l.Z)(C,["closeIcon","closable"]);n.useEffect(()=>{void 0!==k&&Z(k)},[k]);let B=(0,a.o2)(h),I=(0,a.yT)(h),M=B||I,R=Object.assign(Object.assign({backgroundColor:h&&!M?h:void 0},null==E?void 0:E.style),m),z=y("tag",r),[P,T,H]=w(z),W=c()(z,null==E?void 0:E.className,{["".concat(z,"-").concat(h)]:M,["".concat(z,"-has-color")]:h&&!M,["".concat(z,"-hidden")]:!S,["".concat(z,"-rtl")]:"rtl"===x,["".concat(z,"-borderless")]:!v},t,g,T,H),_=e=>{e.stopPropagation(),null==b||b(e),e.defaultPrevented||Z(!1)},[,A]=(0,s.b)((0,s.w)(e),(0,s.w)(E),{closable:!1,closeIconRender:e=>{let o=n.createElement("span",{className:"".concat(z,"-close-icon"),onClick:_},e);return(0,i.wm)(e,o,e=>({onClick:o=>{var r;null===(r=null==e?void 0:e.onClick)||void 0===r||r.call(e,o),_(o)},className:c()(null==e?void 0:e.className,"".concat(z,"-close-icon"))}))}}),V="function"==typeof C.onClick||p&&"a"===p.type,q=f||null,F=q?n.createElement(n.Fragment,null,q,p&&n.createElement("span",null,p)):p,U=n.createElement("span",Object.assign({},N,{ref:o,className:W,style:R}),F,A,B&&n.createElement(O,{key:"preset",prefixCls:z}),I&&n.createElement(j,{key:"status",prefixCls:z}));return P(V?n.createElement(d.Z,{component:"Tag"},U):U)});Z.CheckableTag=y;var N=Z},79205:function(e,o,r){r.d(o,{Z:function(){return u}});var n=r(2265);let t=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),c=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,o,r)=>r?r.toUpperCase():o.toLowerCase()),l=e=>{let o=c(e);return o.charAt(0).toUpperCase()+o.slice(1)},a=function(){for(var e=arguments.length,o=Array(e),r=0;r!!e&&""!==e.trim()&&r.indexOf(e)===o).join(" ").trim()},s=e=>{for(let o in e)if(o.startsWith("aria-")||"role"===o||"title"===o)return!0};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let d=(0,n.forwardRef)((e,o)=>{let{color:r="currentColor",size:t=24,strokeWidth:c=2,absoluteStrokeWidth:l,className:d="",children:u,iconNode:g,...m}=e;return(0,n.createElement)("svg",{ref:o,...i,width:t,height:t,stroke:r,strokeWidth:l?24*Number(c)/Number(t):c,className:a("lucide",d),...!u&&!s(m)&&{"aria-hidden":"true"},...m},[...g.map(e=>{let[o,r]=e;return(0,n.createElement)(o,r)}),...Array.isArray(u)?u:[u]])}),u=(e,o)=>{let r=(0,n.forwardRef)((r,c)=>{let{className:s,...i}=r;return(0,n.createElement)(d,{ref:c,iconNode:o,className:a("lucide-".concat(t(l(e))),"lucide-".concat(e),s),...i})});return r.displayName=l(e),r}},30401:function(e,o,r){r.d(o,{Z:function(){return n}});let n=(0,r(79205).Z)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},78867:function(e,o,r){r.d(o,{Z:function(){return n}});let n=(0,r(79205).Z)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},77331:function(e,o,r){var n=r(2265);let t=n.forwardRef(function(e,o){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:o},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"}))});o.Z=t},86462:function(e,o,r){var n=r(2265);let t=n.forwardRef(function(e,o){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:o},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"}))});o.Z=t},44633:function(e,o,r){var n=r(2265);let t=n.forwardRef(function(e,o){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:o},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"}))});o.Z=t},93416:function(e,o,r){var n=r(2265);let t=n.forwardRef(function(e,o){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:o},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))});o.Z=t},49084:function(e,o,r){var n=r(2265);let t=n.forwardRef(function(e,o){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:o},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"}))});o.Z=t}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/3250-6c57da6c11f342fa.js b/litellm/proxy/_experimental/out/_next/static/chunks/3250-6c57da6c11f342fa.js deleted file mode 100644 index c8c793ed69b..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/3250-6c57da6c11f342fa.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3250],{49634:function(e,r,o){o.d(r,{Z:function(){return s}});var t=o(1119),l=o(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zm-40 656H184V460h656v380zM184 392V256h128v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v136H184z"}}]},name:"calendar",theme:"outlined"},n=o(55015),s=l.forwardRef(function(e,r){return l.createElement(n.Z,(0,t.Z)({},e,{ref:r,icon:a}))})},94789:function(e,r,o){o.d(r,{Z:function(){return d}});var t=o(5853),l=o(2265),a=o(26898),n=o(13241),s=o(1153);let i=(0,s.fn)("Callout"),d=l.forwardRef((e,r)=>{let{title:o,icon:d,color:c,className:m,children:p}=e,u=(0,t._T)(e,["title","icon","color","className","children"]);return l.createElement("div",Object.assign({ref:r,className:(0,n.q)(i("root"),"flex flex-col overflow-hidden rounded-tremor-default text-tremor-default border-l-4 py-3 pr-3 pl-4",c?(0,n.q)((0,s.bM)(c,a.K.background).bgColor,(0,s.bM)(c,a.K.darkBorder).borderColor,(0,s.bM)(c,a.K.darkText).textColor,"dark:bg-opacity-10 bg-opacity-10"):(0,n.q)("bg-tremor-brand-faint border-tremor-brand-emphasis text-tremor-brand-emphasis","dark:bg-dark-tremor-brand-muted/70 dark:border-dark-tremor-brand-emphasis dark:text-dark-tremor-brand-emphasis"),m)},u),l.createElement("div",{className:(0,n.q)(i("header"),"flex items-start")},d?l.createElement(d,{className:(0,n.q)(i("icon"),"flex-none h-5 w-5 mr-1.5")}):null,l.createElement("h4",{className:(0,n.q)(i("title"),"font-semibold")},o)),l.createElement("p",{className:(0,n.q)(i("body"),"overflow-y-auto",p?"mt-2":"")},p))});d.displayName="Callout"},35829:function(e,r,o){o.d(r,{Z:function(){return i}});var t=o(5853),l=o(26898),a=o(13241),n=o(1153),s=o(2265);let i=s.forwardRef((e,r)=>{let{color:o,children:i,className:d}=e,c=(0,t._T)(e,["color","children","className"]);return s.createElement("p",Object.assign({ref:r,className:(0,a.q)("font-semibold text-tremor-metric",o?(0,n.bM)(o,l.K.darkText).textColor:"text-tremor-content-strong dark:text-dark-tremor-content-strong",d)},c),i)});i.displayName="Metric"},49096:function(e,r,o){o.d(r,{ZD:function(){return a}});var t=o(87602);let l=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,a=e=>{let r=function(){for(var r,o,l=arguments.length,a=Array(l),n=0;n{let t=Object.fromEntries(Object.entries(e||{}).filter(e=>{let[r]=e;return!["class","className"].includes(r)}));return r(o.map(e=>e(t)),null==e?void 0:e.class,null==e?void 0:e.className)}},cva:e=>o=>{var t;if((null==e?void 0:e.variants)==null)return r(null==e?void 0:e.base,null==o?void 0:o.class,null==o?void 0:o.className);let{variants:a,defaultVariants:n}=e,s=Object.keys(a).map(e=>{let r=null==o?void 0:o[e],t=null==n?void 0:n[e],s=l(r)||l(t);return a[e][s]}),i={...n,...o&&Object.entries(o).reduce((e,r)=>{let[o,t]=r;return void 0===t?e:{...e,[o]:t}},{})},d=null==e?void 0:null===(t=e.compoundVariants)||void 0===t?void 0:t.reduce((e,r)=>{let{class:o,className:t,...l}=r;return Object.entries(l).every(e=>{let[r,o]=e,t=i[r];return Array.isArray(o)?o.includes(t):t===o})?[...e,o,t]:e},[]);return r(null==e?void 0:e.base,s,d,null==o?void 0:o.class,null==o?void 0:o.className)},cx:r}},{compose:n,cva:s,cx:i}=a()},53335:function(e,r,o){o.d(r,{m6:function(){return ev}});let t=(e,r)=>{let o=Array(e.length+r.length);for(let r=0;r({classGroupId:e,validator:r}),a=(e=new Map,r=null,o)=>({nextPart:e,validators:r,classGroupId:o}),n=[],s=e=>{let r=c(e),{conflictingClassGroups:o,conflictingClassGroupModifiers:l}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return d(e);let o=e.split("-"),t=""===o[0]&&o.length>1?1:0;return i(o,t,r)},getConflictingClassGroupIds:(e,r)=>{if(r){let r=l[e],a=o[e];return r?a?t(a,r):r:a||n}return o[e]||n}}},i=(e,r,o)=>{if(0==e.length-r)return o.classGroupId;let t=e[r],l=o.nextPart.get(t);if(l){let o=i(e,r+1,l);if(o)return o}let a=o.validators;if(null===a)return;let n=0===r?e.join("-"):e.slice(r).join("-"),s=a.length;for(let e=0;e-1===e.slice(1,-1).indexOf(":")?void 0:(()=>{let r=e.slice(1,-1),o=r.indexOf(":"),t=r.slice(0,o);return t?"arbitrary.."+t:void 0})(),c=e=>{let{theme:r,classGroups:o}=e;return m(o,r)},m=(e,r)=>{let o=a();for(let t in e)p(e[t],o,t,r);return o},p=(e,r,o,t)=>{let l=e.length;for(let a=0;a{if("string"==typeof e){b(e,r,o);return}if("function"==typeof e){f(e,r,o,t);return}g(e,r,o,t)},b=(e,r,o)=>{(""===e?r:h(r,e)).classGroupId=o},f=(e,r,o,t)=>{if(k(e)){p(e(t),r,o,t);return}null===r.validators&&(r.validators=[]),r.validators.push(l(o,e))},g=(e,r,o,t)=>{let l=Object.entries(e),a=l.length;for(let e=0;e{let o=e,t=r.split("-"),l=t.length;for(let e=0;e"isThemeGetter"in e&&!0===e.isThemeGetter,v=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let r=0,o=Object.create(null),t=Object.create(null),l=(l,a)=>{o[l]=a,++r>e&&(r=0,t=o,o=Object.create(null))};return{get(e){let r=o[e];return void 0!==r?r:void 0!==(r=t[e])?(l(e,r),r):void 0},set(e,r){e in o?o[e]=r:l(e,r)}}},x=[],w=(e,r,o,t,l)=>({modifiers:e,hasImportantModifier:r,baseClassName:o,maybePostfixModifierPosition:t,isExternal:l}),y=e=>{let{prefix:r,experimentalParseClassName:o}=e,t=e=>{let r;let o=[],t=0,l=0,a=0,n=e.length;for(let s=0;sa?r-a:void 0)};if(r){let e=r+":",o=t;t=r=>r.startsWith(e)?o(r.slice(e.length)):w(x,!1,r,void 0,!0)}if(o){let e=t;t=r=>o({className:r,parseClassName:e})}return t},z=e=>{let r=new Map;return e.orderSensitiveModifiers.forEach((e,o)=>{r.set(e,1e6+o)}),e=>{let o=[],t=[];for(let l=0;l0&&(t.sort(),o.push(...t),t=[]),o.push(a)):t.push(a)}return t.length>0&&(t.sort(),o.push(...t)),o}},j=e=>({cache:v(e.cacheSize),parseClassName:y(e),sortModifiers:z(e),...s(e)}),N=/\s+/,C=(e,r)=>{let{parseClassName:o,getClassGroupId:t,getConflictingClassGroupIds:l,sortModifiers:a}=r,n=[],s=e.trim().split(N),i="";for(let e=s.length-1;e>=0;e-=1){let r=s[e],{isExternal:d,modifiers:c,hasImportantModifier:m,baseClassName:p,maybePostfixModifierPosition:u}=o(r);if(d){i=r+(i.length>0?" "+i:i);continue}let b=!!u,f=t(b?p.substring(0,u):p);if(!f){if(!b||!(f=t(p))){i=r+(i.length>0?" "+i:i);continue}b=!1}let g=0===c.length?"":1===c.length?c[0]:a(c).join(":"),h=m?g+"!":g,k=h+f;if(n.indexOf(k)>-1)continue;n.push(k);let v=l(f,b);for(let e=0;e0?" "+i:i)}return i},O=(...e)=>{let r,o,t=0,l="";for(;t{let r;if("string"==typeof e)return e;let o="";for(let t=0;t{let r=r=>r[e]||E;return r.isThemeGetter=!0,r},q=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,W=/^\((?:(\w[\w-]*):)?(.+)\)$/i,$=/^\d+\/\d+$/,_=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,T=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,I=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Z=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,A=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,H=e=>$.test(e),K=e=>!!e&&!Number.isNaN(Number(e)),S=e=>!!e&&Number.isInteger(Number(e)),V=e=>e.endsWith("%")&&K(e.slice(0,-1)),P=e=>_.test(e),R=()=>!0,B=e=>T.test(e)&&!I.test(e),D=()=>!1,F=e=>Z.test(e),J=e=>A.test(e),L=e=>!U(e)&&!et(e),Q=e=>ec(e,eb,D),U=e=>q.test(e),X=e=>ec(e,ef,B),Y=e=>ec(e,eg,K),ee=e=>ec(e,ep,D),er=e=>ec(e,eu,J),eo=e=>ec(e,ek,F),et=e=>W.test(e),el=e=>em(e,ef),ea=e=>em(e,eh),en=e=>em(e,ep),es=e=>em(e,eb),ei=e=>em(e,eu),ed=e=>em(e,ek,!0),ec=(e,r,o)=>{let t=q.exec(e);return!!t&&(t[1]?r(t[1]):o(t[2]))},em=(e,r,o=!1)=>{let t=W.exec(e);return!!t&&(t[1]?r(t[1]):o)},ep=e=>"position"===e||"percentage"===e,eu=e=>"image"===e||"url"===e,eb=e=>"length"===e||"size"===e||"bg-size"===e,ef=e=>"length"===e,eg=e=>"number"===e,eh=e=>"family-name"===e,ek=e=>"shadow"===e,ev=((e,...r)=>{let o,t,l,a;let n=e=>{let r=t(e);if(r)return r;let a=C(e,o);return l(e,a),a};return a=s=>(t=(o=j(r.reduce((e,r)=>r(e),e()))).cache.get,l=o.cache.set,a=n,n(s)),(...e)=>a(O(...e))})(()=>{let e=G("color"),r=G("font"),o=G("text"),t=G("font-weight"),l=G("tracking"),a=G("leading"),n=G("breakpoint"),s=G("container"),i=G("spacing"),d=G("radius"),c=G("shadow"),m=G("inset-shadow"),p=G("text-shadow"),u=G("drop-shadow"),b=G("blur"),f=G("perspective"),g=G("aspect"),h=G("ease"),k=G("animate"),v=()=>["auto","avoid","all","avoid-page","page","left","right","column"],x=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],w=()=>[...x(),et,U],y=()=>["auto","hidden","clip","visible","scroll"],z=()=>["auto","contain","none"],j=()=>[et,U,i],N=()=>[H,"full","auto",...j()],C=()=>[S,"none","subgrid",et,U],O=()=>["auto",{span:["full",S,et,U]},S,et,U],M=()=>[S,"auto",et,U],E=()=>["auto","min","max","fr",et,U],q=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],W=()=>["start","end","center","stretch","center-safe","end-safe"],$=()=>["auto",...j()],_=()=>[H,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],T=()=>[e,et,U],I=()=>[...x(),en,ee,{position:[et,U]}],Z=()=>["no-repeat",{repeat:["","x","y","space","round"]}],A=()=>["auto","cover","contain",es,Q,{size:[et,U]}],B=()=>[V,el,X],D=()=>["","none","full",d,et,U],F=()=>["",K,el,X],J=()=>["solid","dashed","dotted","double"],ec=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],em=()=>[K,V,en,ee],ep=()=>["","none",b,et,U],eu=()=>["none",K,et,U],eb=()=>["none",K,et,U],ef=()=>[K,et,U],eg=()=>[H,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[P],breakpoint:[P],color:[R],container:[P],"drop-shadow":[P],ease:["in","out","in-out"],font:[L],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[P],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[P],shadow:[P],spacing:["px",K],text:[P],"text-shadow":[P],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",H,U,et,g]}],container:["container"],columns:[{columns:[K,U,et,s]}],"break-after":[{"break-after":v()}],"break-before":[{"break-before":v()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:w()}],overflow:[{overflow:y()}],"overflow-x":[{"overflow-x":y()}],"overflow-y":[{"overflow-y":y()}],overscroll:[{overscroll:z()}],"overscroll-x":[{"overscroll-x":z()}],"overscroll-y":[{"overscroll-y":z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:N()}],"inset-x":[{"inset-x":N()}],"inset-y":[{"inset-y":N()}],start:[{start:N()}],end:[{end:N()}],top:[{top:N()}],right:[{right:N()}],bottom:[{bottom:N()}],left:[{left:N()}],visibility:["visible","invisible","collapse"],z:[{z:[S,"auto",et,U]}],basis:[{basis:[H,"full","auto",s,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[K,H,"auto","initial","none",U]}],grow:[{grow:["",K,et,U]}],shrink:[{shrink:["",K,et,U]}],order:[{order:[S,"first","last","none",et,U]}],"grid-cols":[{"grid-cols":C()}],"col-start-end":[{col:O()}],"col-start":[{"col-start":M()}],"col-end":[{"col-end":M()}],"grid-rows":[{"grid-rows":C()}],"row-start-end":[{row:O()}],"row-start":[{"row-start":M()}],"row-end":[{"row-end":M()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":E()}],"auto-rows":[{"auto-rows":E()}],gap:[{gap:j()}],"gap-x":[{"gap-x":j()}],"gap-y":[{"gap-y":j()}],"justify-content":[{justify:[...q(),"normal"]}],"justify-items":[{"justify-items":[...W(),"normal"]}],"justify-self":[{"justify-self":["auto",...W()]}],"align-content":[{content:["normal",...q()]}],"align-items":[{items:[...W(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...W(),{baseline:["","last"]}]}],"place-content":[{"place-content":q()}],"place-items":[{"place-items":[...W(),"baseline"]}],"place-self":[{"place-self":["auto",...W()]}],p:[{p:j()}],px:[{px:j()}],py:[{py:j()}],ps:[{ps:j()}],pe:[{pe:j()}],pt:[{pt:j()}],pr:[{pr:j()}],pb:[{pb:j()}],pl:[{pl:j()}],m:[{m:$()}],mx:[{mx:$()}],my:[{my:$()}],ms:[{ms:$()}],me:[{me:$()}],mt:[{mt:$()}],mr:[{mr:$()}],mb:[{mb:$()}],ml:[{ml:$()}],"space-x":[{"space-x":j()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":j()}],"space-y-reverse":["space-y-reverse"],size:[{size:_()}],w:[{w:[s,"screen",..._()]}],"min-w":[{"min-w":[s,"screen","none",..._()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[n]},..._()]}],h:[{h:["screen","lh",..._()]}],"min-h":[{"min-h":["screen","lh","none",..._()]}],"max-h":[{"max-h":["screen","lh",..._()]}],"font-size":[{text:["base",o,el,X]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[t,et,Y]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",V,U]}],"font-family":[{font:[ea,U,r]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[l,et,U]}],"line-clamp":[{"line-clamp":[K,"none",et,Y]}],leading:[{leading:[a,...j()]}],"list-image":[{"list-image":["none",et,U]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",et,U]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:T()}],"text-color":[{text:T()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...J(),"wavy"]}],"text-decoration-thickness":[{decoration:[K,"from-font","auto",et,X]}],"text-decoration-color":[{decoration:T()}],"underline-offset":[{"underline-offset":[K,"auto",et,U]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",et,U]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",et,U]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:I()}],"bg-repeat":[{bg:Z()}],"bg-size":[{bg:A()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},S,et,U],radial:["",et,U],conic:[S,et,U]},ei,er]}],"bg-color":[{bg:T()}],"gradient-from-pos":[{from:B()}],"gradient-via-pos":[{via:B()}],"gradient-to-pos":[{to:B()}],"gradient-from":[{from:T()}],"gradient-via":[{via:T()}],"gradient-to":[{to:T()}],rounded:[{rounded:D()}],"rounded-s":[{"rounded-s":D()}],"rounded-e":[{"rounded-e":D()}],"rounded-t":[{"rounded-t":D()}],"rounded-r":[{"rounded-r":D()}],"rounded-b":[{"rounded-b":D()}],"rounded-l":[{"rounded-l":D()}],"rounded-ss":[{"rounded-ss":D()}],"rounded-se":[{"rounded-se":D()}],"rounded-ee":[{"rounded-ee":D()}],"rounded-es":[{"rounded-es":D()}],"rounded-tl":[{"rounded-tl":D()}],"rounded-tr":[{"rounded-tr":D()}],"rounded-br":[{"rounded-br":D()}],"rounded-bl":[{"rounded-bl":D()}],"border-w":[{border:F()}],"border-w-x":[{"border-x":F()}],"border-w-y":[{"border-y":F()}],"border-w-s":[{"border-s":F()}],"border-w-e":[{"border-e":F()}],"border-w-t":[{"border-t":F()}],"border-w-r":[{"border-r":F()}],"border-w-b":[{"border-b":F()}],"border-w-l":[{"border-l":F()}],"divide-x":[{"divide-x":F()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":F()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...J(),"hidden","none"]}],"divide-style":[{divide:[...J(),"hidden","none"]}],"border-color":[{border:T()}],"border-color-x":[{"border-x":T()}],"border-color-y":[{"border-y":T()}],"border-color-s":[{"border-s":T()}],"border-color-e":[{"border-e":T()}],"border-color-t":[{"border-t":T()}],"border-color-r":[{"border-r":T()}],"border-color-b":[{"border-b":T()}],"border-color-l":[{"border-l":T()}],"divide-color":[{divide:T()}],"outline-style":[{outline:[...J(),"none","hidden"]}],"outline-offset":[{"outline-offset":[K,et,U]}],"outline-w":[{outline:["",K,el,X]}],"outline-color":[{outline:T()}],shadow:[{shadow:["","none",c,ed,eo]}],"shadow-color":[{shadow:T()}],"inset-shadow":[{"inset-shadow":["none",m,ed,eo]}],"inset-shadow-color":[{"inset-shadow":T()}],"ring-w":[{ring:F()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:T()}],"ring-offset-w":[{"ring-offset":[K,X]}],"ring-offset-color":[{"ring-offset":T()}],"inset-ring-w":[{"inset-ring":F()}],"inset-ring-color":[{"inset-ring":T()}],"text-shadow":[{"text-shadow":["none",p,ed,eo]}],"text-shadow-color":[{"text-shadow":T()}],opacity:[{opacity:[K,et,U]}],"mix-blend":[{"mix-blend":[...ec(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ec()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[K]}],"mask-image-linear-from-pos":[{"mask-linear-from":em()}],"mask-image-linear-to-pos":[{"mask-linear-to":em()}],"mask-image-linear-from-color":[{"mask-linear-from":T()}],"mask-image-linear-to-color":[{"mask-linear-to":T()}],"mask-image-t-from-pos":[{"mask-t-from":em()}],"mask-image-t-to-pos":[{"mask-t-to":em()}],"mask-image-t-from-color":[{"mask-t-from":T()}],"mask-image-t-to-color":[{"mask-t-to":T()}],"mask-image-r-from-pos":[{"mask-r-from":em()}],"mask-image-r-to-pos":[{"mask-r-to":em()}],"mask-image-r-from-color":[{"mask-r-from":T()}],"mask-image-r-to-color":[{"mask-r-to":T()}],"mask-image-b-from-pos":[{"mask-b-from":em()}],"mask-image-b-to-pos":[{"mask-b-to":em()}],"mask-image-b-from-color":[{"mask-b-from":T()}],"mask-image-b-to-color":[{"mask-b-to":T()}],"mask-image-l-from-pos":[{"mask-l-from":em()}],"mask-image-l-to-pos":[{"mask-l-to":em()}],"mask-image-l-from-color":[{"mask-l-from":T()}],"mask-image-l-to-color":[{"mask-l-to":T()}],"mask-image-x-from-pos":[{"mask-x-from":em()}],"mask-image-x-to-pos":[{"mask-x-to":em()}],"mask-image-x-from-color":[{"mask-x-from":T()}],"mask-image-x-to-color":[{"mask-x-to":T()}],"mask-image-y-from-pos":[{"mask-y-from":em()}],"mask-image-y-to-pos":[{"mask-y-to":em()}],"mask-image-y-from-color":[{"mask-y-from":T()}],"mask-image-y-to-color":[{"mask-y-to":T()}],"mask-image-radial":[{"mask-radial":[et,U]}],"mask-image-radial-from-pos":[{"mask-radial-from":em()}],"mask-image-radial-to-pos":[{"mask-radial-to":em()}],"mask-image-radial-from-color":[{"mask-radial-from":T()}],"mask-image-radial-to-color":[{"mask-radial-to":T()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":x()}],"mask-image-conic-pos":[{"mask-conic":[K]}],"mask-image-conic-from-pos":[{"mask-conic-from":em()}],"mask-image-conic-to-pos":[{"mask-conic-to":em()}],"mask-image-conic-from-color":[{"mask-conic-from":T()}],"mask-image-conic-to-color":[{"mask-conic-to":T()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:I()}],"mask-repeat":[{mask:Z()}],"mask-size":[{mask:A()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",et,U]}],filter:[{filter:["","none",et,U]}],blur:[{blur:ep()}],brightness:[{brightness:[K,et,U]}],contrast:[{contrast:[K,et,U]}],"drop-shadow":[{"drop-shadow":["","none",u,ed,eo]}],"drop-shadow-color":[{"drop-shadow":T()}],grayscale:[{grayscale:["",K,et,U]}],"hue-rotate":[{"hue-rotate":[K,et,U]}],invert:[{invert:["",K,et,U]}],saturate:[{saturate:[K,et,U]}],sepia:[{sepia:["",K,et,U]}],"backdrop-filter":[{"backdrop-filter":["","none",et,U]}],"backdrop-blur":[{"backdrop-blur":ep()}],"backdrop-brightness":[{"backdrop-brightness":[K,et,U]}],"backdrop-contrast":[{"backdrop-contrast":[K,et,U]}],"backdrop-grayscale":[{"backdrop-grayscale":["",K,et,U]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[K,et,U]}],"backdrop-invert":[{"backdrop-invert":["",K,et,U]}],"backdrop-opacity":[{"backdrop-opacity":[K,et,U]}],"backdrop-saturate":[{"backdrop-saturate":[K,et,U]}],"backdrop-sepia":[{"backdrop-sepia":["",K,et,U]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":j()}],"border-spacing-x":[{"border-spacing-x":j()}],"border-spacing-y":[{"border-spacing-y":j()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",et,U]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[K,"initial",et,U]}],ease:[{ease:["linear","initial",h,et,U]}],delay:[{delay:[K,et,U]}],animate:[{animate:["none",k,et,U]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[f,et,U]}],"perspective-origin":[{"perspective-origin":w()}],rotate:[{rotate:eu()}],"rotate-x":[{"rotate-x":eu()}],"rotate-y":[{"rotate-y":eu()}],"rotate-z":[{"rotate-z":eu()}],scale:[{scale:eb()}],"scale-x":[{"scale-x":eb()}],"scale-y":[{"scale-y":eb()}],"scale-z":[{"scale-z":eb()}],"scale-3d":["scale-3d"],skew:[{skew:ef()}],"skew-x":[{"skew-x":ef()}],"skew-y":[{"skew-y":ef()}],transform:[{transform:[et,U,"","none","gpu","cpu"]}],"transform-origin":[{origin:w()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:eg()}],"translate-x":[{"translate-x":eg()}],"translate-y":[{"translate-y":eg()}],"translate-z":[{"translate-z":eg()}],"translate-none":["translate-none"],accent:[{accent:T()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:T()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",et,U]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",et,U]}],fill:[{fill:["none",...T()]}],"stroke-w":[{stroke:[K,el,X,Y]}],stroke:[{stroke:["none",...T()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}})}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/3341-852c4599adcc0f2b.js b/litellm/proxy/_experimental/out/_next/static/chunks/3341-852c4599adcc0f2b.js deleted file mode 100644 index 6647f108682..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/3341-852c4599adcc0f2b.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3341],{88009:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M464 144H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H212V212h200v200zm452-268H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H612V212h200v200zM464 544H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H212V612h200v200zm452-268H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H612V612h200v200z"}}]},name:"appstore",theme:"outlined"},i=r(55015),s=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},37527:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M894 462c30.9 0 43.8-39.7 18.7-58L530.8 126.2a31.81 31.81 0 00-37.6 0L111.3 404c-25.1 18.2-12.2 58 18.8 58H192v374h-72c-4.4 0-8 3.6-8 8v52c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-52c0-4.4-3.6-8-8-8h-72V462h62zM512 196.7l271.1 197.2H240.9L512 196.7zM264 462h117v374H264V462zm189 0h117v374H453V462zm307 374H642V462h118v374z"}}]},name:"bank",theme:"outlined"},i=r(55015),s=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},9775:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M888 792H200V168c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v688c0 4.4 3.6 8 8 8h752c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-600-80h56c4.4 0 8-3.6 8-8V560c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v144c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V384c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v320c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V462c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v242c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V304c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v400c0 4.4 3.6 8 8 8z"}}]},name:"bar-chart",theme:"outlined"},i=r(55015),s=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},11429:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M766.4 744.3c43.7 0 79.4-36.2 79.4-80.5 0-53.5-79.4-140.8-79.4-140.8S687 610.3 687 663.8c0 44.3 35.7 80.5 79.4 80.5zm-377.1-44.1c7.1 7.1 18.6 7.1 25.6 0l256.1-256c7.1-7.1 7.1-18.6 0-25.6l-256-256c-.6-.6-1.3-1.2-2-1.7l-78.2-78.2a9.11 9.11 0 00-12.8 0l-48 48a9.11 9.11 0 000 12.8l67.2 67.2-207.8 207.9c-7.1 7.1-7.1 18.6 0 25.6l255.9 256zm12.9-448.6l178.9 178.9H223.4l178.8-178.9zM904 816H120c-4.4 0-8 3.6-8 8v80c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-80c0-4.4-3.6-8-8-8z"}}]},name:"bg-colors",theme:"outlined"},i=r(55015),s=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},68208:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M856 376H648V168c0-8.8-7.2-16-16-16H168c-8.8 0-16 7.2-16 16v464c0 8.8 7.2 16 16 16h208v208c0 8.8 7.2 16 16 16h464c8.8 0 16-7.2 16-16V392c0-8.8-7.2-16-16-16zm-480 16v188H220V220h360v156H392c-8.8 0-16 7.2-16 16zm204 52v136H444V444h136zm224 360H444V648h188c8.8 0 16-7.2 16-16V444h156v360z"}}]},name:"block",theme:"outlined"},i=r(55015),s=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},83669:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"check-circle",theme:"outlined"},i=r(55015),s=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},99458:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-792 72h752v120H136V232zm752 560H136V440h752v352zm-237-64h165c4.4 0 8-3.6 8-8v-72c0-4.4-3.6-8-8-8H651c-4.4 0-8 3.6-8 8v72c0 4.4 3.6 8 8 8z"}}]},name:"credit-card",theme:"outlined"},i=r(55015),s=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},29271:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M464 688a48 48 0 1096 0 48 48 0 10-96 0zm24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8z"}}]},name:"exclamation-circle",theme:"outlined"},i=r(55015),s=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},41169:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 472a40 40 0 1080 0 40 40 0 10-80 0zm367 352.9L696.3 352V178H768v-68H256v68h71.7v174L145 824.9c-2.8 7.4-4.3 15.2-4.3 23.1 0 35.3 28.7 64 64 64h614.6c7.9 0 15.7-1.5 23.1-4.3 33-12.7 49.4-49.8 36.6-82.8zM395.7 364.7V180h232.6v184.7L719.2 600c-20.7-5.3-42.1-8-63.9-8-61.2 0-119.2 21.5-165.3 60a188.78 188.78 0 01-121.3 43.9c-32.7 0-64.1-8.3-91.8-23.7l118.8-307.5zM210.5 844l41.7-107.8c35.7 18.1 75.4 27.8 116.6 27.8 61.2 0 119.2-21.5 165.3-60 33.9-28.2 76.3-43.9 121.3-43.9 35 0 68.4 9.5 97.6 27.1L813.5 844h-603z"}}]},name:"experiment",theme:"outlined"},i=r(55015),s=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},34310:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM472 744a40 40 0 1080 0 40 40 0 10-80 0zm16-104h48c4.4 0 8-3.6 8-8V448c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v184c0 4.4 3.6 8 8 8z"}}]},name:"file-exclamation",theme:"outlined"},i=r(55015),s=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},10798:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880.1 154H143.9c-24.5 0-39.8 26.7-27.5 48L349 597.4V838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V597.4L907.7 202c12.2-21.3-3.1-48-27.6-48zM603.4 798H420.6V642h182.9v156zm9.6-236.6l-9.5 16.6h-183l-9.5-16.6L212.7 226h598.6L613 561.4z"}}]},name:"filter",theme:"outlined"},i=r(55015),s=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},48231:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M888 792H200V168c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v688c0 4.4 3.6 8 8 8h752c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM305.8 637.7c3.1 3.1 8.1 3.1 11.3 0l138.3-137.6L583 628.5c3.1 3.1 8.2 3.1 11.3 0l275.4-275.3c3.1-3.1 3.1-8.2 0-11.3l-39.6-39.6a8.03 8.03 0 00-11.3 0l-230 229.9L461.4 404a8.03 8.03 0 00-11.3 0L266.3 586.7a8.03 8.03 0 000 11.3l39.5 39.7z"}}]},name:"line-chart",theme:"outlined"},i=r(55015),s=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},62272:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M574 665.4a8.03 8.03 0 00-11.3 0L446.5 781.6c-53.8 53.8-144.6 59.5-204 0-59.5-59.5-53.8-150.2 0-204l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3l-39.8-39.8a8.03 8.03 0 00-11.3 0L191.4 526.5c-84.6 84.6-84.6 221.5 0 306s221.5 84.6 306 0l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3L574 665.4zm258.6-474c-84.6-84.6-221.5-84.6-306 0L410.3 307.6a8.03 8.03 0 000 11.3l39.7 39.7c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c53.8-53.8 144.6-59.5 204 0 59.5 59.5 53.8 150.2 0 204L665.3 562.6a8.03 8.03 0 000 11.3l39.8 39.8c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c84.5-84.6 84.5-221.5 0-306.1zM610.1 372.3a8.03 8.03 0 00-11.3 0L372.3 598.7a8.03 8.03 0 000 11.3l39.6 39.6c3.1 3.1 8.2 3.1 11.3 0l226.4-226.4c3.1-3.1 3.1-8.2 0-11.3l-39.5-39.6z"}}]},name:"link",theme:"outlined"},i=r(55015),s=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},28595:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M719.4 499.1l-296.1-215A15.9 15.9 0 00398 297v430c0 13.1 14.8 20.5 25.3 12.9l296.1-215a15.9 15.9 0 000-25.8zm-257.6 134V390.9L628.5 512 461.8 633.1z"}}]},name:"play-circle",theme:"outlined"},i=r(55015),s=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},34419:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M696 480H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"plus-circle",theme:"outlined"},i=r(55015),s=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},23907:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"defs",attrs:{},children:[{tag:"style",attrs:{}}]},{tag:"path",attrs:{d:"M931.4 498.9L94.9 79.5c-3.4-1.7-7.3-2.1-11-1.2a15.99 15.99 0 00-11.7 19.3l86.2 352.2c1.3 5.3 5.2 9.6 10.4 11.3l147.7 50.7-147.6 50.7c-5.2 1.8-9.1 6-10.3 11.3L72.2 926.5c-.9 3.7-.5 7.6 1.2 10.9 3.9 7.9 13.5 11.1 21.5 7.2l836.5-417c3.1-1.5 5.6-4.1 7.2-7.1 3.9-8 .7-17.6-7.2-21.6zM170.8 826.3l50.3-205.6 295.2-101.3c2.3-.8 4.2-2.6 5-5 1.4-4.2-.8-8.7-5-10.2L221.1 403 171 198.2l628 314.9-628.2 313.2z"}}]},name:"send",theme:"outlined"},i=r(55015),s=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},41361:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M824.2 699.9a301.55 301.55 0 00-86.4-60.4C783.1 602.8 812 546.8 812 484c0-110.8-92.4-201.7-203.2-200-109.1 1.7-197 90.6-197 200 0 62.8 29 118.8 74.2 155.5a300.95 300.95 0 00-86.4 60.4C345 754.6 314 826.8 312 903.8a8 8 0 008 8.2h56c4.3 0 7.9-3.4 8-7.7 1.9-58 25.4-112.3 66.7-153.5A226.62 226.62 0 01612 684c60.9 0 118.2 23.7 161.3 66.8C814.5 792 838 846.3 840 904.3c.1 4.3 3.7 7.7 8 7.7h56a8 8 0 008-8.2c-2-77-33-149.2-87.8-203.9zM612 612c-34.2 0-66.4-13.3-90.5-37.5a126.86 126.86 0 01-37.5-91.8c.3-32.8 13.4-64.5 36.3-88 24-24.6 56.1-38.3 90.4-38.7 33.9-.3 66.8 12.9 91 36.6 24.8 24.3 38.4 56.8 38.4 91.4 0 34.2-13.3 66.3-37.5 90.5A127.3 127.3 0 01612 612zM361.5 510.4c-.9-8.7-1.4-17.5-1.4-26.4 0-15.9 1.5-31.4 4.3-46.5.7-3.6-1.2-7.3-4.5-8.8-13.6-6.1-26.1-14.5-36.9-25.1a127.54 127.54 0 01-38.7-95.4c.9-32.1 13.8-62.6 36.3-85.6 24.7-25.3 57.9-39.1 93.2-38.7 31.9.3 62.7 12.6 86 34.4 7.9 7.4 14.7 15.6 20.4 24.4 2 3.1 5.9 4.4 9.3 3.2 17.6-6.1 36.2-10.4 55.3-12.4 5.6-.6 8.8-6.6 6.3-11.6-32.5-64.3-98.9-108.7-175.7-109.9-110.9-1.7-203.3 89.2-203.3 199.9 0 62.8 28.9 118.8 74.2 155.5-31.8 14.7-61.1 35-86.5 60.4-54.8 54.7-85.8 126.9-87.8 204a8 8 0 008 8.2h56.1c4.3 0 7.9-3.4 8-7.7 1.9-58 25.4-112.3 66.7-153.5 29.4-29.4 65.4-49.8 104.7-59.7 3.9-1 6.5-4.7 6-8.7z"}}]},name:"team",theme:"outlined"},i=r(55015),s=o.forwardRef(function(e,t){return o.createElement(i.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},92414:function(e,t,r){"use strict";r.d(t,{Z:function(){return b}});var n=r(5853),o=r(2265);r(42698),r(64016),r(8710);var a=r(33232),i=r(44140),s=r(58747);let l=e=>{var t=(0,n._T)(e,[]);return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),o.createElement("path",{d:"M18.031 16.6168L22.3137 20.8995L20.8995 22.3137L16.6168 18.031C15.0769 19.263 13.124 20 11 20C6.032 20 2 15.968 2 11C2 6.032 6.032 2 11 2C15.968 2 20 6.032 20 11C20 13.124 19.263 15.0769 18.031 16.6168ZM16.0247 15.8748C17.2475 14.6146 18 12.8956 18 11C18 7.1325 14.8675 4 11 4C7.1325 4 4 7.1325 4 11C4 14.8675 7.1325 18 11 18C12.8956 18 14.6146 17.2475 15.8748 16.0247L16.0247 15.8748Z"}))};var c=r(4537);let u=e=>{var t=(0,n._T)(e,[]);return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},t),o.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))};var d=r(13241),h=r(1153),f=r(96398),p=r(51975),m=r(85238);let g=(0,h.fn)("MultiSelect"),b=o.forwardRef((e,t)=>{let{defaultValue:r=[],value:h,onValueChange:b,placeholder:k="Select...",placeholderSearch:v="Search",disabled:y=!1,icon:w,children:x,className:C,required:E,name:_,error:O=!1,errorMessage:S,id:M}=e,R=(0,n._T)(e,["defaultValue","value","onValueChange","placeholder","placeholderSearch","disabled","icon","children","className","required","name","error","errorMessage","id"]),j=(0,o.useRef)(null),[N,z]=(0,i.Z)(r,h),{reactElementChildren:Z,optionsAvailable:L}=(0,o.useMemo)(()=>{let e=o.Children.toArray(x).filter(o.isValidElement);return{reactElementChildren:e,optionsAvailable:(0,f.n0)("",e)}},[x]),[T,I]=(0,o.useState)(""),A=(null!=N?N:[]).length>0,V=(0,o.useMemo)(()=>T?(0,f.n0)(T,Z):L,[T,Z,L]),q=()=>{I("")};return o.createElement("div",{className:(0,d.q)("w-full min-w-[10rem] text-tremor-default",C)},o.createElement("div",{className:"relative"},o.createElement("select",{title:"multi-select-hidden",required:E,className:(0,d.q)("h-full w-full absolute left-0 top-0 -z-10 opacity-0"),value:N,onChange:e=>{e.preventDefault()},name:_,disabled:y,multiple:!0,id:M,onFocus:()=>{let e=j.current;e&&e.focus()}},o.createElement("option",{className:"hidden",value:"",disabled:!0,hidden:!0},k),V.map(e=>{let t=e.props.value,r=e.props.children;return o.createElement("option",{className:"hidden",key:t,value:t},r)})),o.createElement(p.Ri,Object.assign({as:"div",ref:t,defaultValue:N,value:N,onChange:e=>{null==b||b(e),z(e)},disabled:y,id:M,multiple:!0},R),e=>{let{value:t}=e;return o.createElement(o.Fragment,null,o.createElement(p.Y4,{className:(0,d.q)("w-full outline-none text-left whitespace-nowrap truncate rounded-tremor-default focus:ring-2 transition duration-100 border pr-8 py-1.5","border-tremor-border shadow-tremor-input focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:border-dark-tremor-border dark:shadow-dark-tremor-input dark:focus:border-dark-tremor-brand-subtle dark:focus:ring-dark-tremor-brand-muted",w?"pl-11 -ml-0.5":"pl-3",(0,f.um)(t.length>0,y,O)),ref:j},w&&o.createElement("span",{className:(0,d.q)("absolute inset-y-0 left-0 flex items-center ml-px pl-2.5")},o.createElement(w,{className:(0,d.q)(g("Icon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})),o.createElement("div",{className:"h-6 flex items-center"},t.length>0?o.createElement("div",{className:"flex flex-nowrap overflow-x-scroll [&::-webkit-scrollbar]:hidden [scrollbar-width:none] gap-x-1 mr-5 -ml-1.5 relative"},L.filter(e=>t.includes(e.props.value)).map((e,r)=>{var n;return o.createElement("div",{key:r,className:(0,d.q)("max-w-[100px] lg:max-w-[200px] flex justify-center items-center pl-2 pr-1.5 py-1 font-medium","rounded-tremor-small","bg-tremor-background-muted dark:bg-dark-tremor-background-muted","bg-tremor-background-subtle dark:bg-dark-tremor-background-subtle","text-tremor-content-default dark:text-dark-tremor-content-default","text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis")},o.createElement("div",{className:"text-xs truncate "},null!==(n=e.props.children)&&void 0!==n?n:e.props.value),o.createElement("div",{onClick:r=>{r.preventDefault();let n=t.filter(t=>t!==e.props.value);null==b||b(n),z(n)}},o.createElement(u,{className:(0,d.q)(g("clearIconItem"),"cursor-pointer rounded-tremor-full w-3.5 h-3.5 ml-2","text-tremor-content-subtle hover:text-tremor-content","dark:text-dark-tremor-content-subtle dark:hover:text-tremor-content")})))})):o.createElement("span",null,k)),o.createElement("span",{className:(0,d.q)("absolute inset-y-0 right-0 flex items-center mr-2.5")},o.createElement(s.Z,{className:(0,d.q)(g("arrowDownIcon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}))),A&&!y?o.createElement("button",{type:"button",className:(0,d.q)("absolute inset-y-0 right-0 flex items-center mr-8"),onClick:e=>{e.preventDefault(),z([]),null==b||b([])}},o.createElement(c.Z,{className:(0,d.q)(g("clearIconAllItems"),"flex-none h-4 w-4","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})):null,o.createElement(m.u,{enter:"transition ease duration-100 transform",enterFrom:"opacity-0 -translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"transition ease duration-100 transform",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-4"},o.createElement(p.O_,{anchor:"bottom start",className:(0,d.q)("z-10 divide-y w-[var(--button-width)] overflow-y-auto outline-none rounded-tremor-default max-h-[228px] border [--anchor-gap:4px]","bg-tremor-background border-tremor-border divide-tremor-border shadow-tremor-dropdown","dark:bg-dark-tremor-background dark:border-dark-tremor-border dark:divide-dark-tremor-border dark:shadow-dark-tremor-dropdown")},o.createElement("div",{className:(0,d.q)("flex items-center w-full px-2.5","bg-tremor-background-muted","dark:bg-dark-tremor-background-muted")},o.createElement("span",null,o.createElement(l,{className:(0,d.q)("flex-none w-4 h-4 mr-2","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})),o.createElement("input",{name:"search",type:"input",autoComplete:"off",placeholder:v,className:(0,d.q)("w-full focus:outline-none focus:ring-none bg-transparent text-tremor-default py-2","text-tremor-content-emphasis","dark:text-dark-tremor-content-subtle"),onKeyDown:e=>{"Space"===e.code&&""!==e.target.value&&e.stopPropagation()},onChange:e=>I(e.target.value),value:T})),o.createElement(a.Z.Provider,Object.assign({},{onBlur:{handleResetSearch:q}},{value:{selectedValue:t}}),V))))})),O&&S?o.createElement("p",{className:(0,d.q)("errorMessage","text-sm text-rose-500 mt-1")},S):null)});b.displayName="MultiSelect"},46030:function(e,t,r){"use strict";r.d(t,{Z:function(){return u}});var n=r(5853);r(42698),r(64016),r(8710);var o=r(33232),a=r(2265),i=r(13241),s=r(1153),l=r(51975);let c=(0,s.fn)("MultiSelectItem"),u=a.forwardRef((e,t)=>{let{value:r,className:u,children:d}=e,h=(0,n._T)(e,["value","className","children"]),{selectedValue:f}=(0,a.useContext)(o.Z),p=(0,s.NZ)(r,f);return a.createElement(l.wt,Object.assign({className:(0,i.q)(c("root"),"flex justify-start items-center cursor-default text-tremor-default p-2.5","data-[focus]:bg-tremor-background-muted data-[focus]:text-tremor-content-strong data-[select]ed:text-tremor-content-strong text-tremor-content-emphasis","dark:data-[focus]:bg-dark-tremor-background-muted dark:data-[focus]:text-dark-tremor-content-strong dark:data-[select]ed:text-dark-tremor-content-strong dark:data-[select]ed:bg-dark-tremor-background-muted dark:text-dark-tremor-content-emphasis",u),ref:t,key:r,value:r},h),a.createElement("input",{type:"checkbox",className:(0,i.q)(c("checkbox"),"flex-none focus:ring-none focus:outline-none cursor-pointer mr-2.5","accent-tremor-brand","dark:accent-dark-tremor-brand"),checked:p,readOnly:!0}),a.createElement("span",{className:"whitespace-nowrap truncate"},null!=d?d:r))});u.displayName="MultiSelectItem"},49804:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var n=r(5853),o=r(13241),a=r(1153),i=r(2265),s=r(9496);let l=(0,a.fn)("Col"),c=i.forwardRef((e,t)=>{let{numColSpan:r=1,numColSpanSm:a,numColSpanMd:c,numColSpanLg:u,children:d,className:h}=e,f=(0,n._T)(e,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),p=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"";return i.createElement("div",Object.assign({ref:t,className:(0,o.q)(l("root"),(()=>{let e=p(r,s.PT),t=p(a,s.SP),n=p(c,s.VS),i=p(u,s._w);return(0,o.q)(e,t,n,i)})(),h)},f),d)});c.displayName="Col"},96889:function(e,t,r){"use strict";r.d(t,{Z:function(){return u}});var n=r(5853),o=r(2265),a=r(26898),i=r(13241),s=r(1153);let l=(0,s.fn)("BarList");function c(e,t){let{data:r=[],color:c,valueFormatter:u=s.Cj,showAnimation:d=!1,onValueChange:h,sortOrder:f="descending",className:p}=e,m=(0,n._T)(e,["data","color","valueFormatter","showAnimation","onValueChange","sortOrder","className"]),g=h?"button":"div",b=o.useMemo(()=>"none"===f?r:[...r].sort((e,t)=>"ascending"===f?e.value-t.value:t.value-e.value),[r,f]),k=o.useMemo(()=>{let e=Math.max(...b.map(e=>e.value),0);return b.map(t=>0===t.value?0:Math.max(t.value/e*100,2))},[b]);return o.createElement("div",Object.assign({ref:t,className:(0,i.q)(l("root"),"flex justify-between space-x-6",p),"aria-sort":f},m),o.createElement("div",{className:(0,i.q)(l("bars"),"relative w-full space-y-1.5")},b.map((e,t)=>{var r,n,u;let f=e.icon;return o.createElement(g,{key:null!==(r=e.key)&&void 0!==r?r:t,onClick:()=>{null==h||h(e)},className:(0,i.q)(l("bar"),"group w-full flex items-center rounded-tremor-small",h?["cursor-pointer","hover:bg-tremor-background-muted dark:hover:bg-dark-tremor-background-subtle/40"]:"")},o.createElement("div",{className:(0,i.q)("flex items-center rounded transition-all bg-opacity-40","h-8",e.color||c?[(0,s.bM)(null!==(n=e.color)&&void 0!==n?n:c,a.K.background).bgColor,h?"group-hover:bg-opacity-30":""]:"bg-tremor-brand-subtle dark:bg-dark-tremor-brand-subtle/60",!h||e.color||c?"":"group-hover:bg-tremor-brand-subtle/30 group-hover:dark:bg-dark-tremor-brand-subtle/70",t===b.length-1?"mb-0":"",d?"duration-500":""),style:{width:"".concat(k[t],"%"),transition:d?"all 1s":""}},o.createElement("div",{className:(0,i.q)("absolute left-2 pr-4 flex max-w-full")},f?o.createElement(f,{className:(0,i.q)(l("barIcon"),"flex-none h-5 w-5 mr-2","text-tremor-content","dark:text-dark-tremor-content")}):null,e.href?o.createElement("a",{href:e.href,target:null!==(u=e.target)&&void 0!==u?u:"_blank",rel:"noreferrer",className:(0,i.q)(l("barLink"),"whitespace-nowrap hover:underline truncate text-tremor-default",h?"cursor-pointer":"","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis"),onClick:e=>e.stopPropagation()},e.name):o.createElement("p",{className:(0,i.q)(l("barText"),"whitespace-nowrap truncate text-tremor-default","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},e.name))))})),o.createElement("div",{className:l("labels")},b.map((e,t)=>{var r;return o.createElement("div",{key:null!==(r=e.key)&&void 0!==r?r:t,className:(0,i.q)(l("labelWrapper"),"flex justify-end items-center","h-8",t===b.length-1?"mb-0":"mb-1.5")},o.createElement("p",{className:(0,i.q)(l("labelText"),"whitespace-nowrap leading-none truncate text-tremor-default","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},u(e.value)))})))}c.displayName="BarList";let u=o.forwardRef(c)},13817:function(e,t,r){"use strict";r.d(t,{default:function(){return w}});var n=r(83145),o=r(2265),a=r(36760),i=r.n(a),s=r(18694),l=r(71744),c=r(80856),u=r(45287),d=r(32186),h=r(25437),f=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);ot.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r};function p(e){let{suffixCls:t,tagName:r,displayName:n}=e;return e=>o.forwardRef((n,a)=>o.createElement(e,Object.assign({ref:a,suffixCls:t,tagName:r},n)))}let m=o.forwardRef((e,t)=>{let{prefixCls:r,suffixCls:n,className:a,tagName:s}=e,c=f(e,["prefixCls","suffixCls","className","tagName"]),{getPrefixCls:u}=o.useContext(l.E_),d=u("layout",r),[p,m,g]=(0,h.ZP)(d),b=n?"".concat(d,"-").concat(n):d;return p(o.createElement(s,Object.assign({className:i()(r||b,a,m,g),ref:t},c)))}),g=o.forwardRef((e,t)=>{let{direction:r}=o.useContext(l.E_),[a,p]=o.useState([]),{prefixCls:m,className:g,rootClassName:b,children:k,hasSider:v,tagName:y,style:w}=e,x=f(e,["prefixCls","className","rootClassName","children","hasSider","tagName","style"]),C=(0,s.Z)(x,["suffixCls"]),{getPrefixCls:E,className:_,style:O}=(0,l.dj)("layout"),S=E("layout",m),M="boolean"==typeof v?v:!!a.length||(0,u.Z)(k).some(e=>e.type===d.Z),[R,j,N]=(0,h.ZP)(S),z=i()(S,{["".concat(S,"-has-sider")]:M,["".concat(S,"-rtl")]:"rtl"===r},_,g,b,j,N),Z=o.useMemo(()=>({siderHook:{addSider:e=>{p(t=>[].concat((0,n.Z)(t),[e]))},removeSider:e=>{p(t=>t.filter(t=>t!==e))}}}),[]);return R(o.createElement(c.V.Provider,{value:Z},o.createElement(y,Object.assign({ref:t,className:z,style:Object.assign(Object.assign({},O),w)},C),k)))}),b=p({tagName:"div",displayName:"Layout"})(g),k=p({suffixCls:"header",tagName:"header",displayName:"Header"})(m),v=p({suffixCls:"footer",tagName:"footer",displayName:"Footer"})(m),y=p({suffixCls:"content",tagName:"main",displayName:"Content"})(m);b.Header=k,b.Footer=v,b.Content=y,b.Sider=d.Z,b._InternalSiderContext=d.D;var w=b},3810:function(e,t,r){"use strict";r.d(t,{Z:function(){return j}});var n=r(2265),o=r(36760),a=r.n(o),i=r(18694),s=r(93350),l=r(53445),c=r(19722),u=r(6694),d=r(71744),h=r(93463),f=r(54558),p=r(12918),m=r(71140),g=r(99320);let b=e=>{let{paddingXXS:t,lineWidth:r,tagPaddingHorizontal:n,componentCls:o,calc:a}=e,i=a(n).sub(r).equal(),s=a(t).sub(r).equal();return{[o]:Object.assign(Object.assign({},(0,p.Wf)(e)),{display:"inline-block",height:"auto",marginInlineEnd:e.marginXS,paddingInline:i,fontSize:e.tagFontSize,lineHeight:e.tagLineHeight,whiteSpace:"nowrap",background:e.defaultBg,border:"".concat((0,h.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder),borderRadius:e.borderRadiusSM,opacity:1,transition:"all ".concat(e.motionDurationMid),textAlign:"start",position:"relative",["&".concat(o,"-rtl")]:{direction:"rtl"},"&, a, a:hover":{color:e.defaultColor},["".concat(o,"-close-icon")]:{marginInlineStart:s,fontSize:e.tagIconSize,color:e.colorIcon,cursor:"pointer",transition:"all ".concat(e.motionDurationMid),"&:hover":{color:e.colorTextHeading}},["&".concat(o,"-has-color")]:{borderColor:"transparent",["&, a, a:hover, ".concat(e.iconCls,"-close, ").concat(e.iconCls,"-close:hover")]:{color:e.colorTextLightSolid}},"&-checkable":{backgroundColor:"transparent",borderColor:"transparent",cursor:"pointer",["&:not(".concat(o,"-checkable-checked):hover")]:{color:e.colorPrimary,backgroundColor:e.colorFillSecondary},"&:active, &-checked":{color:e.colorTextLightSolid},"&-checked":{backgroundColor:e.colorPrimary,"&:hover":{backgroundColor:e.colorPrimaryHover}},"&:active":{backgroundColor:e.colorPrimaryActive}},"&-hidden":{display:"none"},["> ".concat(e.iconCls," + span, > span + ").concat(e.iconCls)]:{marginInlineStart:i}}),["".concat(o,"-borderless")]:{borderColor:"transparent",background:e.tagBorderlessBg}}},k=e=>{let{lineWidth:t,fontSizeIcon:r,calc:n}=e,o=e.fontSizeSM;return(0,m.IX)(e,{tagFontSize:o,tagLineHeight:(0,h.bf)(n(e.lineHeightSM).mul(o).equal()),tagIconSize:n(r).sub(n(t).mul(2)).equal(),tagPaddingHorizontal:8,tagBorderlessBg:e.defaultBg})},v=e=>({defaultBg:new f.t(e.colorFillQuaternary).onBackground(e.colorBgContainer).toHexString(),defaultColor:e.colorText});var y=(0,g.I$)("Tag",e=>b(k(e)),v),w=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);ot.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r};let x=n.forwardRef((e,t)=>{let{prefixCls:r,style:o,className:i,checked:s,children:l,icon:c,onChange:u,onClick:h}=e,f=w(e,["prefixCls","style","className","checked","children","icon","onChange","onClick"]),{getPrefixCls:p,tag:m}=n.useContext(d.E_),g=p("tag",r),[b,k,v]=y(g),x=a()(g,"".concat(g,"-checkable"),{["".concat(g,"-checkable-checked")]:s},null==m?void 0:m.className,i,k,v);return b(n.createElement("span",Object.assign({},f,{ref:t,style:Object.assign(Object.assign({},o),null==m?void 0:m.style),className:x,onClick:e=>{null==u||u(!s),null==h||h(e)}}),c,n.createElement("span",null,l)))});var C=r(18536);let E=e=>(0,C.Z)(e,(t,r)=>{let{textColor:n,lightBorderColor:o,lightColor:a,darkColor:i}=r;return{["".concat(e.componentCls).concat(e.componentCls,"-").concat(t)]:{color:n,background:a,borderColor:o,"&-inverse":{color:e.colorTextLightSolid,background:i,borderColor:i},["&".concat(e.componentCls,"-borderless")]:{borderColor:"transparent"}}}});var _=(0,g.bk)(["Tag","preset"],e=>E(k(e)),v);let O=(e,t,r)=>{let n="string"!=typeof r?r:r.charAt(0).toUpperCase()+r.slice(1);return{["".concat(e.componentCls).concat(e.componentCls,"-").concat(t)]:{color:e["color".concat(r)],background:e["color".concat(n,"Bg")],borderColor:e["color".concat(n,"Border")],["&".concat(e.componentCls,"-borderless")]:{borderColor:"transparent"}}}};var S=(0,g.bk)(["Tag","status"],e=>{let t=k(e);return[O(t,"success","Success"),O(t,"processing","Info"),O(t,"error","Error"),O(t,"warning","Warning")]},v),M=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);ot.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r};let R=n.forwardRef((e,t)=>{let{prefixCls:r,className:o,rootClassName:h,style:f,children:p,icon:m,color:g,onClose:b,bordered:k=!0,visible:v}=e,w=M(e,["prefixCls","className","rootClassName","style","children","icon","color","onClose","bordered","visible"]),{getPrefixCls:x,direction:C,tag:E}=n.useContext(d.E_),[O,R]=n.useState(!0),j=(0,i.Z)(w,["closeIcon","closable"]);n.useEffect(()=>{void 0!==v&&R(v)},[v]);let N=(0,s.o2)(g),z=(0,s.yT)(g),Z=N||z,L=Object.assign(Object.assign({backgroundColor:g&&!Z?g:void 0},null==E?void 0:E.style),f),T=x("tag",r),[I,A,V]=y(T),q=a()(T,null==E?void 0:E.className,{["".concat(T,"-").concat(g)]:Z,["".concat(T,"-has-color")]:g&&!Z,["".concat(T,"-hidden")]:!O,["".concat(T,"-rtl")]:"rtl"===C,["".concat(T,"-borderless")]:!k},o,h,A,V),F=e=>{e.stopPropagation(),null==b||b(e),e.defaultPrevented||R(!1)},[,H]=(0,l.b)((0,l.w)(e),(0,l.w)(E),{closable:!1,closeIconRender:e=>{let t=n.createElement("span",{className:"".concat(T,"-close-icon"),onClick:F},e);return(0,c.wm)(e,t,e=>({onClick:t=>{var r;null===(r=null==e?void 0:e.onClick)||void 0===r||r.call(e,t),F(t)},className:a()(null==e?void 0:e.className,"".concat(T,"-close-icon"))}))}}),B="function"==typeof w.onClick||p&&"a"===p.type,P=m||null,D=P?n.createElement(n.Fragment,null,P,p&&n.createElement("span",null,p)):p,W=n.createElement("span",Object.assign({},j,{ref:t,className:q,style:L}),D,H,N&&n.createElement(_,{key:"preset",prefixCls:T}),z&&n.createElement(S,{key:"status",prefixCls:T}));return I(B?n.createElement(u.Z,{component:"Tag"},W):W)});R.CheckableTag=x;var j=R},23910:function(e,t,r){var n=r(74288).Symbol;e.exports=n},54506:function(e,t,r){var n=r(23910),o=r(4479),a=r(80910),i=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":i&&i in Object(e)?o(e):a(e)}},41087:function(e,t,r){var n=r(5035),o=/^\s+/;e.exports=function(e){return e?e.slice(0,n(e)+1).replace(o,""):e}},17071:function(e,t,r){var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;e.exports=n},4479:function(e,t,r){var n=r(23910),o=Object.prototype,a=o.hasOwnProperty,i=o.toString,s=n?n.toStringTag:void 0;e.exports=function(e){var t=a.call(e,s),r=e[s];try{e[s]=void 0;var n=!0}catch(e){}var o=i.call(e);return n&&(t?e[s]=r:delete e[s]),o}},80910:function(e){var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},74288:function(e,t,r){var n=r(17071),o="object"==typeof self&&self&&self.Object===Object&&self,a=n||o||Function("return this")();e.exports=a},5035:function(e){var t=/\s/;e.exports=function(e){for(var r=e.length;r--&&t.test(e.charAt(r)););return r}},7310:function(e,t,r){var n=r(28302),o=r(11121),a=r(6660),i=Math.max,s=Math.min;e.exports=function(e,t,r){var l,c,u,d,h,f,p=0,m=!1,g=!1,b=!0;if("function"!=typeof e)throw TypeError("Expected a function");function k(t){var r=l,n=c;return l=c=void 0,p=t,d=e.apply(n,r)}function v(e){var r=e-f,n=e-p;return void 0===f||r>=t||r<0||g&&n>=u}function y(){var e,r,n,a=o();if(v(a))return w(a);h=setTimeout(y,(e=a-f,r=a-p,n=t-e,g?s(n,u-r):n))}function w(e){return(h=void 0,b&&l)?k(e):(l=c=void 0,d)}function x(){var e,r=o(),n=v(r);if(l=arguments,c=this,f=r,n){if(void 0===h)return p=e=f,h=setTimeout(y,t),m?k(e):d;if(g)return clearTimeout(h),h=setTimeout(y,t),k(f)}return void 0===h&&(h=setTimeout(y,t)),d}return t=a(t)||0,n(r)&&(m=!!r.leading,u=(g="maxWait"in r)?i(a(r.maxWait)||0,t):u,b="trailing"in r?!!r.trailing:b),x.cancel=function(){void 0!==h&&clearTimeout(h),p=0,l=f=c=h=void 0},x.flush=function(){return void 0===h?d:w(o())},x}},28302:function(e){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},10303:function(e){e.exports=function(e){return null!=e&&"object"==typeof e}},78371:function(e,t,r){var n=r(54506),o=r(10303);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==n(e)}},11121:function(e,t,r){var n=r(74288);e.exports=function(){return n.Date.now()}},6660:function(e,t,r){var n=r(41087),o=r(28302),a=r(78371),i=0/0,s=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,c=/^0o[0-7]+$/i,u=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(a(e))return i;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=n(e);var r=l.test(e);return r||c.test(e)?u(e.slice(2),r?2:8):s.test(e)?i:+e}},79205:function(e,t,r){"use strict";r.d(t,{Z:function(){return d}});var n=r(2265);let o=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),a=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase()),i=e=>{let t=a(e);return t.charAt(0).toUpperCase()+t.slice(1)},s=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim()},l=e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};var c={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let u=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:o=24,strokeWidth:a=2,absoluteStrokeWidth:i,className:u="",children:d,iconNode:h,...f}=e;return(0,n.createElement)("svg",{ref:t,...c,width:o,height:o,stroke:r,strokeWidth:i?24*Number(a)/Number(o):a,className:s("lucide",u),...!d&&!l(f)&&{"aria-hidden":"true"},...f},[...h.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(d)?d:[d]])}),d=(e,t)=>{let r=(0,n.forwardRef)((r,a)=>{let{className:l,...c}=r;return(0,n.createElement)(u,{ref:a,iconNode:t,className:s("lucide-".concat(o(i(e))),"lucide-".concat(e),l),...c})});return r.displayName=i(e),r}},82222:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]])},40875:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},22135:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])},5136:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]])},64935:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]])},78867:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},96362:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]])},29202:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]])},33245:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]])},54001:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]])},51817:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},21047:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]])},96137:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]])},80221:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]])},70525:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("trending-up",[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]])},76865:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},49663:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("user-check",[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]])},79862:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("user-round",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]])},95805:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]])},11239:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])},15452:function(e,t){var r,n,o;n=[],void 0!==(o="function"==typeof(r=function e(){var t,r="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==r?r:{},n=!r.document&&!!r.postMessage,o=r.IS_PAPA_WORKER||!1,a={},i=0,s={};function l(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(e){var t=v(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new f(t),(this._handle.streamer=this)._config=t}).call(this,e),this.parseChunk=function(e,t){var n=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0=this._config.preview,o)r.postMessage({results:a,workerId:s.WORKER_ID,finished:n});else if(w(this._config.chunk)&&!t){if(this._config.chunk(a,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=a=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(a.data),this._completeResults.errors=this._completeResults.errors.concat(a.errors),this._completeResults.meta=a.meta),this._completed||!n||!w(this._config.complete)||a&&a.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),n||a&&a.meta.paused||this._nextChunk(),a}this._halted=!0},this._sendError=function(e){w(this._config.error)?this._config.error(e):o&&this._config.error&&r.postMessage({workerId:s.WORKER_ID,error:e,finished:!1})}}function c(e){var t;(e=e||{}).chunkSize||(e.chunkSize=s.RemoteChunkSize),l.call(this,e),this._nextChunk=n?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),n||(t.onload=y(this._chunkLoaded,this),t.onerror=y(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!n),this._config.downloadRequestHeaders){var e,r,o=this._config.downloadRequestHeaders;for(r in o)t.setRequestHeader(r,o[r])}this._config.chunkSize&&(e=this._start+this._config.chunkSize-1,t.setRequestHeader("Range","bytes="+this._start+"-"+e));try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}n&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){let e;4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize||t.responseText.length,this._finished=!this._config.chunkSize||this._start>=(null!==(e=(e=t).getResponseHeader("Content-Range"))?parseInt(e.substring(e.lastIndexOf("/")+1)):-1),this.parseChunk(t.responseText)))},this._chunkError=function(e){e=t.statusText||e,this._sendError(Error(e))}}function u(e){(e=e||{}).chunkSize||(e.chunkSize=s.LocalChunkSize),l.call(this,e);var t,r,n="undefined"!=typeof FileReader;this.stream=function(e){this._input=e,r=e.slice||e.webkitSlice||e.mozSlice,n?((t=new FileReader).onload=y(this._chunkLoaded,this),t.onerror=y(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function d(e){var t;l.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){var e,r;if(!this._finished)return t=(e=this._config.chunkSize)?(r=t.substring(0,e),t.substring(e)):(r=t,""),this._finished=!t,this.parseChunk(r)}}function h(e){l.call(this,e=e||{});var t=[],r=!0,n=!1;this.pause=function(){l.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){l.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){n&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):r=!0},this._streamData=y(function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),r&&(r=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}},this),this._streamError=y(function(e){this._streamCleanUp(),this._sendError(e)},this),this._streamEnd=y(function(){this._streamCleanUp(),n=!0,this._streamData("")},this),this._streamCleanUp=y(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function f(e){var t,r,n,o,a=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,i=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,l=this,c=0,u=0,d=!1,h=!1,f=[],g={data:[],errors:[],meta:{}};function b(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function k(){if(g&&n&&(x("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+s.DefaultDelimiter+"'"),n=!1),e.skipEmptyLines&&(g.data=g.data.filter(function(e){return!b(e)})),y()){if(g){if(Array.isArray(g.data[0])){for(var t,r=0;y()&&r=f.length?"__parsed_extra":f[o]:s,c=l=e.transform?e.transform(l,s):l,(e.dynamicTypingFunction&&void 0===e.dynamicTyping[r]&&(e.dynamicTyping[r]=e.dynamicTypingFunction(r)),!0===(e.dynamicTyping[r]||e.dynamicTyping))?"true"===c||"TRUE"===c||"false"!==c&&"FALSE"!==c&&((e=>{if(a.test(e)&&-9007199254740992<(e=parseFloat(e))&&e<9007199254740992)return 1})(c)?parseFloat(c):i.test(c)?new Date(c):""===c?null:c):c);"__parsed_extra"===s?(n[s]=n[s]||[],n[s].push(l)):n[s]=l}return e.header&&(o>f.length?x("FieldMismatch","TooManyFields","Too many fields: expected "+f.length+" fields but parsed "+o,u+r):oe.preview?r.abort():(g.data=g.data[0],o(g,l))))}),this.parse=function(o,a,i){var l=e.quoteChar||'"',l=(e.newline||(e.newline=this.guessLineEndings(o,l)),n=!1,e.delimiter?w(e.delimiter)&&(e.delimiter=e.delimiter(o),g.meta.delimiter=e.delimiter):((l=((t,r,n,o,a)=>{var i,l,c,u;a=a||[","," ","|",";",s.RECORD_SEP,s.UNIT_SEP];for(var d=0;d=r.length/2?"\r\n":"\r"}}function p(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function m(e){var t=(e=e||{}).delimiter,r=e.newline,n=e.comments,o=e.step,a=e.preview,i=e.fastMode,l=null,c=!1,u=null==e.quoteChar?'"':e.quoteChar,d=u;if(void 0!==e.escapeChar&&(d=e.escapeChar),("string"!=typeof t||-1=a)return V(!0);break}E.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:C.length,index:h}),z++}}else if(n&&0===_.length&&s.substring(h,h+y)===n){if(-1===j)return V();h=j+v,j=s.indexOf(r,h),R=s.indexOf(t,h)}else if(-1!==R&&(R=a)return V(!0)}return I();function L(e){C.push(e),O=h}function T(e){return -1!==e&&(e=s.substring(z+1,e))&&""===e.trim()?e.length:0}function I(e){return g||(void 0===e&&(e=s.substring(h)),_.push(e),h=b,L(_),x&&q()),V()}function A(e){h=e,L(_),_=[],j=s.indexOf(r,h)}function V(n){if(e.header&&!m&&C.length&&!c){var o=C[0],a=Object.create(null),i=new Set(o);let t=!1;for(let r=0;r{if("object"==typeof t){if("string"!=typeof t.delimiter||s.BAD_DELIMITERS.filter(function(e){return -1!==t.delimiter.indexOf(e)}).length||(o=t.delimiter),("boolean"==typeof t.quotes||"function"==typeof t.quotes||Array.isArray(t.quotes))&&(r=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(c=t.skipEmptyLines),"string"==typeof t.newline&&(a=t.newline),"string"==typeof t.quoteChar&&(i=t.quoteChar),"boolean"==typeof t.header&&(n=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw Error("Option columns is empty");u=t.columns}void 0!==t.escapeChar&&(l=t.escapeChar+i),t.escapeFormulae instanceof RegExp?d=t.escapeFormulae:"boolean"==typeof t.escapeFormulae&&t.escapeFormulae&&(d=/^[=+\-@\t\r].*$/)}})(),RegExp(p(i),"g"));if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return f(null,e,c);if("object"==typeof e[0])return f(u||Object.keys(e[0]),e,c)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||u),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),f(e.fields||[],e.data||[],c);throw Error("Unable to serialize unrecognized input");function f(e,t,r){var i="",s=("string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t)),Array.isArray(e)&&0{for(var r=0;r=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,i),n=o.default.Children.only(t);return o.default.cloneElement(n,c(c({},r),{},{onClick:this.onClick}))}}],function(e,t){for(var r=0;r"boolean"==typeof e||e instanceof Boolean,a=e=>"number"==typeof e||e instanceof Number,i=e=>"bigint"==typeof e||e instanceof BigInt,s=e=>!!e&&e instanceof Date,l=e=>"string"==typeof e||e instanceof String,c=e=>Array.isArray(e),u=e=>"object"==typeof e&&null!==e,d=e=>!!e&&e instanceof Object&&"function"==typeof e;function h(e,t){return void 0===t&&(t=!1),!e||t?`"${e}"`:e}function f(e){let{field:t,value:r,data:o,lastElement:a,openBracket:i,closeBracket:s,level:l,style:c,shouldExpandNode:u,clickToExpandNode:d,outerRef:f,beforeExpandChange:p}=e,m=(0,n.useRef)(!1),[g,k]=(0,n.useState)(()=>u(l,r,t)),v=(0,n.useRef)(null);(0,n.useEffect)(()=>{m.current?k(u(l,r,t)):m.current=!0},[u]);let y=(0,n.useId)();if(0===o.length)return function(e){let{field:t,openBracket:r,closeBracket:o,lastElement:a,style:i}=e;return(0,n.createElement)("div",{className:i.basicChildStyle,role:"treeitem","aria-selected":void 0},(t||""===t)&&(0,n.createElement)("span",{className:i.label},h(t,i.quotesForFieldNames),":"),(0,n.createElement)("span",{className:i.punctuation},r),(0,n.createElement)("span",{className:i.punctuation},o),!a&&(0,n.createElement)("span",{className:i.punctuation},","))}({field:t,openBracket:i,closeBracket:s,lastElement:a,style:c});let w=g?c.collapseIcon:c.expandIcon,x=g?c.ariaLables.collapseJson:c.ariaLables.expandJson,C=l+1,E=o.length-1,_=e=>{g!==e&&(!p||p({level:l,value:r,field:t,newExpandValue:e}))&&k(e)},O=e=>{if("ArrowRight"===e.key||"ArrowLeft"===e.key)e.preventDefault(),_("ArrowRight"===e.key);else if("ArrowUp"===e.key||"ArrowDown"===e.key){e.preventDefault();let t="ArrowUp"===e.key?-1:1;if(!f.current)return;let r=f.current.querySelectorAll("[role=button]"),n=-1;for(let e=0;e{var e;_(!g);let t=v.current;if(!t)return;let r=null===(e=f.current)||void 0===e?void 0:e.querySelector('[role=button][tabindex="0"]');r&&(r.tabIndex=-1),t.tabIndex=0,t.focus()};return(0,n.createElement)("div",{className:c.basicChildStyle,role:"treeitem","aria-expanded":g,"aria-selected":void 0},(0,n.createElement)("span",{className:w,onClick:S,onKeyDown:O,role:"button","aria-label":x,"aria-expanded":g,"aria-controls":g?y:void 0,ref:v,tabIndex:0===l?0:-1}),(t||""===t)&&(d?(0,n.createElement)("span",{className:c.clickableLabel,onClick:S,onKeyDown:O},h(t,c.quotesForFieldNames),":"):(0,n.createElement)("span",{className:c.label},h(t,c.quotesForFieldNames),":")),(0,n.createElement)("span",{className:c.punctuation},i),g?(0,n.createElement)("ul",{id:y,role:"group",className:c.childFieldsContainer},o.map((e,t)=>(0,n.createElement)(b,{key:e[0]||t,field:e[0],value:e[1],style:c,lastElement:t===E,level:C,shouldExpandNode:u,clickToExpandNode:d,beforeExpandChange:p,outerRef:f}))):(0,n.createElement)("span",{className:c.collapsedContent,onClick:S,onKeyDown:O}),(0,n.createElement)("span",{className:c.punctuation},s),!a&&(0,n.createElement)("span",{className:c.punctuation},","))}function p(e){let{field:t,value:r,style:n,lastElement:o,shouldExpandNode:a,clickToExpandNode:i,level:s,outerRef:l,beforeExpandChange:c}=e;return f({field:t,value:r,lastElement:o||!1,level:s,openBracket:"{",closeBracket:"}",style:n,shouldExpandNode:a,clickToExpandNode:i,data:Object.keys(r).map(e=>[e,r[e]]),outerRef:l,beforeExpandChange:c})}function m(e){let{field:t,value:r,style:n,lastElement:o,level:a,shouldExpandNode:i,clickToExpandNode:s,outerRef:l,beforeExpandChange:c}=e;return f({field:t,value:r,lastElement:o||!1,level:a,openBracket:"[",closeBracket:"]",style:n,shouldExpandNode:i,clickToExpandNode:s,data:r.map(e=>[void 0,e]),outerRef:l,beforeExpandChange:c})}function g(e){let t,{field:r,value:c,style:u,lastElement:f}=e,p=u.otherValue;if(null===c)t="null",p=u.nullValue;else if(void 0===c)t="undefined",p=u.undefinedValue;else if(l(c)){var m;m=!u.noQuotesForStringValues,t=u.stringifyStringValues?JSON.stringify(c):m?`"${c}"`:c,p=u.stringValue}else o(c)?(t=c?"true":"false",p=u.booleanValue):a(c)?(t=c.toString(),p=u.numberValue):i(c)?(t=`${c.toString()}n`,p=u.numberValue):t=s(c)?c.toISOString():d(c)?"function() { }":c.toString();return(0,n.createElement)("div",{className:u.basicChildStyle,role:"treeitem","aria-selected":void 0},(r||""===r)&&(0,n.createElement)("span",{className:u.label},h(r,u.quotesForFieldNames),":"),(0,n.createElement)("span",{className:p},t),!f&&(0,n.createElement)("span",{className:u.punctuation},","))}function b(e){let t=e.value;return c(t)?(0,n.createElement)(m,Object.assign({},e)):!u(t)||s(t)||d(t)?(0,n.createElement)(g,Object.assign({},e)):(0,n.createElement)(p,Object.assign({},e))}let k={container:"_2IvMF _GzYRV",basicChildStyle:"_2bkNM",childFieldsContainer:"_1BXBN",label:"_1MGIk",clickableLabel:"_2YKJg _1MGIk _1MFti",nullValue:"_2T6PJ",undefinedValue:"_1Gho6",stringValue:"_vGjyY",booleanValue:"_3zQKs",numberValue:"_1bQdo",otherValue:"_1xvuR",punctuation:"_3uHL6 _3eOF8",collapseIcon:"_oLqym _f10Tu _1MFti _1LId0",expandIcon:"_2AXVT _f10Tu _1MFti _1UmXx",collapsedContent:"_2KJWg _1pNG9 _1MFti",noQuotesForStringValues:!1,quotesForFieldNames:!1,ariaLables:{collapseJson:"collapse JSON",expandJson:"expand JSON"},stringifyStringValues:!1},v=()=>!0,y=e=>{let{data:t,style:r=k,shouldExpandNode:o=v,clickToExpandNode:a=!1,beforeExpandChange:i,compactTopLevel:s,...l}=e,c=(0,n.useRef)(null);return(0,n.createElement)("div",Object.assign({"aria-label":"JSON view"},l,{className:r.container,ref:c,role:"tree"}),s&&u(t)?Object.entries(t).map(e=>{let[t,s]=e;return(0,n.createElement)(b,{key:t,field:t,value:s,style:{...k,...r},lastElement:!0,level:1,shouldExpandNode:o,clickToExpandNode:a,beforeExpandChange:i,outerRef:c})}):(0,n.createElement)(b,{value:t,style:{...k,...r},lastElement:!0,level:0,shouldExpandNode:o,clickToExpandNode:a,outerRef:c,beforeExpandChange:i}))}},1479:function(e,t){"use strict";t.Z={'code[class*="language-"]':{background:"hsl(230, 1%, 98%)",color:"hsl(230, 8%, 24%)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{background:"hsl(230, 1%, 98%)",color:"hsl(230, 8%, 24%)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:"0.5em 0",overflow:"auto",borderRadius:"0.3em"},'code[class*="language-"]::-moz-selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'code[class*="language-"] *::-moz-selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'pre[class*="language-"] *::-moz-selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'code[class*="language-"]::selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'code[class*="language-"] *::selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'pre[class*="language-"] *::selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},':not(pre) > code[class*="language-"]':{padding:"0.2em 0.3em",borderRadius:"0.3em",whiteSpace:"normal"},comment:{color:"hsl(230, 4%, 64%)",fontStyle:"italic"},prolog:{color:"hsl(230, 4%, 64%)"},cdata:{color:"hsl(230, 4%, 64%)"},doctype:{color:"hsl(230, 8%, 24%)"},punctuation:{color:"hsl(230, 8%, 24%)"},entity:{color:"hsl(230, 8%, 24%)",cursor:"help"},"attr-name":{color:"hsl(35, 99%, 36%)"},"class-name":{color:"hsl(35, 99%, 36%)"},boolean:{color:"hsl(35, 99%, 36%)"},constant:{color:"hsl(35, 99%, 36%)"},number:{color:"hsl(35, 99%, 36%)"},atrule:{color:"hsl(35, 99%, 36%)"},keyword:{color:"hsl(301, 63%, 40%)"},property:{color:"hsl(5, 74%, 59%)"},tag:{color:"hsl(5, 74%, 59%)"},symbol:{color:"hsl(5, 74%, 59%)"},deleted:{color:"hsl(5, 74%, 59%)"},important:{color:"hsl(5, 74%, 59%)"},selector:{color:"hsl(119, 34%, 47%)"},string:{color:"hsl(119, 34%, 47%)"},char:{color:"hsl(119, 34%, 47%)"},builtin:{color:"hsl(119, 34%, 47%)"},inserted:{color:"hsl(119, 34%, 47%)"},regex:{color:"hsl(119, 34%, 47%)"},"attr-value":{color:"hsl(119, 34%, 47%)"},"attr-value > .token.punctuation":{color:"hsl(119, 34%, 47%)"},variable:{color:"hsl(221, 87%, 60%)"},operator:{color:"hsl(221, 87%, 60%)"},function:{color:"hsl(221, 87%, 60%)"},url:{color:"hsl(198, 99%, 37%)"},"attr-value > .token.punctuation.attr-equals":{color:"hsl(230, 8%, 24%)"},"special-attr > .token.attr-value > .token.value.css":{color:"hsl(230, 8%, 24%)"},".language-css .token.selector":{color:"hsl(5, 74%, 59%)"},".language-css .token.property":{color:"hsl(230, 8%, 24%)"},".language-css .token.function":{color:"hsl(198, 99%, 37%)"},".language-css .token.url > .token.function":{color:"hsl(198, 99%, 37%)"},".language-css .token.url > .token.string.url":{color:"hsl(119, 34%, 47%)"},".language-css .token.important":{color:"hsl(301, 63%, 40%)"},".language-css .token.atrule .token.rule":{color:"hsl(301, 63%, 40%)"},".language-javascript .token.operator":{color:"hsl(301, 63%, 40%)"},".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation":{color:"hsl(344, 84%, 43%)"},".language-json .token.operator":{color:"hsl(230, 8%, 24%)"},".language-json .token.null.keyword":{color:"hsl(35, 99%, 36%)"},".language-markdown .token.url":{color:"hsl(230, 8%, 24%)"},".language-markdown .token.url > .token.operator":{color:"hsl(230, 8%, 24%)"},".language-markdown .token.url-reference.url > .token.string":{color:"hsl(230, 8%, 24%)"},".language-markdown .token.url > .token.content":{color:"hsl(221, 87%, 60%)"},".language-markdown .token.url > .token.url":{color:"hsl(198, 99%, 37%)"},".language-markdown .token.url-reference.url":{color:"hsl(198, 99%, 37%)"},".language-markdown .token.blockquote.punctuation":{color:"hsl(230, 4%, 64%)",fontStyle:"italic"},".language-markdown .token.hr.punctuation":{color:"hsl(230, 4%, 64%)",fontStyle:"italic"},".language-markdown .token.code-snippet":{color:"hsl(119, 34%, 47%)"},".language-markdown .token.bold .token.content":{color:"hsl(35, 99%, 36%)"},".language-markdown .token.italic .token.content":{color:"hsl(301, 63%, 40%)"},".language-markdown .token.strike .token.content":{color:"hsl(5, 74%, 59%)"},".language-markdown .token.strike .token.punctuation":{color:"hsl(5, 74%, 59%)"},".language-markdown .token.list.punctuation":{color:"hsl(5, 74%, 59%)"},".language-markdown .token.title.important > .token.punctuation":{color:"hsl(5, 74%, 59%)"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},namespace:{Opacity:"0.8"},"token.tab:not(:empty):before":{color:"hsla(230, 8%, 24%, 0.2)"},"token.cr:before":{color:"hsla(230, 8%, 24%, 0.2)"},"token.lf:before":{color:"hsla(230, 8%, 24%, 0.2)"},"token.space:before":{color:"hsla(230, 8%, 24%, 0.2)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item":{marginRight:"0.4em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 6%, 44%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 6%, 44%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 6%, 44%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},".line-highlight.line-highlight":{background:"hsla(230, 8%, 24%, 0.05)"},".line-highlight.line-highlight:before":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 8%, 24%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},".line-highlight.line-highlight[data-end]:after":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 8%, 24%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},"pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before":{backgroundColor:"hsla(230, 8%, 24%, 0.05)"},".line-numbers.line-numbers .line-numbers-rows":{borderRightColor:"hsla(230, 8%, 24%, 0.2)"},".command-line .command-line-prompt":{borderRightColor:"hsla(230, 8%, 24%, 0.2)"},".line-numbers .line-numbers-rows > span:before":{color:"hsl(230, 1%, 62%)"},".command-line .command-line-prompt > span:before":{color:"hsl(230, 1%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-1":{color:"hsl(5, 74%, 59%)"},".rainbow-braces .token.token.punctuation.brace-level-5":{color:"hsl(5, 74%, 59%)"},".rainbow-braces .token.token.punctuation.brace-level-9":{color:"hsl(5, 74%, 59%)"},".rainbow-braces .token.token.punctuation.brace-level-2":{color:"hsl(119, 34%, 47%)"},".rainbow-braces .token.token.punctuation.brace-level-6":{color:"hsl(119, 34%, 47%)"},".rainbow-braces .token.token.punctuation.brace-level-10":{color:"hsl(119, 34%, 47%)"},".rainbow-braces .token.token.punctuation.brace-level-3":{color:"hsl(221, 87%, 60%)"},".rainbow-braces .token.token.punctuation.brace-level-7":{color:"hsl(221, 87%, 60%)"},".rainbow-braces .token.token.punctuation.brace-level-11":{color:"hsl(221, 87%, 60%)"},".rainbow-braces .token.token.punctuation.brace-level-4":{color:"hsl(301, 63%, 40%)"},".rainbow-braces .token.token.punctuation.brace-level-8":{color:"hsl(301, 63%, 40%)"},".rainbow-braces .token.token.punctuation.brace-level-12":{color:"hsl(301, 63%, 40%)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},".prism-previewer.prism-previewer:before":{borderColor:"hsl(0, 0, 95%)"},".prism-previewer-gradient.prism-previewer-gradient div":{borderColor:"hsl(0, 0, 95%)",borderRadius:"0.3em"},".prism-previewer-color.prism-previewer-color:before":{borderRadius:"0.3em"},".prism-previewer-easing.prism-previewer-easing:before":{borderRadius:"0.3em"},".prism-previewer.prism-previewer:after":{borderTopColor:"hsl(0, 0, 95%)"},".prism-previewer-flipped.prism-previewer-flipped.after":{borderBottomColor:"hsl(0, 0, 95%)"},".prism-previewer-angle.prism-previewer-angle:before":{background:"hsl(0, 0%, 100%)"},".prism-previewer-time.prism-previewer-time:before":{background:"hsl(0, 0%, 100%)"},".prism-previewer-easing.prism-previewer-easing":{background:"hsl(0, 0%, 100%)"},".prism-previewer-angle.prism-previewer-angle circle":{stroke:"hsl(230, 8%, 24%)",strokeOpacity:"1"},".prism-previewer-time.prism-previewer-time circle":{stroke:"hsl(230, 8%, 24%)",strokeOpacity:"1"},".prism-previewer-easing.prism-previewer-easing circle":{stroke:"hsl(230, 8%, 24%)",fill:"transparent"},".prism-previewer-easing.prism-previewer-easing path":{stroke:"hsl(230, 8%, 24%)"},".prism-previewer-easing.prism-previewer-easing line":{stroke:"hsl(230, 8%, 24%)"}}},52621:function(){},44643:function(e,t,r){"use strict";var n=r(2265);let o=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=o},82422:function(e,t,r){"use strict";var n=r(2265);let o=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"}))});t.Z=o},86462:function(e,t,r){"use strict";var n=r(2265);let o=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"}))});t.Z=o},51853:function(e,t,r){"use strict";var n=r(2265);let o=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3m2 4H10m0 0l3-3m-3 3l3 3"}))});t.Z=o},3477:function(e,t,r){"use strict";var n=r(2265);let o=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"}))});t.Z=o},71437:function(e,t,r){"use strict";var n=r(2265);let o=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"}))});t.Z=o},82376:function(e,t,r){"use strict";var n=r(2265);let o=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"}))});t.Z=o},17732:function(e,t,r){"use strict";var n=r(2265);let o=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"}))});t.Z=o},71157:function(e,t,r){"use strict";var n=r(2265);let o=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=o},3837:function(e,t,r){"use strict";var n=r(2265);let o=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"}))});t.Z=o},21770:function(e,t,r){"use strict";r.d(t,{D:function(){return u}});var n=r(2265),o=r(2894),a=r(18238),i=r(24112),s=r(45345),l=class extends i.l{#e;#t=void 0;#r;#n;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#o()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),(0,s.VS)(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#r,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,s.Ym)(t.mutationKey)!==(0,s.Ym)(this.options.mutationKey)?this.reset():this.#r?.state.status==="pending"&&this.#r.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#r?.removeObserver(this)}onMutationUpdate(e){this.#o(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#r?.removeObserver(this),this.#r=void 0,this.#o(),this.#a()}mutate(e,t){return this.#n=t,this.#r?.removeObserver(this),this.#r=this.#e.getMutationCache().build(this.#e,this.options),this.#r.addObserver(this),this.#r.execute(e)}#o(){let e=this.#r?.state??(0,o.R)();this.#t={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#a(e){a.Vr.batch(()=>{if(this.#n&&this.hasListeners()){let t=this.#t.variables,r=this.#t.context,n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};e?.type==="success"?(this.#n.onSuccess?.(e.data,t,r,n),this.#n.onSettled?.(e.data,null,t,r,n)):e?.type==="error"&&(this.#n.onError?.(e.error,t,r,n),this.#n.onSettled?.(void 0,e.error,t,r,n))}this.listeners.forEach(e=>{e(this.#t)})})}},c=r(29827);function u(e,t){let r=(0,c.NL)(t),[o]=n.useState(()=>new l(r,e));n.useEffect(()=>{o.setOptions(e)},[o,e]);let i=n.useSyncExternalStore(n.useCallback(e=>o.subscribe(a.Vr.batchCalls(e)),[o]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),u=n.useCallback((e,t)=>{o.mutate(e,t).catch(s.ZT)},[o]);if(i.error&&(0,s.L3)(o.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:u,mutateAsync:i.mutate}}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/3367-33bb84b3d3d247b2.js b/litellm/proxy/_experimental/out/_next/static/chunks/3367-33bb84b3d3d247b2.js new file mode 100644 index 00000000000..23daac359dc --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/3367-33bb84b3d3d247b2.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3367],{60440:function(e,n,t){t.d(n,{Z:function(){return u}});var r=t(1119),o=t(2265),i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M176 511a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"ellipsis",theme:"outlined"},l=t(55015),u=o.forwardRef(function(e,n){return o.createElement(l.Z,(0,r.Z)({},e,{ref:n,icon:i}))})},71030:function(e,n,t){t.d(n,{Z:function(){return C}});var r=t(1119),o=t(11993),i=t(26365),l=t(6989),u=t(97821),a=t(36760),c=t.n(a),s=t(28791),f=t(2265),d=t(95814),p=t(53346),v=d.Z.ESC,m=d.Z.TAB,b=(0,f.forwardRef)(function(e,n){var t=e.overlay,r=e.arrow,o=e.prefixCls,i=(0,f.useMemo)(function(){return"function"==typeof t?t():t},[t]),l=(0,s.sQ)(n,(0,s.C4)(i));return f.createElement(f.Fragment,null,r&&f.createElement("div",{className:"".concat(o,"-arrow")}),f.cloneElement(i,{ref:(0,s.Yr)(i)?l:void 0}))}),y={adjustX:1,adjustY:1},h=[0,0],g={topLeft:{points:["bl","tl"],overflow:y,offset:[0,-4],targetOffset:h},top:{points:["bc","tc"],overflow:y,offset:[0,-4],targetOffset:h},topRight:{points:["br","tr"],overflow:y,offset:[0,-4],targetOffset:h},bottomLeft:{points:["tl","bl"],overflow:y,offset:[0,4],targetOffset:h},bottom:{points:["tc","bc"],overflow:y,offset:[0,4],targetOffset:h},bottomRight:{points:["tr","br"],overflow:y,offset:[0,4],targetOffset:h}},Z=["arrow","prefixCls","transitionName","animation","align","placement","placements","getPopupContainer","showAction","hideAction","overlayClassName","overlayStyle","visible","trigger","autoFocus","overlay","children","onVisibleChange"],C=f.forwardRef(function(e,n){var t,a,d,y,h,C,E,w,k,M,R,x,N,P,S=e.arrow,I=void 0!==S&&S,K=e.prefixCls,O=void 0===K?"rc-dropdown":K,A=e.transitionName,T=e.animation,L=e.align,D=e.placement,_=e.placements,V=e.getPopupContainer,z=e.showAction,F=e.hideAction,j=e.overlayClassName,B=e.overlayStyle,W=e.visible,H=e.trigger,Y=void 0===H?["hover"]:H,q=e.autoFocus,X=e.overlay,G=e.children,Q=e.onVisibleChange,U=(0,l.Z)(e,Z),J=f.useState(),$=(0,i.Z)(J,2),ee=$[0],en=$[1],et="visible"in e?W:ee,er=f.useRef(null),eo=f.useRef(null),ei=f.useRef(null);f.useImperativeHandle(n,function(){return er.current});var el=function(e){en(e),null==Q||Q(e)};a=(t={visible:et,triggerRef:ei,onVisibleChange:el,autoFocus:q,overlayRef:eo}).visible,d=t.triggerRef,y=t.onVisibleChange,h=t.autoFocus,C=t.overlayRef,E=f.useRef(!1),w=function(){if(a){var e,n;null===(e=d.current)||void 0===e||null===(n=e.focus)||void 0===n||n.call(e),null==y||y(!1)}},k=function(){var e;return null!==(e=C.current)&&void 0!==e&&!!e.focus&&(C.current.focus(),E.current=!0,!0)},M=function(e){switch(e.keyCode){case v:w();break;case m:var n=!1;E.current||(n=k()),n?e.preventDefault():w()}},f.useEffect(function(){return a?(window.addEventListener("keydown",M),h&&(0,p.Z)(k,3),function(){window.removeEventListener("keydown",M),E.current=!1}):function(){E.current=!1}},[a]);var eu=function(){return f.createElement(b,{ref:eo,overlay:X,prefixCls:O,arrow:I})},ea=f.cloneElement(G,{className:c()(null===(P=G.props)||void 0===P?void 0:P.className,et&&(void 0!==(R=e.openClassName)?R:"".concat(O,"-open"))),ref:(0,s.Yr)(G)?(0,s.sQ)(ei,(0,s.C4)(G)):void 0}),ec=F;return ec||-1===Y.indexOf("contextMenu")||(ec=["click"]),f.createElement(u.Z,(0,r.Z)({builtinPlacements:void 0===_?g:_},U,{prefixCls:O,ref:er,popupClassName:c()(j,(0,o.Z)({},"".concat(O,"-show-arrow"),I)),popupStyle:B,action:Y,showAction:z,hideAction:ec,popupPlacement:void 0===D?"bottomLeft":D,popupAlign:L,popupTransitionName:A,popupAnimation:T,popupVisible:et,stretch:(x=e.minOverlayWidthMatchTrigger,N=e.alignPoint,"minOverlayWidthMatchTrigger"in e?x:!N)?"minWidth":"",popup:"function"==typeof X?eu:eu(),onPopupVisibleChange:el,onPopupClick:function(n){var t=e.onOverlayClick;en(!1),t&&t(n)},getPopupContainer:V}),ea)})},33082:function(e,n,t){t.d(n,{iz:function(){return eO},ck:function(){return ev},BW:function(){return eL},sN:function(){return ev},Wd:function(){return eI},ZP:function(){return ej},Xl:function(){return x}});var r=t(1119),o=t(11993),i=t(31686),l=t(83145),u=t(26365),a=t(6989),c=t(36760),s=t.n(c),f=t(1699),d=t(50506),p=t(16671),v=t(32559),m=t(2265),b=t(54887),y=m.createContext(null);function h(e,n){return void 0===e?null:"".concat(e,"-").concat(n)}function g(e){return h(m.useContext(y),e)}var Z=t(6397),C=["children","locked"],E=m.createContext(null);function w(e){var n=e.children,t=e.locked,r=(0,a.Z)(e,C),o=m.useContext(E),l=(0,Z.Z)(function(){var e;return e=(0,i.Z)({},o),Object.keys(r).forEach(function(n){var t=r[n];void 0!==t&&(e[n]=t)}),e},[o,r],function(e,n){return!t&&(e[0]!==n[0]||!(0,p.Z)(e[1],n[1],!0))});return m.createElement(E.Provider,{value:l},n)}var k=m.createContext(null);function M(){return m.useContext(k)}var R=m.createContext([]);function x(e){var n=m.useContext(R);return m.useMemo(function(){return void 0!==e?[].concat((0,l.Z)(n),[e]):n},[n,e])}var N=m.createContext(null),P=m.createContext({}),S=t(2857);function I(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if((0,S.Z)(e)){var t=e.nodeName.toLowerCase(),r=["input","select","textarea","button"].includes(t)||e.isContentEditable||"a"===t&&!!e.getAttribute("href"),o=e.getAttribute("tabindex"),i=Number(o),l=null;return o&&!Number.isNaN(i)?l=i:r&&null===l&&(l=0),r&&e.disabled&&(l=null),null!==l&&(l>=0||n&&l<0)}return!1}var K=t(95814),O=t(53346),A=K.Z.LEFT,T=K.Z.RIGHT,L=K.Z.UP,D=K.Z.DOWN,_=K.Z.ENTER,V=K.Z.ESC,z=K.Z.HOME,F=K.Z.END,j=[L,D,A,T];function B(e,n){return(function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t=(0,l.Z)(e.querySelectorAll("*")).filter(function(e){return I(e,n)});return I(e,n)&&t.unshift(e),t})(e,!0).filter(function(e){return n.has(e)})}function W(e,n,t){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;if(!e)return null;var o=B(e,n),i=o.length,l=o.findIndex(function(e){return t===e});return r<0?-1===l?l=i-1:l-=1:r>0&&(l+=1),o[l=(l+i)%i]}var H=function(e,n){var t=new Set,r=new Map,o=new Map;return e.forEach(function(e){var i=document.querySelector("[data-menu-id='".concat(h(n,e),"']"));i&&(t.add(i),o.set(i,e),r.set(e,i))}),{elements:t,key2element:r,element2key:o}},Y="__RC_UTIL_PATH_SPLIT__",q=function(e){return e.join(Y)},X="rc-menu-more";function G(e){var n=m.useRef(e);n.current=e;var t=m.useCallback(function(){for(var e,t=arguments.length,r=Array(t),o=0;o1&&(k.motionAppear=!1);var M=k.onVisibleChanged;return(k.onVisibleChanged=function(e){return b.current||e||Z(!0),null==M?void 0:M(e)},g)?null:m.createElement(w,{mode:a,locked:!b.current},m.createElement(eR.ZP,(0,r.Z)({visible:C},k,{forceRender:f,removeOnLeave:!1,leavedClassName:"".concat(s,"-hidden")}),function(e){var t=e.className,r=e.style;return m.createElement(eb,{id:n,className:t,style:r},l)}))}var eN=["style","className","title","eventKey","warnKey","disabled","internalPopupClose","children","itemIcon","expandIcon","popupClassName","popupOffset","popupStyle","onClick","onMouseEnter","onMouseLeave","onTitleClick","onTitleMouseEnter","onTitleMouseLeave"],eP=["active"],eS=m.forwardRef(function(e,n){var t=e.style,l=e.className,c=e.title,d=e.eventKey,p=(e.warnKey,e.disabled),v=e.internalPopupClose,b=e.children,y=e.itemIcon,h=e.expandIcon,Z=e.popupClassName,C=e.popupOffset,k=e.popupStyle,M=e.onClick,R=e.onMouseEnter,S=e.onMouseLeave,I=e.onTitleClick,K=e.onTitleMouseEnter,O=e.onTitleMouseLeave,A=(0,a.Z)(e,eN),T=g(d),L=m.useContext(E),D=L.prefixCls,_=L.mode,V=L.openKeys,z=L.disabled,F=L.overflowDisabled,j=L.activeKey,B=L.selectedKeys,W=L.itemIcon,H=L.expandIcon,Y=L.onItemClick,q=L.onOpenChange,X=L.onActive,Q=m.useContext(P)._internalRenderSubMenuItem,U=m.useContext(N).isSubPathKey,J=x(),$="".concat(D,"-submenu"),ee=z||p,en=m.useRef(),et=m.useRef(),er=null!=h?h:H,eu=V.includes(d),ec=!F&&eu,es=U(B,d),ef=eo(d,ee,K,O),ed=ef.active,ep=(0,a.Z)(ef,eP),ev=m.useState(!1),em=(0,u.Z)(ev,2),ey=em[0],eh=em[1],eg=function(e){ee||eh(e)},eZ=m.useMemo(function(){return ed||"inline"!==_&&(ey||U([j],d))},[_,ed,j,ey,d,U]),eC=ei(J.length),eE=G(function(e){null==M||M(ea(e)),Y(e)}),ew=T&&"".concat(T,"-popup"),ek=m.useMemo(function(){return m.createElement(el,{icon:"horizontal"!==_?er:void 0,props:(0,i.Z)((0,i.Z)({},e),{},{isOpen:ec,isSubMenu:!0})},m.createElement("i",{className:"".concat($,"-arrow")}))},[_,er,e,ec,$]),eR=m.createElement("div",(0,r.Z)({role:"menuitem",style:eC,className:"".concat($,"-title"),tabIndex:ee?null:-1,ref:en,title:"string"==typeof c?c:null,"data-menu-id":F&&T?null:T,"aria-expanded":ec,"aria-haspopup":!0,"aria-controls":ew,"aria-disabled":ee,onClick:function(e){ee||(null==I||I({key:d,domEvent:e}),"inline"===_&&q(d,!eu))},onFocus:function(){X(d)}},ep),c,ek),eS=m.useRef(_);if("inline"!==_&&J.length>1?eS.current="vertical":eS.current=_,!F){var eI=eS.current;eR=m.createElement(eM,{mode:eI,prefixCls:$,visible:!v&&ec&&"inline"!==_,popupClassName:Z,popupOffset:C,popupStyle:k,popup:m.createElement(w,{mode:"horizontal"===eI?"vertical":eI},m.createElement(eb,{id:ew,ref:et},b)),disabled:ee,onVisibleChange:function(e){"inline"!==_&&q(d,e)}},eR)}var eK=m.createElement(f.Z.Item,(0,r.Z)({ref:n,role:"none"},A,{component:"li",style:t,className:s()($,"".concat($,"-").concat(_),l,(0,o.Z)((0,o.Z)((0,o.Z)((0,o.Z)({},"".concat($,"-open"),ec),"".concat($,"-active"),eZ),"".concat($,"-selected"),es),"".concat($,"-disabled"),ee)),onMouseEnter:function(e){eg(!0),null==R||R({key:d,domEvent:e})},onMouseLeave:function(e){eg(!1),null==S||S({key:d,domEvent:e})}}),eR,!F&&m.createElement(ex,{id:ew,open:ec,keyPath:J},b));return Q&&(eK=Q(eK,e,{selected:es,active:eZ,open:ec,disabled:ee})),m.createElement(w,{onItemClick:eE,mode:"horizontal"===_?"vertical":_,itemIcon:null!=y?y:W,expandIcon:er},eK)}),eI=m.forwardRef(function(e,n){var t,o=e.eventKey,i=e.children,l=x(o),u=eh(i,l),a=M();return m.useEffect(function(){if(a)return a.registerPath(o,l),function(){a.unregisterPath(o,l)}},[l]),t=a?u:m.createElement(eS,(0,r.Z)({ref:n},e),u),m.createElement(R.Provider,{value:l},t)}),eK=t(41154);function eO(e){var n=e.className,t=e.style,r=m.useContext(E).prefixCls;return M()?null:m.createElement("li",{role:"separator",className:s()("".concat(r,"-item-divider"),n),style:t})}var eA=["className","title","eventKey","children"],eT=m.forwardRef(function(e,n){var t=e.className,o=e.title,i=(e.eventKey,e.children),l=(0,a.Z)(e,eA),u=m.useContext(E).prefixCls,c="".concat(u,"-item-group");return m.createElement("li",(0,r.Z)({ref:n,role:"presentation"},l,{onClick:function(e){return e.stopPropagation()},className:s()(c,t)}),m.createElement("div",{role:"presentation",className:"".concat(c,"-title"),title:"string"==typeof o?o:void 0},o),m.createElement("ul",{role:"group",className:"".concat(c,"-list")},i))}),eL=m.forwardRef(function(e,n){var t=e.eventKey,o=eh(e.children,x(t));return M()?o:m.createElement(eT,(0,r.Z)({ref:n},(0,et.Z)(e,["warnKey"])),o)}),eD=["label","children","key","type","extra"];function e_(e,n,t,o,l){var u=e,c=(0,i.Z)({divider:eO,item:ev,group:eL,submenu:eI},o);return n&&(u=function e(n,t,o){var i=t.item,l=t.group,u=t.submenu,c=t.divider;return(n||[]).map(function(n,s){if(n&&"object"===(0,eK.Z)(n)){var f=n.label,d=n.children,p=n.key,v=n.type,b=n.extra,y=(0,a.Z)(n,eD),h=null!=p?p:"tmp-".concat(s);return d||"group"===v?"group"===v?m.createElement(l,(0,r.Z)({key:h},y,{title:f}),e(d,t,o)):m.createElement(u,(0,r.Z)({key:h},y,{title:f}),e(d,t,o)):"divider"===v?m.createElement(c,(0,r.Z)({key:h},y)):m.createElement(i,(0,r.Z)({key:h},y,{extra:b}),f,(!!b||0===b)&&m.createElement("span",{className:"".concat(o,"-item-extra")},b))}return null}).filter(function(e){return e})}(n,c,l)),eh(u,t)}var eV=["prefixCls","rootClassName","style","className","tabIndex","items","children","direction","id","mode","inlineCollapsed","disabled","disabledOverflow","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","defaultOpenKeys","openKeys","activeKey","defaultActiveFirst","selectable","multiple","defaultSelectedKeys","selectedKeys","onSelect","onDeselect","inlineIndent","motion","defaultMotions","triggerSubMenuAction","builtinPlacements","itemIcon","expandIcon","overflowedIndicator","overflowedIndicatorPopupClassName","getPopupContainer","onClick","onOpenChange","onKeyDown","openAnimation","openTransitionName","_internalRenderMenuItem","_internalRenderSubMenuItem","_internalComponents"],ez=[],eF=m.forwardRef(function(e,n){var t,c,v,h,g,Z,C,E,M,R,x,S,I,K,J,$,ee,en,et,er,eo,ei,el,eu,ec,es,ef=e.prefixCls,ed=void 0===ef?"rc-menu":ef,ep=e.rootClassName,em=e.style,eb=e.className,ey=e.tabIndex,eh=e.items,eg=e.children,eZ=e.direction,eC=e.id,eE=e.mode,ew=void 0===eE?"vertical":eE,ek=e.inlineCollapsed,eM=e.disabled,eR=e.disabledOverflow,ex=e.subMenuOpenDelay,eN=e.subMenuCloseDelay,eP=e.forceSubMenuRender,eS=e.defaultOpenKeys,eK=e.openKeys,eO=e.activeKey,eA=e.defaultActiveFirst,eT=e.selectable,eL=void 0===eT||eT,eD=e.multiple,eF=void 0!==eD&&eD,ej=e.defaultSelectedKeys,eB=e.selectedKeys,eW=e.onSelect,eH=e.onDeselect,eY=e.inlineIndent,eq=e.motion,eX=e.defaultMotions,eG=e.triggerSubMenuAction,eQ=e.builtinPlacements,eU=e.itemIcon,eJ=e.expandIcon,e$=e.overflowedIndicator,e0=void 0===e$?"...":e$,e1=e.overflowedIndicatorPopupClassName,e2=e.getPopupContainer,e6=e.onClick,e5=e.onOpenChange,e9=e.onKeyDown,e4=(e.openAnimation,e.openTransitionName,e._internalRenderMenuItem),e3=e._internalRenderSubMenuItem,e8=e._internalComponents,e7=(0,a.Z)(e,eV),ne=m.useMemo(function(){return[e_(eg,eh,ez,e8,ed),e_(eg,eh,ez,{},ed)]},[eg,eh,e8]),nn=(0,u.Z)(ne,2),nt=nn[0],nr=nn[1],no=m.useState(!1),ni=(0,u.Z)(no,2),nl=ni[0],nu=ni[1],na=m.useRef(),nc=(t=(0,d.Z)(eC,{value:eC}),v=(c=(0,u.Z)(t,2))[0],h=c[1],m.useEffect(function(){U+=1;var e="".concat(Q,"-").concat(U);h("rc-menu-uuid-".concat(e))},[]),v),ns="rtl"===eZ,nf=(0,d.Z)(eS,{value:eK,postState:function(e){return e||ez}}),nd=(0,u.Z)(nf,2),np=nd[0],nv=nd[1],nm=function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];function t(){nv(e),null==e5||e5(e)}n?(0,b.flushSync)(t):t()},nb=m.useState(np),ny=(0,u.Z)(nb,2),nh=ny[0],ng=ny[1],nZ=m.useRef(!1),nC=m.useMemo(function(){return("inline"===ew||"vertical"===ew)&&ek?["vertical",ek]:[ew,!1]},[ew,ek]),nE=(0,u.Z)(nC,2),nw=nE[0],nk=nE[1],nM="inline"===nw,nR=m.useState(nw),nx=(0,u.Z)(nR,2),nN=nx[0],nP=nx[1],nS=m.useState(nk),nI=(0,u.Z)(nS,2),nK=nI[0],nO=nI[1];m.useEffect(function(){nP(nw),nO(nk),nZ.current&&(nM?nv(nh):nm(ez))},[nw,nk]);var nA=m.useState(0),nT=(0,u.Z)(nA,2),nL=nT[0],nD=nT[1],n_=nL>=nt.length-1||"horizontal"!==nN||eR;m.useEffect(function(){nM&&ng(np)},[np]),m.useEffect(function(){return nZ.current=!0,function(){nZ.current=!1}},[]);var nV=(g=m.useState({}),Z=(0,u.Z)(g,2)[1],C=(0,m.useRef)(new Map),E=(0,m.useRef)(new Map),M=m.useState([]),x=(R=(0,u.Z)(M,2))[0],S=R[1],I=(0,m.useRef)(0),K=(0,m.useRef)(!1),J=function(){K.current||Z({})},$=(0,m.useCallback)(function(e,n){var t,r=q(n);E.current.set(r,e),C.current.set(e,r),I.current+=1;var o=I.current;t=function(){o===I.current&&J()},Promise.resolve().then(t)},[]),ee=(0,m.useCallback)(function(e,n){var t=q(n);E.current.delete(t),C.current.delete(e)},[]),en=(0,m.useCallback)(function(e){S(e)},[]),et=(0,m.useCallback)(function(e,n){var t=(C.current.get(e)||"").split(Y);return n&&x.includes(t[0])&&t.unshift(X),t},[x]),er=(0,m.useCallback)(function(e,n){return e.filter(function(e){return void 0!==e}).some(function(e){return et(e,!0).includes(n)})},[et]),eo=(0,m.useCallback)(function(e){var n="".concat(C.current.get(e)).concat(Y),t=new Set;return(0,l.Z)(E.current.keys()).forEach(function(e){e.startsWith(n)&&t.add(E.current.get(e))}),t},[]),m.useEffect(function(){return function(){K.current=!0}},[]),{registerPath:$,unregisterPath:ee,refreshOverflowKeys:en,isSubPathKey:er,getKeyPath:et,getKeys:function(){var e=(0,l.Z)(C.current.keys());return x.length&&e.push(X),e},getSubPathKeys:eo}),nz=nV.registerPath,nF=nV.unregisterPath,nj=nV.refreshOverflowKeys,nB=nV.isSubPathKey,nW=nV.getKeyPath,nH=nV.getKeys,nY=nV.getSubPathKeys,nq=m.useMemo(function(){return{registerPath:nz,unregisterPath:nF}},[nz,nF]),nX=m.useMemo(function(){return{isSubPathKey:nB}},[nB]);m.useEffect(function(){nj(n_?ez:nt.slice(nL+1).map(function(e){return e.key}))},[nL,n_]);var nG=(0,d.Z)(eO||eA&&(null===(es=nt[0])||void 0===es?void 0:es.key),{value:eO}),nQ=(0,u.Z)(nG,2),nU=nQ[0],nJ=nQ[1],n$=G(function(e){nJ(e)}),n0=G(function(){nJ(void 0)});(0,m.useImperativeHandle)(n,function(){return{list:na.current,focus:function(e){var n,t,r=H(nH(),nc),o=r.elements,i=r.key2element,l=r.element2key,u=B(na.current,o),a=null!=nU?nU:u[0]?l.get(u[0]):null===(n=nt.find(function(e){return!e.props.disabled}))||void 0===n?void 0:n.key,c=i.get(a);a&&c&&(null==c||null===(t=c.focus)||void 0===t||t.call(c,e))}}});var n1=(0,d.Z)(ej||[],{value:eB,postState:function(e){return Array.isArray(e)?e:null==e?ez:[e]}}),n2=(0,u.Z)(n1,2),n6=n2[0],n5=n2[1],n9=function(e){if(eL){var n,t=e.key,r=n6.includes(t);n5(n=eF?r?n6.filter(function(e){return e!==t}):[].concat((0,l.Z)(n6),[t]):[t]);var o=(0,i.Z)((0,i.Z)({},e),{},{selectedKeys:n});r?null==eH||eH(o):null==eW||eW(o)}!eF&&np.length&&"inline"!==nN&&nm(ez)},n4=G(function(e){null==e6||e6(ea(e)),n9(e)}),n3=G(function(e,n){var t=np.filter(function(n){return n!==e});if(n)t.push(e);else if("inline"!==nN){var r=nY(e);t=t.filter(function(e){return!r.has(e)})}(0,p.Z)(np,t,!0)||nm(t,!0)}),n8=(ei=function(e,n){var t=null!=n?n:!np.includes(e);n3(e,t)},el=m.useRef(),(eu=m.useRef()).current=nU,ec=function(){O.Z.cancel(el.current)},m.useEffect(function(){return function(){ec()}},[]),function(e){var n=e.which;if([].concat(j,[_,V,z,F]).includes(n)){var t=nH(),r=H(t,nc),i=r,l=i.elements,u=i.key2element,a=i.element2key,c=function(e,n){for(var t=e||document.activeElement;t;){if(n.has(t))return t;t=t.parentElement}return null}(u.get(nU),l),s=a.get(c),f=function(e,n,t,r){var i,l="prev",u="next",a="children",c="parent";if("inline"===e&&r===_)return{inlineTrigger:!0};var s=(0,o.Z)((0,o.Z)({},L,l),D,u),f=(0,o.Z)((0,o.Z)((0,o.Z)((0,o.Z)({},A,t?u:l),T,t?l:u),D,a),_,a),d=(0,o.Z)((0,o.Z)((0,o.Z)((0,o.Z)((0,o.Z)((0,o.Z)({},L,l),D,u),_,a),V,c),A,t?a:c),T,t?c:a);switch(null===(i=({inline:s,horizontal:f,vertical:d,inlineSub:s,horizontalSub:d,verticalSub:d})["".concat(e).concat(n?"":"Sub")])||void 0===i?void 0:i[r]){case l:return{offset:-1,sibling:!0};case u:return{offset:1,sibling:!0};case c:return{offset:-1,sibling:!1};case a:return{offset:1,sibling:!1};default:return null}}(nN,1===nW(s,!0).length,ns,n);if(!f&&n!==z&&n!==F)return;(j.includes(n)||[z,F].includes(n))&&e.preventDefault();var d=function(e){if(e){var n=e,t=e.querySelector("a");null!=t&&t.getAttribute("href")&&(n=t);var r=a.get(e);nJ(r),ec(),el.current=(0,O.Z)(function(){eu.current===r&&n.focus()})}};if([z,F].includes(n)||f.sibling||!c){var p,v=B(p=c&&"inline"!==nN?function(e){for(var n=e;n;){if(n.getAttribute("data-menu-list"))return n;n=n.parentElement}return null}(c):na.current,l);d(n===z?v[0]:n===F?v[v.length-1]:W(p,l,c,f.offset))}else if(f.inlineTrigger)ei(s);else if(f.offset>0)ei(s,!0),ec(),el.current=(0,O.Z)(function(){r=H(t,nc);var e=c.getAttribute("aria-controls");d(W(document.getElementById(e),r.elements))},5);else if(f.offset<0){var m=nW(s,!0),b=m[m.length-2],y=u.get(b);ei(b,!1),d(y)}}null==e9||e9(e)});m.useEffect(function(){nu(!0)},[]);var n7=m.useMemo(function(){return{_internalRenderMenuItem:e4,_internalRenderSubMenuItem:e3}},[e4,e3]),te="horizontal"!==nN||eR?nt:nt.map(function(e,n){return m.createElement(w,{key:e.key,overflowDisabled:n>nL},e)}),tn=m.createElement(f.Z,(0,r.Z)({id:eC,ref:na,prefixCls:"".concat(ed,"-overflow"),component:"ul",itemComponent:ev,className:s()(ed,"".concat(ed,"-root"),"".concat(ed,"-").concat(nN),eb,(0,o.Z)((0,o.Z)({},"".concat(ed,"-inline-collapsed"),nK),"".concat(ed,"-rtl"),ns),ep),dir:eZ,style:em,role:"menu",tabIndex:void 0===ey?0:ey,data:te,renderRawItem:function(e){return e},renderRawRest:function(e){var n=e.length,t=n?nt.slice(-n):null;return m.createElement(eI,{eventKey:X,title:e0,disabled:n_,internalPopupClose:0===n,popupClassName:e1},t)},maxCount:"horizontal"!==nN||eR?f.Z.INVALIDATE:f.Z.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:function(e){nD(e)},onKeyDown:n8},e7));return m.createElement(P.Provider,{value:n7},m.createElement(y.Provider,{value:nc},m.createElement(w,{prefixCls:ed,rootClassName:ep,mode:nN,openKeys:np,rtl:ns,disabled:eM,motion:nl?eq:null,defaultMotions:nl?eX:null,activeKey:nU,onActive:n$,onInactive:n0,selectedKeys:n6,inlineIndent:void 0===eY?24:eY,subMenuOpenDelay:void 0===ex?.1:ex,subMenuCloseDelay:void 0===eN?.1:eN,forceSubMenuRender:eP,builtinPlacements:eQ,triggerSubMenuAction:void 0===eG?"hover":eG,getPopupContainer:e2,itemIcon:eU,expandIcon:eJ,onItemClick:n4,onOpenChange:n3},m.createElement(N.Provider,{value:nX},tn),m.createElement("div",{style:{display:"none"},"aria-hidden":!0},m.createElement(k.Provider,{value:nq},nr)))))});eF.Item=ev,eF.SubMenu=eI,eF.ItemGroup=eL,eF.Divider=eO;var ej=eF}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/337-bb33d149e9f461b3.js b/litellm/proxy/_experimental/out/_next/static/chunks/337-bb33d149e9f461b3.js new file mode 100644 index 00000000000..d0085b0c417 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/337-bb33d149e9f461b3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[337],{50337:function(e,t,a){a.d(t,{Z:function(){return z}});var n=a(2265),c=a(36760),i=a.n(c),l=a(71744),o=a(18694),s=e=>{let{prefixCls:t,className:a,style:c,size:l,shape:o}=e,s=i()({["".concat(t,"-lg")]:"large"===l,["".concat(t,"-sm")]:"small"===l}),r=i()({["".concat(t,"-circle")]:"circle"===o,["".concat(t,"-square")]:"square"===o,["".concat(t,"-round")]:"round"===o}),g=n.useMemo(()=>"number"==typeof l?{width:l,height:l,lineHeight:"".concat(l,"px")}:{},[l]);return n.createElement("span",{className:i()(t,s,r,a),style:Object.assign(Object.assign({},g),c)})},r=a(93463),g=a(99320),d=a(71140);let u=new r.E4("ant-skeleton-loading",{"0%":{backgroundPosition:"100% 50%"},"100%":{backgroundPosition:"0 50%"}}),m=e=>({height:e,lineHeight:(0,r.bf)(e)}),b=e=>Object.assign({width:e},m(e)),h=e=>({background:e.skeletonLoadingBackground,backgroundSize:"400% 100%",animationName:u,animationDuration:e.skeletonLoadingMotionDuration,animationTimingFunction:"ease",animationIterationCount:"infinite"}),p=(e,t)=>Object.assign({width:t(e).mul(5).equal(),minWidth:t(e).mul(5).equal()},m(e)),k=e=>{let{skeletonAvatarCls:t,gradientFromColor:a,controlHeight:n,controlHeightLG:c,controlHeightSM:i}=e;return{[t]:Object.assign({display:"inline-block",verticalAlign:"top",background:a},b(n)),["".concat(t).concat(t,"-circle")]:{borderRadius:"50%"},["".concat(t).concat(t,"-lg")]:Object.assign({},b(c)),["".concat(t).concat(t,"-sm")]:Object.assign({},b(i))}},j=e=>{let{controlHeight:t,borderRadiusSM:a,skeletonInputCls:n,controlHeightLG:c,controlHeightSM:i,gradientFromColor:l,calc:o}=e;return{[n]:Object.assign({display:"inline-block",verticalAlign:"top",background:l,borderRadius:a},p(t,o)),["".concat(n,"-lg")]:Object.assign({},p(c,o)),["".concat(n,"-sm")]:Object.assign({},p(i,o))}},O=e=>Object.assign({width:e},m(e)),v=e=>{let{skeletonImageCls:t,imageSizeBase:a,gradientFromColor:n,borderRadiusSM:c,calc:i}=e;return{[t]:Object.assign(Object.assign({display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"middle",background:n,borderRadius:c},O(i(a).mul(2).equal())),{["".concat(t,"-path")]:{fill:"#bfbfbf"},["".concat(t,"-svg")]:Object.assign(Object.assign({},O(a)),{maxWidth:i(a).mul(4).equal(),maxHeight:i(a).mul(4).equal()}),["".concat(t,"-svg").concat(t,"-svg-circle")]:{borderRadius:"50%"}}),["".concat(t).concat(t,"-circle")]:{borderRadius:"50%"}}},f=(e,t,a)=>{let{skeletonButtonCls:n}=e;return{["".concat(a).concat(n,"-circle")]:{width:t,minWidth:t,borderRadius:"50%"},["".concat(a).concat(n,"-round")]:{borderRadius:t}}},C=(e,t)=>Object.assign({width:t(e).mul(2).equal(),minWidth:t(e).mul(2).equal()},m(e)),E=e=>{let{borderRadiusSM:t,skeletonButtonCls:a,controlHeight:n,controlHeightLG:c,controlHeightSM:i,gradientFromColor:l,calc:o}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({[a]:Object.assign({display:"inline-block",verticalAlign:"top",background:l,borderRadius:t,width:o(n).mul(2).equal(),minWidth:o(n).mul(2).equal()},C(n,o))},f(e,n,a)),{["".concat(a,"-lg")]:Object.assign({},C(c,o))}),f(e,c,"".concat(a,"-lg"))),{["".concat(a,"-sm")]:Object.assign({},C(i,o))}),f(e,i,"".concat(a,"-sm")))},w=e=>{let{componentCls:t,skeletonAvatarCls:a,skeletonTitleCls:n,skeletonParagraphCls:c,skeletonButtonCls:i,skeletonInputCls:l,skeletonImageCls:o,controlHeight:s,controlHeightLG:r,controlHeightSM:g,gradientFromColor:d,padding:u,marginSM:m,borderRadius:p,titleHeight:O,blockRadius:f,paragraphLiHeight:C,controlHeightXS:w,paragraphMarginTop:x}=e;return{[t]:{display:"table",width:"100%",["".concat(t,"-header")]:{display:"table-cell",paddingInlineEnd:u,verticalAlign:"top",[a]:Object.assign({display:"inline-block",verticalAlign:"top",background:d},b(s)),["".concat(a,"-circle")]:{borderRadius:"50%"},["".concat(a,"-lg")]:Object.assign({},b(r)),["".concat(a,"-sm")]:Object.assign({},b(g))},["".concat(t,"-content")]:{display:"table-cell",width:"100%",verticalAlign:"top",[n]:{width:"100%",height:O,background:d,borderRadius:f,["+ ".concat(c)]:{marginBlockStart:g}},[c]:{padding:0,"> li":{width:"100%",height:C,listStyle:"none",background:d,borderRadius:f,"+ li":{marginBlockStart:w}}},["".concat(c,"> li:last-child:not(:first-child):not(:nth-child(2))")]:{width:"61%"}},["&-round ".concat(t,"-content")]:{["".concat(n,", ").concat(c," > li")]:{borderRadius:p}}},["".concat(t,"-with-avatar ").concat(t,"-content")]:{[n]:{marginBlockStart:m,["+ ".concat(c)]:{marginBlockStart:x}}},["".concat(t).concat(t,"-element")]:Object.assign(Object.assign(Object.assign(Object.assign({display:"inline-block",width:"auto"},E(e)),k(e)),j(e)),v(e)),["".concat(t).concat(t,"-block")]:{width:"100%",[i]:{width:"100%"},[l]:{width:"100%"}},["".concat(t).concat(t,"-active")]:{["\n ".concat(n,",\n ").concat(c," > li,\n ").concat(a,",\n ").concat(i,",\n ").concat(l,",\n ").concat(o,"\n ")]:Object.assign({},h(e))}}};var x=(0,g.I$)("Skeleton",e=>{let{componentCls:t,calc:a}=e;return w((0,d.IX)(e,{skeletonAvatarCls:"".concat(t,"-avatar"),skeletonTitleCls:"".concat(t,"-title"),skeletonParagraphCls:"".concat(t,"-paragraph"),skeletonButtonCls:"".concat(t,"-button"),skeletonInputCls:"".concat(t,"-input"),skeletonImageCls:"".concat(t,"-image"),imageSizeBase:a(e.controlHeight).mul(1.5).equal(),borderRadius:100,skeletonLoadingBackground:"linear-gradient(90deg, ".concat(e.gradientFromColor," 25%, ").concat(e.gradientToColor," 37%, ").concat(e.gradientFromColor," 63%)"),skeletonLoadingMotionDuration:"1.4s"}))},e=>{let{colorFillContent:t,colorFill:a}=e;return{color:t,colorGradientEnd:a,gradientFromColor:t,gradientToColor:a,titleHeight:e.controlHeight/2,blockRadius:e.borderRadiusSM,paragraphMarginTop:e.marginLG+e.marginXXS,paragraphLiHeight:e.controlHeight/2}},{deprecatedTokens:[["color","gradientFromColor"],["colorGradientEnd","gradientToColor"]]});let y=(e,t)=>{let{width:a,rows:n=2}=t;return Array.isArray(a)?a[e]:n-1===e?a:void 0};var q=e=>{let{prefixCls:t,className:a,style:c,rows:l=0}=e,o=Array.from({length:l}).map((t,a)=>n.createElement("li",{key:a,style:{width:y(a,e)}}));return n.createElement("ul",{className:i()(t,a),style:c},o)},N=e=>{let{prefixCls:t,className:a,width:c,style:l}=e;return n.createElement("h3",{className:i()(t,a),style:Object.assign({width:c},l)})};function R(e){return e&&"object"==typeof e?e:{}}let A=e=>{let{prefixCls:t,loading:a,className:c,rootClassName:o,style:r,children:g,avatar:d=!1,title:u=!0,paragraph:m=!0,active:b,round:h}=e,{getPrefixCls:p,direction:k,className:j,style:O}=(0,l.dj)("skeleton"),v=p("skeleton",t),[f,C,E]=x(v);if(a||!("loading"in e)){let e,t;let a=!!d,l=!!u,g=!!m;if(a){let t=Object.assign(Object.assign({prefixCls:"".concat(v,"-avatar")},l&&!g?{size:"large",shape:"square"}:{size:"large",shape:"circle"}),R(d));e=n.createElement("div",{className:"".concat(v,"-header")},n.createElement(s,Object.assign({},t)))}if(l||g){let e,c;if(l){let t=Object.assign(Object.assign({prefixCls:"".concat(v,"-title")},!a&&g?{width:"38%"}:a&&g?{width:"50%"}:{}),R(u));e=n.createElement(N,Object.assign({},t))}if(g){let e=Object.assign(Object.assign({prefixCls:"".concat(v,"-paragraph")},function(e,t){let a={};return e&&t||(a.width="61%"),!e&&t?a.rows=3:a.rows=2,a}(a,l)),R(m));c=n.createElement(q,Object.assign({},e))}t=n.createElement("div",{className:"".concat(v,"-content")},e,c)}let p=i()(v,{["".concat(v,"-with-avatar")]:a,["".concat(v,"-active")]:b,["".concat(v,"-rtl")]:"rtl"===k,["".concat(v,"-round")]:h},j,c,o,C,E);return f(n.createElement("div",{className:p,style:Object.assign(Object.assign({},O),r)},e,t))}return null!=g?g:null};A.Button=e=>{let{prefixCls:t,className:a,rootClassName:c,active:r,block:g=!1,size:d="default"}=e,{getPrefixCls:u}=n.useContext(l.E_),m=u("skeleton",t),[b,h,p]=x(m),k=(0,o.Z)(e,["prefixCls"]),j=i()(m,"".concat(m,"-element"),{["".concat(m,"-active")]:r,["".concat(m,"-block")]:g},a,c,h,p);return b(n.createElement("div",{className:j},n.createElement(s,Object.assign({prefixCls:"".concat(m,"-button"),size:d},k))))},A.Avatar=e=>{let{prefixCls:t,className:a,rootClassName:c,active:r,shape:g="circle",size:d="default"}=e,{getPrefixCls:u}=n.useContext(l.E_),m=u("skeleton",t),[b,h,p]=x(m),k=(0,o.Z)(e,["prefixCls","className"]),j=i()(m,"".concat(m,"-element"),{["".concat(m,"-active")]:r},a,c,h,p);return b(n.createElement("div",{className:j},n.createElement(s,Object.assign({prefixCls:"".concat(m,"-avatar"),shape:g,size:d},k))))},A.Input=e=>{let{prefixCls:t,className:a,rootClassName:c,active:r,block:g,size:d="default"}=e,{getPrefixCls:u}=n.useContext(l.E_),m=u("skeleton",t),[b,h,p]=x(m),k=(0,o.Z)(e,["prefixCls"]),j=i()(m,"".concat(m,"-element"),{["".concat(m,"-active")]:r,["".concat(m,"-block")]:g},a,c,h,p);return b(n.createElement("div",{className:j},n.createElement(s,Object.assign({prefixCls:"".concat(m,"-input"),size:d},k))))},A.Image=e=>{let{prefixCls:t,className:a,rootClassName:c,style:o,active:s}=e,{getPrefixCls:r}=n.useContext(l.E_),g=r("skeleton",t),[d,u,m]=x(g),b=i()(g,"".concat(g,"-element"),{["".concat(g,"-active")]:s},a,c,u,m);return d(n.createElement("div",{className:b},n.createElement("div",{className:i()("".concat(g,"-image"),a),style:o},n.createElement("svg",{viewBox:"0 0 1098 1024",xmlns:"http://www.w3.org/2000/svg",className:"".concat(g,"-image-svg")},n.createElement("title",null,"Image placeholder"),n.createElement("path",{d:"M365.714286 329.142857q0 45.714286-32.036571 77.677714t-77.677714 32.036571-77.677714-32.036571-32.036571-77.677714 32.036571-77.677714 77.677714-32.036571 77.677714 32.036571 32.036571 77.677714zM950.857143 548.571429l0 256-804.571429 0 0-109.714286 182.857143-182.857143 91.428571 91.428571 292.571429-292.571429zM1005.714286 146.285714l-914.285714 0q-7.460571 0-12.873143 5.412571t-5.412571 12.873143l0 694.857143q0 7.460571 5.412571 12.873143t12.873143 5.412571l914.285714 0q7.460571 0 12.873143-5.412571t5.412571-12.873143l0-694.857143q0-7.460571-5.412571-12.873143t-12.873143-5.412571zM1097.142857 164.571429l0 694.857143q0 37.741714-26.843429 64.585143t-64.585143 26.843429l-914.285714 0q-37.741714 0-64.585143-26.843429t-26.843429-64.585143l0-694.857143q0-37.741714 26.843429-64.585143t64.585143-26.843429l914.285714 0q37.741714 0 64.585143 26.843429t26.843429 64.585143z",className:"".concat(g,"-image-path")})))))},A.Node=e=>{let{prefixCls:t,className:a,rootClassName:c,style:o,active:s,children:r}=e,{getPrefixCls:g}=n.useContext(l.E_),d=g("skeleton",t),[u,m,b]=x(d),h=i()(d,"".concat(d,"-element"),{["".concat(d,"-active")]:s},m,a,c,b);return u(n.createElement("div",{className:h},n.createElement("div",{className:i()("".concat(d,"-image"),a),style:o},r)))};var z=A}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/3705-124a560b74decaa8.js b/litellm/proxy/_experimental/out/_next/static/chunks/3705-1dcdbda1985a6786.js similarity index 100% rename from litellm/proxy/_experimental/out/_next/static/chunks/3705-124a560b74decaa8.js rename to litellm/proxy/_experimental/out/_next/static/chunks/3705-1dcdbda1985a6786.js diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/3801-ff2404f6d0c38247.js b/litellm/proxy/_experimental/out/_next/static/chunks/3801-5abad9290d1ac527.js similarity index 99% rename from litellm/proxy/_experimental/out/_next/static/chunks/3801-ff2404f6d0c38247.js rename to litellm/proxy/_experimental/out/_next/static/chunks/3801-5abad9290d1ac527.js index 5e4ad1a6f89..bd7c4e9e15f 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/3801-ff2404f6d0c38247.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/3801-5abad9290d1ac527.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3801],{12363:function(e,s,a){a.d(s,{d:function(){return r},n:function(){return l}});var t=a(2265);let l=()=>{let[e,s]=(0,t.useState)("http://localhost:4000");return(0,t.useEffect)(()=>{{let{protocol:e,host:a}=window.location;s("".concat(e,"//").concat(a))}},[]),e},r=25},30841:function(e,s,a){a.d(s,{IE:function(){return r},LO:function(){return l},cT:function(){return n}});var t=a(19250);let l=async e=>{if(!e)return[];try{let{aliases:s}=await (0,t.keyAliasesCall)(e);return Array.from(new Set((s||[]).filter(Boolean)))}catch(e){return console.error("Error fetching all key aliases:",e),[]}},r=async(e,s)=>{if(!e)return[];try{let a=[],l=1,r=!0;for(;r;){let n=await (0,t.teamListCall)(e,s||null,null);a=[...a,...n],l{if(!e)return[];try{let s=[],a=1,l=!0;for(;l;){let r=await (0,t.organizationListCall)(e);s=[...s,...r],a{let{options:s,onApplyFilters:a,onResetFilters:d,initialValues:m={},buttonLabel:u="Filters"}=e,[x,h]=(0,l.useState)(!1),[g,p]=(0,l.useState)(m),[f,j]=(0,l.useState)({}),[v,b]=(0,l.useState)({}),[y,N]=(0,l.useState)({}),[w,k]=(0,l.useState)({}),_=(0,l.useCallback)(c()(async(e,s)=>{if(s.isSearchable&&s.searchFn){b(e=>({...e,[s.name]:!0}));try{let a=await s.searchFn(e);j(e=>({...e,[s.name]:a}))}catch(e){console.error("Error searching:",e),j(e=>({...e,[s.name]:[]}))}finally{b(e=>({...e,[s.name]:!1}))}}},300),[]),S=(0,l.useCallback)(async e=>{if(e.isSearchable&&e.searchFn&&!w[e.name]){b(s=>({...s,[e.name]:!0})),k(s=>({...s,[e.name]:!0}));try{let s=await e.searchFn("");j(a=>({...a,[e.name]:s}))}catch(s){console.error("Error loading initial options:",s),j(s=>({...s,[e.name]:[]}))}finally{b(s=>({...s,[e.name]:!1}))}}},[w]);(0,l.useEffect)(()=>{x&&s.forEach(e=>{e.isSearchable&&!w[e.name]&&S(e)})},[x,s,S,w]);let C=(e,s)=>{let t={...g,[e]:s};p(t),a(t)},L=(e,s)=>{e&&s.isSearchable&&!w[s.name]&&S(s)};return(0,t.jsxs)("div",{className:"w-full",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[(0,t.jsx)(r.ZP,{icon:(0,t.jsx)(o.Z,{className:"h-4 w-4"}),onClick:()=>h(!x),className:"flex items-center gap-2",children:u}),(0,t.jsx)(r.ZP,{onClick:()=>{let e={};s.forEach(s=>{e[s.name]=""}),p(e),d()},children:"Reset Filters"})]}),x&&(0,t.jsx)("div",{className:"grid grid-cols-3 gap-x-6 gap-y-4 mb-6",children:["Team ID","Status","Organization ID","Key Alias","User ID","End User","Key Hash","Model"].map(e=>{let a=s.find(s=>s.label===e||s.name===e);return a?(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)("label",{className:"text-sm text-gray-600",children:a.label||a.name}),a.isSearchable?(0,t.jsx)(n.default,{showSearch:!0,className:"w-full",placeholder:"Search ".concat(a.label||a.name,"..."),value:g[a.name]||void 0,onChange:e=>C(a.name,e),onDropdownVisibleChange:e=>L(e,a),onSearch:e=>{N(s=>({...s,[a.name]:e})),a.searchFn&&_(e,a)},filterOption:!1,loading:v[a.name],options:f[a.name]||[],allowClear:!0,notFoundContent:v[a.name]?"Loading...":"No results found"}):a.options?(0,t.jsx)(n.default,{className:"w-full",placeholder:"Select ".concat(a.label||a.name,"..."),value:g[a.name]||void 0,onChange:e=>C(a.name,e),allowClear:!0,children:a.options.map(e=>(0,t.jsx)(n.default.Option,{value:e.value,children:e.label},e.value))}):(0,t.jsx)(i.default,{className:"w-full",placeholder:"Enter ".concat(a.label||a.name,"..."),value:g[a.name]||"",onChange:e=>C(a.name,e.target.value),allowClear:!0})]},a.name):null})})]})}},33801:function(e,s,a){a.d(s,{I:function(){return eg},Z:function(){return eh}});var t=a(57437),l=a(77398),r=a.n(l),n=a(11713),i=a(2265),o=a(29827),d=a(19250),c=a(12322),m=a(42673),u=a(99981);let x=e=>{try{return new Date(e).toLocaleString("en-US",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0}).replace(",","")}catch(e){return"Error converting time"}},h=e=>{let{utcTime:s}=e;return(0,t.jsx)("span",{style:{fontFamily:"monospace",width:"180px",display:"inline-block"},children:x(s)})};var g=a(41649),p=a(78489),f=a(59872);let j=(e,s)=>{var a,t;return(null===(t=e.metadata)||void 0===t?void 0:null===(a=t.mcp_tool_call_metadata)||void 0===a?void 0:a.mcp_server_logo_url)?e.metadata.mcp_tool_call_metadata.mcp_server_logo_url:s?(0,m.dr)(s).logo:""},v=[{id:"expander",header:()=>null,cell:e=>{let{row:s}=e;return(0,t.jsx)(()=>{let[e,a]=i.useState(s.getIsExpanded()),l=i.useCallback(()=>{a(e=>!e),s.getToggleExpandedHandler()()},[s]);return s.getCanExpand()?(0,t.jsx)("button",{onClick:l,style:{cursor:"pointer"},"aria-label":e?"Collapse row":"Expand row",className:"w-6 h-6 flex items-center justify-center focus:outline-none",children:(0,t.jsx)("svg",{className:"w-4 h-4 transform transition-transform duration-75 ".concat(e?"rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}):(0,t.jsx)("span",{className:"w-6 h-6 flex items-center justify-center",children:"ā—"})},{})}},{header:"Time",accessorKey:"startTime",cell:e=>(0,t.jsx)(h,{utcTime:e.getValue()})},{header:"Status",accessorKey:"metadata.status",cell:e=>{let s="failure"!==(e.getValue()||"Success").toLowerCase();return(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block text-center w-16 ".concat(s?"bg-green-100 text-green-800":"bg-red-100 text-red-800"),children:s?"Success":"Failure"})}},{header:"Session ID",accessorKey:"session_id",cell:e=>{let s=String(e.getValue()||""),a=e.row.original.onSessionClick;return(0,t.jsx)(u.Z,{title:String(e.getValue()||""),children:(0,t.jsx)(p.Z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal text-xs max-w-[15ch] truncate block",onClick:()=>null==a?void 0:a(s),children:String(e.getValue()||"")})})}},{header:"Request ID",accessorKey:"request_id",cell:e=>(0,t.jsx)(u.Z,{title:String(e.getValue()||""),children:(0,t.jsx)("span",{className:"font-mono text-xs max-w-[15ch] truncate block",children:String(e.getValue()||"")})})},{header:"Cost",accessorKey:"spend",cell:e=>(0,t.jsxs)("span",{children:["$",(0,f.pw)(e.getValue()||0,6)]})},{header:"Duration (s)",accessorKey:"duration",cell:e=>(0,t.jsx)(u.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"Team Name",accessorKey:"metadata.user_api_key_team_alias",cell:e=>(0,t.jsx)(u.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"Key Hash",accessorKey:"metadata.user_api_key",cell:e=>{let s=String(e.getValue()||"-"),a=e.row.original.onKeyHashClick;return(0,t.jsx)(u.Z,{title:s,children:(0,t.jsx)("span",{className:"font-mono max-w-[15ch] truncate block cursor-pointer hover:text-blue-600",onClick:()=>null==a?void 0:a(s),children:s})})}},{header:"Key Name",accessorKey:"metadata.user_api_key_alias",cell:e=>(0,t.jsx)(u.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"Model",accessorKey:"model",cell:e=>{let s=e.row.original,a=s.custom_llm_provider,l=String(e.getValue()||"");return(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[a&&(0,t.jsx)("img",{src:j(s,a),alt:"",className:"w-4 h-4",onError:e=>{e.target.style.display="none"}}),(0,t.jsx)(u.Z,{title:l,children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:l})})]})}},{header:"Tokens",accessorKey:"total_tokens",cell:e=>{let s=e.row.original;return(0,t.jsxs)("span",{className:"text-sm",children:[String(s.total_tokens||"0"),(0,t.jsxs)("span",{className:"text-gray-400 text-xs ml-1",children:["(",String(s.prompt_tokens||"0"),"+",String(s.completion_tokens||"0"),")"]})]})}},{header:"Internal User",accessorKey:"user",cell:e=>(0,t.jsx)(u.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"End User",accessorKey:"end_user",cell:e=>(0,t.jsx)(u.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"Tags",accessorKey:"request_tags",cell:e=>{let s=e.getValue();if(!s||0===Object.keys(s).length)return"-";let a=Object.entries(s),l=a[0],r=a.slice(1);return(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:(0,t.jsx)(u.Z,{title:(0,t.jsx)("div",{className:"flex flex-col gap-1",children:a.map(e=>{let[s,a]=e;return(0,t.jsxs)("span",{children:[s,": ",String(a)]},s)})}),children:(0,t.jsxs)("span",{className:"px-2 py-1 bg-gray-100 rounded-full text-xs",children:[l[0],": ",String(l[1]),r.length>0&&" +".concat(r.length)]})})})}}],b=e=>(0,t.jsx)(g.Z,{color:"gray",className:"flex items-center gap-1",children:(0,t.jsx)("span",{className:"whitespace-nowrap text-xs",children:e})}),y=[{id:"expander",header:()=>null,cell:e=>{let{row:s}=e;return(0,t.jsx)(()=>{let[e,a]=i.useState(s.getIsExpanded()),l=i.useCallback(()=>{a(e=>!e),s.getToggleExpandedHandler()()},[s]);return s.getCanExpand()?(0,t.jsx)("button",{onClick:l,style:{cursor:"pointer"},"aria-label":e?"Collapse row":"Expand row",className:"w-6 h-6 flex items-center justify-center focus:outline-none",children:(0,t.jsx)("svg",{className:"w-4 h-4 transform transition-transform ".concat(e?"rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}):(0,t.jsx)("span",{className:"w-6 h-6 flex items-center justify-center",children:"ā—"})},{})}},{header:"Timestamp",accessorKey:"updated_at",cell:e=>(0,t.jsx)(h,{utcTime:e.getValue()})},{header:"Table Name",accessorKey:"table_name",cell:e=>{let s=e.getValue(),a=s;switch(s){case"LiteLLM_VerificationToken":a="Keys";break;case"LiteLLM_TeamTable":a="Teams";break;case"LiteLLM_OrganizationTable":a="Organizations";break;case"LiteLLM_UserTable":a="Users";break;case"LiteLLM_ProxyModelTable":a="Models";break;default:a=s}return(0,t.jsx)("span",{children:a})}},{header:"Action",accessorKey:"action",cell:e=>(0,t.jsx)("span",{children:b(e.getValue())})},{header:"Changed By",accessorKey:"changed_by",cell:e=>{let s=e.row.original.changed_by,a=e.row.original.changed_by_api_key;return(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("div",{className:"font-medium",children:s}),a&&(0,t.jsx)(u.Z,{title:a,children:(0,t.jsxs)("div",{className:"text-xs text-muted-foreground max-w-[15ch] truncate",children:[" ",a]})})]})}},{header:"Affected Item ID",accessorKey:"object_id",cell:e=>(0,t.jsx)(()=>{let s=e.getValue(),[a,l]=(0,i.useState)(!1);if(!s)return(0,t.jsx)(t.Fragment,{children:"-"});let r=async()=>{try{await navigator.clipboard.writeText(String(s)),l(!0),setTimeout(()=>l(!1),1500)}catch(e){console.error("Failed to copy object ID: ",e)}};return(0,t.jsx)(u.Z,{title:a?"Copied!":String(s),children:(0,t.jsx)("span",{className:"max-w-[20ch] truncate block cursor-pointer hover:text-blue-600",onClick:r,children:String(s)})})},{})}],N=async(e,s,a,t)=>{console.log("prefetchLogDetails called with",e.length,"logs");let l=e.map(e=>{if(e.request_id)return console.log("Prefetching details for request_id:",e.request_id),t.prefetchQuery({queryKey:["logDetails",e.request_id,s],queryFn:async()=>{console.log("Fetching details for",e.request_id);let t=await (0,d.uiSpendLogDetailsCall)(a,e.request_id,s);return console.log("Received details for",e.request_id,":",t?"success":"failed"),t},staleTime:6e5,gcTime:6e5})});try{let e=await Promise.all(l);return console.log("All prefetch promises completed:",e.length),e}catch(e){throw console.error("Error in prefetchLogDetails:",e),e}};var w=a(9114),k=a(86669);function _(e){let{row:s,hasMessages:a,hasResponse:l,hasError:r,errorInfo:n,getRawRequest:i,formattedResponse:o}=e,d=async e=>{try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0;{let s=document.createElement("textarea");s.value=e,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.focus(),s.select();let a=document.execCommand("copy");if(document.body.removeChild(s),!a)throw Error("execCommand failed");return!0}}catch(e){return console.error("Copy failed:",e),!1}},c=async()=>{await d(JSON.stringify(i(),null,2))?w.Z.success("Request copied to clipboard"):w.Z.fromBackend("Failed to copy request")},m=async()=>{await d(JSON.stringify(o(),null,2))?w.Z.success("Response copied to clipboard"):w.Z.fromBackend("Failed to copy response")};return(0,t.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4 w-full max-w-full overflow-hidden box-border",children:[(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b",children:[(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Request"}),(0,t.jsx)("button",{onClick:c,className:"p-1 hover:bg-gray-200 rounded",title:"Copy request",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]}),(0,t.jsx)("div",{className:"p-4 overflow-auto max-h-96 w-full max-w-full box-border",children:(0,t.jsx)(k.gc,{data:i(),style:k.jF,clickToExpandNode:!0})})]}),(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b",children:[(0,t.jsxs)("h3",{className:"text-lg font-medium",children:["Response",r&&(0,t.jsxs)("span",{className:"ml-2 text-sm text-red-600",children:["• HTTP code ",(null==n?void 0:n.error_code)||400]})]}),(0,t.jsx)("button",{onClick:m,className:"p-1 hover:bg-gray-200 rounded",title:"Copy response",disabled:!l,children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]}),(0,t.jsx)("div",{className:"p-4 overflow-auto max-h-96 w-full max-w-full box-border",children:l?(0,t.jsx)(k.gc,{data:o(),style:k.jF,clickToExpandNode:!0}):(0,t.jsx)("div",{className:"text-gray-500 text-sm italic text-center py-4",children:"Response data not available"})})]})]})}a(52621);let S=e=>{var s;let{errorInfo:a}=e,[l,r]=i.useState({}),[n,o]=i.useState(!1),d=e=>{r(s=>({...s,[e]:!s[e]}))},c=a.traceback&&(s=a.traceback)?Array.from(s.matchAll(/File "([^"]+)", line (\d+)/g)).map(e=>{let a=e[1],t=e[2],l=a.split("/").pop()||a,r=e.index||0,n=s.indexOf('File "',r+1),i=n>-1?s.substring(r,n).trim():s.substring(r).trim(),o=i.split("\n"),d="";return o.length>1&&(d=o[o.length-1].trim()),{filePath:a,fileName:l,lineNumber:t,code:d,inFunction:i.includes(" in ")?i.split(" in ")[1].split("\n")[0]:""}}):[];return(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsx)("div",{className:"p-4 border-b",children:(0,t.jsxs)("h3",{className:"text-lg font-medium flex items-center text-red-600",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),"Error Details"]})}),(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsxs)("div",{className:"bg-red-50 rounded-md p-4 mb-4",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"text-red-800 font-medium w-20",children:"Type:"}),(0,t.jsx)("span",{className:"text-red-700",children:a.error_class||"Unknown Error"})]}),(0,t.jsxs)("div",{className:"flex mt-2",children:[(0,t.jsx)("span",{className:"text-red-800 font-medium w-20 flex-shrink-0",children:"Message:"}),(0,t.jsx)("span",{className:"text-red-700 break-words whitespace-pre-wrap",children:a.error_message||"Unknown error occurred"})]})]}),a.traceback&&(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-2",children:[(0,t.jsx)("h4",{className:"font-medium",children:"Traceback"}),(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,t.jsx)("button",{onClick:()=>{let e=!n;if(o(e),c.length>0){let s={};c.forEach((a,t)=>{s[t]=e}),r(s)}},className:"text-gray-500 hover:text-gray-700 flex items-center text-sm",children:n?"Collapse All":"Expand All"}),(0,t.jsxs)("button",{onClick:()=>navigator.clipboard.writeText(a.traceback||""),className:"text-gray-500 hover:text-gray-700 flex items-center",title:"Copy traceback",children:[(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),(0,t.jsx)("span",{className:"ml-1",children:"Copy"})]})]})]}),(0,t.jsx)("div",{className:"bg-white rounded-md border border-gray-200 overflow-hidden shadow-sm",children:c.map((e,s)=>(0,t.jsxs)("div",{className:"border-b border-gray-200 last:border-b-0",children:[(0,t.jsxs)("div",{className:"px-4 py-2 flex items-center justify-between cursor-pointer hover:bg-gray-50",onClick:()=>d(s),children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("span",{className:"text-gray-400 mr-2 w-12 text-right",children:e.lineNumber}),(0,t.jsx)("span",{className:"text-gray-600 font-medium",children:e.fileName}),(0,t.jsx)("span",{className:"text-gray-500 mx-1",children:"in"}),(0,t.jsx)("span",{className:"text-indigo-600 font-medium",children:e.inFunction||e.fileName})]}),(0,t.jsx)("svg",{className:"w-5 h-5 text-gray-500 transition-transform ".concat(l[s]?"transform rotate-180":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),(l[s]||!1)&&e.code&&(0,t.jsx)("div",{className:"px-12 py-2 font-mono text-sm text-gray-800 bg-gray-50 overflow-x-auto border-t border-gray-100",children:e.code})]},s))})]})]})]})};var C=a(20347);let L=e=>{let{show:s}=e;return s?(0,t.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4 flex items-start",children:[(0,t.jsx)("div",{className:"text-blue-500 mr-3 flex-shrink-0 mt-0.5",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,t.jsx)("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),(0,t.jsx)("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-blue-800",children:"Request/Response Data Not Available"}),(0,t.jsxs)("p",{className:"text-sm text-blue-700 mt-1",children:["To view request and response details, enable prompt storage in your LiteLLM configuration by adding the following to your ",(0,t.jsx)("code",{className:"bg-blue-100 px-1 py-0.5 rounded",children:"proxy_config.yaml"})," file:"]}),(0,t.jsx)("pre",{className:"mt-2 bg-white p-3 rounded border border-blue-200 text-xs font-mono overflow-auto",children:"general_settings:\n store_model_in_db: true\n store_prompts_in_spend_logs: true"}),(0,t.jsx)("p",{className:"text-xs text-blue-700 mt-2",children:"Note: This will only affect new requests after the configuration change."})]})]}):null};var M=a(94292),T=a(12514),E=a(35829),D=a(84264),A=a(96761),I=a(10900),R=a(5545),O=a(30401),H=a(78867);let q=e=>{let{sessionId:s,logs:a,onBack:l}=e,[r,n]=(0,i.useState)(null),[o,d]=(0,i.useState)({}),m=a.reduce((e,s)=>e+(s.spend||0),0),x=a.reduce((e,s)=>e+(s.total_tokens||0),0),h=a.reduce((e,s)=>{var a,t;return e+((null===(t=s.metadata)||void 0===t?void 0:null===(a=t.additional_usage_values)||void 0===a?void 0:a.cache_read_input_tokens)||0)},0),g=a.reduce((e,s)=>{var a,t;return e+((null===(t=s.metadata)||void 0===t?void 0:null===(a=t.additional_usage_values)||void 0===a?void 0:a.cache_creation_input_tokens)||0)},0),j=x+h+g,b=a.length>0?new Date(a[0].startTime):new Date;(((a.length>0?new Date(a[a.length-1].endTime):new Date).getTime()-b.getTime())/1e3).toFixed(2),a.map(e=>({time:new Date(e.startTime).toISOString(),tokens:e.total_tokens||0,cost:e.spend||0}));let y=async(e,s)=>{await (0,f.vQ)(e)&&(d(e=>({...e,[s]:!0})),setTimeout(()=>{d(e=>({...e,[s]:!1}))},2e3))};return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"mb-8",children:[(0,t.jsx)(p.Z,{icon:I.Z,variant:"light",onClick:l,className:"mb-4",children:"Back to All Logs"}),(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsx)("h1",{className:"text-2xl font-semibold text-gray-900",children:"Session Details"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)("p",{className:"text-sm text-gray-500 font-mono",children:s}),(0,t.jsx)(R.ZP,{type:"text",size:"small",icon:o["session-id"]?(0,t.jsx)(O.Z,{size:12}):(0,t.jsx)(H.Z,{size:12}),onClick:()=>y(s,"session-id"),className:"left-2 z-10 transition-all duration-200 ".concat(o["session-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]}),(0,t.jsxs)("a",{href:"https://docs.litellm.ai/docs/proxy/ui_logs_sessions",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-blue-600 hover:text-blue-800 flex items-center gap-1",children:["Get started with session management here",(0,t.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[(0,t.jsxs)(T.Z,{children:[(0,t.jsx)(D.Z,{children:"Total Requests"}),(0,t.jsx)(E.Z,{children:a.length})]}),(0,t.jsxs)(T.Z,{children:[(0,t.jsx)(D.Z,{children:"Total Cost"}),(0,t.jsxs)(E.Z,{children:["$",(0,f.pw)(m,6)]})]}),(0,t.jsx)(u.Z,{title:(0,t.jsxs)("div",{className:"text-white min-w-[200px]",children:[(0,t.jsx)("div",{className:"text-lg font-medium mb-3",children:"Usage breakdown"}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-base font-medium mb-2",children:"Input usage:"}),(0,t.jsxs)("div",{className:"space-y-2 text-sm text-gray-300",children:[(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"input:"}),(0,t.jsx)("span",{className:"ml-8",children:(0,f.pw)(a.reduce((e,s)=>e+(s.prompt_tokens||0),0))})]}),h>0&&(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"input_cached_tokens:"}),(0,t.jsx)("span",{className:"ml-8",children:(0,f.pw)(h)})]}),g>0&&(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"input_cache_creation_tokens:"}),(0,t.jsx)("span",{className:"ml-8",children:(0,f.pw)(g)})]})]})]}),(0,t.jsxs)("div",{className:"border-t border-gray-600 pt-3",children:[(0,t.jsx)("div",{className:"text-base font-medium mb-2",children:"Output usage:"}),(0,t.jsx)("div",{className:"space-y-2 text-sm text-gray-300",children:(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"output:"}),(0,t.jsx)("span",{className:"ml-8",children:(0,f.pw)(a.reduce((e,s)=>e+(s.completion_tokens||0),0))})]})})]}),(0,t.jsx)("div",{className:"border-t border-gray-600 pt-3",children:(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-base font-medium",children:"Total usage:"}),(0,t.jsx)("span",{className:"text-sm text-gray-300",children:(0,f.pw)(j)})]})})]})]}),placement:"top",overlayStyle:{minWidth:"300px"},children:(0,t.jsxs)(T.Z,{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(D.Z,{children:"Total Tokens"}),(0,t.jsx)("span",{className:"text-gray-400 text-sm",children:"ā“˜"})]}),(0,t.jsx)(E.Z,{children:(0,f.pw)(j)})]})})]}),(0,t.jsx)(A.Z,{children:"Session Logs"}),(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(c.w,{columns:v,data:a,renderSubComponent:eg,getRowCanExpand:()=>!0,loadingMessage:"Loading logs...",noDataMessage:"No logs found"})})]})};function F(e){let{data:s}=e,[a,l]=(0,i.useState)(!0),[r,n]=(0,i.useState)({});if(!s||0===s.length)return null;let o=e=>new Date(1e3*e).toLocaleString(),d=(e,s)=>"".concat(((s-e)*1e3).toFixed(2),"ms"),c=(e,s)=>{let a="".concat(e,"-").concat(s);n(e=>({...e,[a]:!e[a]}))};return(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow mb-6",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b cursor-pointer hover:bg-gray-50",onClick:()=>l(!a),children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 text-gray-600 transition-transform ".concat(a?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Vector Store Requests"})]}),(0,t.jsx)("span",{className:"text-sm text-gray-500",children:a?"Click to collapse":"Click to expand"})]}),a&&(0,t.jsx)("div",{className:"p-4",children:s.map((e,s)=>(0,t.jsxs)("div",{className:"mb-6 last:mb-0",children:[(0,t.jsx)("div",{className:"bg-white rounded-lg border p-4 mb-4",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Query:"}),(0,t.jsx)("span",{className:"font-mono",children:e.query})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Vector Store ID:"}),(0,t.jsx)("span",{className:"font-mono",children:e.vector_store_id})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Provider:"}),(0,t.jsx)("span",{className:"flex items-center",children:(()=>{let{logo:s,displayName:a}=(0,m.dr)(e.custom_llm_provider);return(0,t.jsxs)(t.Fragment,{children:[s&&(0,t.jsx)("img",{src:s,alt:"".concat(a," logo"),className:"h-5 w-5 mr-2"}),a]})})()})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Start Time:"}),(0,t.jsx)("span",{children:o(e.start_time)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"End Time:"}),(0,t.jsx)("span",{children:o(e.end_time)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Duration:"}),(0,t.jsx)("span",{children:d(e.start_time,e.end_time)})]})]})]})}),(0,t.jsx)("h4",{className:"font-medium mb-2",children:"Search Results"}),(0,t.jsx)("div",{className:"space-y-2",children:e.vector_store_search_response.data.map((e,a)=>{let l=r["".concat(s,"-").concat(a)]||!1;return(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center p-3 bg-gray-50 cursor-pointer",onClick:()=>c(s,a),children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(l?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsxs)("span",{className:"font-medium mr-2",children:["Result ",a+1]}),(0,t.jsxs)("span",{className:"text-gray-500 text-sm",children:["Score: ",(0,t.jsx)("span",{className:"font-mono",children:e.score.toFixed(4)})]})]})]}),l&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:e.content.map((e,s)=>(0,t.jsxs)("div",{className:"mb-2 last:mb-0",children:[(0,t.jsx)("div",{className:"text-xs text-gray-500 mb-1",children:e.type}),(0,t.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap break-all bg-gray-50 p-2 rounded",children:e.text})]},s))})]},a)})})]},s))})]})}let Y=e=>e>=.8?"text-green-600":"text-yellow-600";var K=e=>{let{entities:s}=e,[a,l]=(0,i.useState)(!0),[r,n]=(0,i.useState)({}),o=e=>{n(s=>({...s,[e]:!s[e]}))};return s&&0!==s.length?(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsxs)("div",{className:"flex items-center mb-2 cursor-pointer",onClick:()=>l(!a),children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(a?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsxs)("h4",{className:"font-medium",children:["Detected Entities (",s.length,")"]})]}),a&&(0,t.jsx)("div",{className:"space-y-2",children:s.map((e,s)=>{let a=r[s]||!1;return(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 cursor-pointer hover:bg-gray-100",onClick:()=>o(s),children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(a?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsx)("span",{className:"font-medium mr-2",children:e.entity_type}),(0,t.jsxs)("span",{className:"font-mono ".concat(Y(e.score)),children:["Score: ",e.score.toFixed(2)]})]}),(0,t.jsxs)("span",{className:"text-xs text-gray-500",children:["Position: ",e.start,"-",e.end]})]}),a&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-2",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Entity Type:"}),(0,t.jsx)("span",{children:e.entity_type})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Position:"}),(0,t.jsxs)("span",{children:["Characters ",e.start,"-",e.end]})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Confidence:"}),(0,t.jsx)("span",{className:Y(e.score),children:e.score.toFixed(2)})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[e.recognition_metadata&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Recognizer:"}),(0,t.jsx)("span",{children:e.recognition_metadata.recognizer_name})]}),(0,t.jsxs)("div",{className:"flex overflow-hidden",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Identifier:"}),(0,t.jsx)("span",{className:"truncate text-xs font-mono",children:e.recognition_metadata.recognizer_identifier})]})]}),e.analysis_explanation&&(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Explanation:"}),(0,t.jsx)("span",{children:e.analysis_explanation})]})]})]})})]},s)})})]}):null};let P=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"slate";return(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block ".concat({green:"bg-green-100 text-green-800",red:"bg-red-100 text-red-800",blue:"bg-blue-50 text-blue-700",slate:"bg-slate-100 text-slate-800",amber:"bg-amber-100 text-amber-800"}[s]),children:e})},Z=e=>e?P("detected","red"):P("not detected","slate"),U=e=>{let{title:s,count:a,defaultOpen:l=!0,right:r,children:n}=e,[o,d]=(0,i.useState)(l);return(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 cursor-pointer hover:bg-gray-100",onClick:()=>d(e=>!e),children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(o?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsxs)("h5",{className:"font-medium",children:[s," ","number"==typeof a&&(0,t.jsxs)("span",{className:"text-gray-500 font-normal",children:["(",a,")"]})]})]}),(0,t.jsx)("div",{children:r})]}),o&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:n})]})},V=e=>{let{label:s,children:a,mono:l}=e;return(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:s}),(0,t.jsx)("span",{className:l?"font-mono text-sm break-all":"",children:a})]})},B=()=>(0,t.jsx)("div",{className:"my-3 border-t"});var W=e=>{var s,a,l,r,n,i,o,d,c,m;let{response:u}=e;if(!u)return null;let x=null!==(n=null!==(r=u.outputs)&&void 0!==r?r:u.output)&&void 0!==n?n:[],h="GUARDRAIL_INTERVENED"===u.action?"red":"green",g=(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(null===(s=u.guardrailCoverage)||void 0===s?void 0:s.textCharacters)&&P("text guarded ".concat(null!==(i=u.guardrailCoverage.textCharacters.guarded)&&void 0!==i?i:0,"/").concat(null!==(o=u.guardrailCoverage.textCharacters.total)&&void 0!==o?o:0),"blue"),(null===(a=u.guardrailCoverage)||void 0===a?void 0:a.images)&&P("images guarded ".concat(null!==(d=u.guardrailCoverage.images.guarded)&&void 0!==d?d:0,"/").concat(null!==(c=u.guardrailCoverage.images.total)&&void 0!==c?c:0),"blue")]}),p=u.usage&&(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(u.usage).map(e=>{let[s,a]=e;return"number"==typeof a?(0,t.jsxs)("span",{className:"px-2 py-1 bg-slate-100 text-slate-800 rounded-md text-xs font-medium",children:[s,": ",a]},s):null})});return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"border rounded-lg p-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(V,{label:"Action:",children:P(null!==(m=u.action)&&void 0!==m?m:"N/A",h)}),u.actionReason&&(0,t.jsx)(V,{label:"Action Reason:",children:u.actionReason}),u.blockedResponse&&(0,t.jsx)(V,{label:"Blocked Response:",children:(0,t.jsx)("span",{className:"italic",children:u.blockedResponse})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(V,{label:"Coverage:",children:g}),(0,t.jsx)(V,{label:"Usage:",children:p})]})]}),x.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(B,{}),(0,t.jsx)("h4",{className:"font-medium mb-2",children:"Outputs"}),(0,t.jsx)("div",{className:"space-y-2",children:x.map((e,s)=>{var a;return(0,t.jsx)("div",{className:"p-3 bg-gray-50 rounded-md",children:(0,t.jsx)("div",{className:"text-sm whitespace-pre-wrap",children:null!==(a=e.text)&&void 0!==a?a:(0,t.jsx)("em",{children:"(non-text output)"})})},s)})})]})]}),(null===(l=u.assessments)||void 0===l?void 0:l.length)?(0,t.jsx)("div",{className:"space-y-3",children:u.assessments.map((e,s)=>{var a,l,r,n,i,o,d,c,m,u,x,h,g,p,f,j,v,b,y,N,w,k,_,S;let C=(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.wordPolicy&&P("word","slate"),e.contentPolicy&&P("content","slate"),e.topicPolicy&&P("topic","slate"),e.sensitiveInformationPolicy&&P("sensitive-info","slate"),e.contextualGroundingPolicy&&P("contextual-grounding","slate"),e.automatedReasoningPolicy&&P("automated-reasoning","slate")]});return(0,t.jsxs)(U,{title:"Assessment #".concat(s+1),defaultOpen:!0,right:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(null===(a=e.invocationMetrics)||void 0===a?void 0:a.guardrailProcessingLatency)!=null&&P("".concat(e.invocationMetrics.guardrailProcessingLatency," ms"),"amber"),C]}),children:[e.wordPolicy&&(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Word Policy"}),(null!==(j=null===(l=e.wordPolicy.customWords)||void 0===l?void 0:l.length)&&void 0!==j?j:0)>0&&(0,t.jsx)(U,{title:"Custom Words",defaultOpen:!0,children:(0,t.jsx)("div",{className:"space-y-2",children:e.wordPolicy.customWords.map((e,s)=>{var a;return(0,t.jsxs)("div",{className:"flex justify-between items-center p-2 bg-gray-50 rounded",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[P(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-mono text-sm break-all",children:e.match})]}),Z(e.detected)]},s)})})}),(null!==(v=null===(r=e.wordPolicy.managedWordLists)||void 0===r?void 0:r.length)&&void 0!==v?v:0)>0&&(0,t.jsx)(U,{title:"Managed Word Lists",defaultOpen:!1,children:(0,t.jsx)("div",{className:"space-y-2",children:e.wordPolicy.managedWordLists.map((e,s)=>{var a;return(0,t.jsxs)("div",{className:"flex justify-between items-center p-2 bg-gray-50 rounded",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[P(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-mono text-sm break-all",children:e.match}),e.type&&P(e.type,"slate")]}),Z(e.detected)]},s)})})})]}),(null===(i=e.contentPolicy)||void 0===i?void 0:null===(n=i.filters)||void 0===n?void 0:n.length)?(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Content Policy"}),(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"min-w-full text-sm",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"text-left text-gray-600",children:[(0,t.jsx)("th",{className:"py-1 pr-4",children:"Type"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Action"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Detected"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Strength"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Confidence"})]})}),(0,t.jsx)("tbody",{children:e.contentPolicy.filters.map((e,s)=>{var a,l,r,n;return(0,t.jsxs)("tr",{className:"border-t",children:[(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(a=e.type)&&void 0!==a?a:"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:P(null!==(l=e.action)&&void 0!==l?l:"—",e.detected?"red":"slate")}),(0,t.jsx)("td",{className:"py-1 pr-4",children:Z(e.detected)}),(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(r=e.filterStrength)&&void 0!==r?r:"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(n=e.confidence)&&void 0!==n?n:"—"})]},s)})})]})})]}):null,(null===(d=e.contextualGroundingPolicy)||void 0===d?void 0:null===(o=d.filters)||void 0===o?void 0:o.length)?(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Contextual Grounding"}),(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"min-w-full text-sm",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"text-left text-gray-600",children:[(0,t.jsx)("th",{className:"py-1 pr-4",children:"Type"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Action"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Detected"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Score"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Threshold"})]})}),(0,t.jsx)("tbody",{children:e.contextualGroundingPolicy.filters.map((e,s)=>{var a,l,r,n;return(0,t.jsxs)("tr",{className:"border-t",children:[(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(a=e.type)&&void 0!==a?a:"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:P(null!==(l=e.action)&&void 0!==l?l:"—",e.detected?"red":"slate")}),(0,t.jsx)("td",{className:"py-1 pr-4",children:Z(e.detected)}),(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(r=e.score)&&void 0!==r?r:"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(n=e.threshold)&&void 0!==n?n:"—"})]},s)})})]})})]}):null,e.sensitiveInformationPolicy&&(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Sensitive Information"}),(null!==(b=null===(c=e.sensitiveInformationPolicy.piiEntities)||void 0===c?void 0:c.length)&&void 0!==b?b:0)>0&&(0,t.jsx)(U,{title:"PII Entities",defaultOpen:!0,children:(0,t.jsx)("div",{className:"space-y-2",children:e.sensitiveInformationPolicy.piiEntities.map((e,s)=>{var a;return(0,t.jsxs)("div",{className:"flex justify-between items-center p-2 bg-gray-50 rounded",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[P(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),e.type&&P(e.type,"slate"),(0,t.jsx)("span",{className:"font-mono text-xs break-all",children:e.match})]}),Z(e.detected)]},s)})})}),(null!==(y=null===(m=e.sensitiveInformationPolicy.regexes)||void 0===m?void 0:m.length)&&void 0!==y?y:0)>0&&(0,t.jsx)(U,{title:"Custom Regexes",defaultOpen:!1,children:(0,t.jsx)("div",{className:"space-y-2",children:e.sensitiveInformationPolicy.regexes.map((e,s)=>{var a,l;return(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between p-2 bg-gray-50 rounded gap-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[P(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-medium",children:null!==(l=e.name)&&void 0!==l?l:"regex"}),(0,t.jsx)("span",{className:"font-mono text-xs break-all",children:e.regex})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[Z(e.detected),e.match&&(0,t.jsx)("span",{className:"font-mono text-xs break-all",children:e.match})]})]},s)})})})]}),(null===(x=e.topicPolicy)||void 0===x?void 0:null===(u=x.topics)||void 0===u?void 0:u.length)?(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Topic Policy"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:e.topicPolicy.topics.map((e,s)=>{var a,l;return(0,t.jsx)("div",{className:"px-3 py-1.5 bg-gray-50 rounded-md text-xs",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[P(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-medium",children:null!==(l=e.name)&&void 0!==l?l:"topic"}),e.type&&P(e.type,"slate"),Z(e.detected)]})},s)})})]}):null,e.invocationMetrics&&(0,t.jsx)(U,{title:"Invocation Metrics",defaultOpen:!1,children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(V,{label:"Latency (ms)",children:null!==(N=e.invocationMetrics.guardrailProcessingLatency)&&void 0!==N?N:"—"}),(0,t.jsx)(V,{label:"Coverage:",children:(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(null===(h=e.invocationMetrics.guardrailCoverage)||void 0===h?void 0:h.textCharacters)&&P("text ".concat(null!==(w=e.invocationMetrics.guardrailCoverage.textCharacters.guarded)&&void 0!==w?w:0,"/").concat(null!==(k=e.invocationMetrics.guardrailCoverage.textCharacters.total)&&void 0!==k?k:0),"blue"),(null===(g=e.invocationMetrics.guardrailCoverage)||void 0===g?void 0:g.images)&&P("images ".concat(null!==(_=e.invocationMetrics.guardrailCoverage.images.guarded)&&void 0!==_?_:0,"/").concat(null!==(S=e.invocationMetrics.guardrailCoverage.images.total)&&void 0!==S?S:0),"blue")]})})]}),(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsx)(V,{label:"Usage:",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:e.invocationMetrics.usage&&Object.entries(e.invocationMetrics.usage).map(e=>{let[s,a]=e;return"number"==typeof a?(0,t.jsxs)("span",{className:"px-2 py-1 bg-slate-100 text-slate-800 rounded-md text-xs font-medium",children:[s,": ",a]},s):null})})})})]})}),(null===(f=e.automatedReasoningPolicy)||void 0===f?void 0:null===(p=f.findings)||void 0===p?void 0:p.length)?(0,t.jsx)(U,{title:"Automated Reasoning Findings",defaultOpen:!1,children:(0,t.jsx)("div",{className:"space-y-2",children:e.automatedReasoningPolicy.findings.map((e,s)=>(0,t.jsx)("pre",{className:"bg-gray-50 rounded p-2 text-xs overflow-x-auto",children:JSON.stringify(e,null,2)},s))})}):null]},s)})}):null,(0,t.jsx)(U,{title:"Raw Bedrock Guardrail Response",defaultOpen:!1,children:(0,t.jsx)("pre",{className:"bg-gray-50 rounded p-3 text-xs overflow-x-auto",children:JSON.stringify(u,null,2)})})]})};let z=e=>new Date(1e3*e).toLocaleString(),J=e=>{var s,a;let{entry:l,index:r,total:n}=e,i=null!==(s=l.guardrail_provider)&&void 0!==s?s:"presidio",o=null!==(a=l.guardrail_status)&&void 0!==a?a:"unknown",d="success"===o.toLowerCase(),c=l.masked_entity_count||{},m=Object.values(c).reduce((e,s)=>e+("number"==typeof s?s:0),0),x=l.guardrail_response,h=Array.isArray(x)?x:[],g="bedrock"!==i||null===x||"object"!=typeof x||Array.isArray(x)?void 0:x;return(0,t.jsxs)("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:[n>1&&(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsxs)("h4",{className:"text-base font-semibold",children:["Guardrail #",r+1,(0,t.jsx)("span",{className:"ml-2 font-mono text-sm text-gray-600",children:l.guardrail_name})]}),(0,t.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-600 rounded-md text-xs capitalize",children:i})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Guardrail Name:"}),(0,t.jsx)("span",{className:"font-mono break-words",children:l.guardrail_name})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Mode:"}),(0,t.jsx)("span",{className:"font-mono break-words",children:l.guardrail_mode})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Status:"}),(0,t.jsx)(u.Z,{title:d?null:"Guardrail failed to run.",placement:"top",arrow:!0,destroyTooltipOnHide:!0,children:(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block ".concat(d?"bg-green-100 text-green-800":"bg-red-100 text-red-800 cursor-help"),children:o})})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Start Time:"}),(0,t.jsx)("span",{children:z(l.start_time)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"End Time:"}),(0,t.jsx)("span",{children:z(l.end_time)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Duration:"}),(0,t.jsxs)("span",{children:[l.duration.toFixed(4),"s"]})]})]})]}),m>0&&(0,t.jsxs)("div",{className:"mt-4 pt-4 border-t",children:[(0,t.jsx)("h5",{className:"font-medium mb-2",children:"Masked Entity Summary"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(c).map(e=>{let[s,a]=e;return(0,t.jsxs)("span",{className:"px-3 py-1.5 bg-blue-50 text-blue-700 rounded-md text-xs font-medium",children:[s,": ",a]},s)})})]}),"presidio"===i&&h.length>0&&(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(K,{entities:h})}),"bedrock"===i&&g&&(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(W,{response:g})})]})};var G=e=>{let{data:s}=e,a=Array.isArray(s)?s.filter(e=>!!e):s?[s]:[],[l,r]=(0,i.useState)(!0),n=1===a.length?a[0].guardrail_name:"".concat(a.length," guardrails"),o=Array.from(new Set(a.map(e=>e.guardrail_status))).every(e=>"success"===(null!=e?e:"").toLowerCase()),d=a.reduce((e,s)=>e+Object.values(s.masked_entity_count||{}).reduce((e,s)=>e+("number"==typeof s?s:0),0),0);return 0===a.length?null:(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow mb-6",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b cursor-pointer hover:bg-gray-50",onClick:()=>r(!l),children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("svg",{className:"w-5 h-5 text-gray-600 transition-transform ".concat(l?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Guardrail Information"}),(0,t.jsx)(u.Z,{title:o?null:"Guardrail failed to run.",placement:"top",arrow:!0,destroyTooltipOnHide:!0,children:(0,t.jsx)("span",{className:"ml-2 px-2 py-1 rounded-md text-xs font-medium inline-block ".concat(o?"bg-green-100 text-green-800":"bg-red-100 text-red-800 cursor-help"),children:o?"success":"failure"})}),(0,t.jsx)("span",{className:"ml-2 font-mono text-sm text-gray-600",children:n}),d>0&&(0,t.jsxs)("span",{className:"ml-2 px-2 py-1 bg-blue-50 text-blue-700 rounded-md text-xs font-medium",children:[d," masked ",1===d?"entity":"entities"]})]}),(0,t.jsx)("span",{className:"text-sm text-gray-500",children:l?"Click to collapse":"Click to expand"})]}),l&&(0,t.jsx)("div",{className:"p-4 space-y-6",children:a.map((e,s)=>{var l;return(0,t.jsx)(J,{entry:e,index:s,total:a.length},"".concat(null!==(l=e.guardrail_name)&&void 0!==l?l:"guardrail","-").concat(s))})})]})},Q=a(23048),$=a(30841),X=a(7310),ee=a.n(X),es=a(12363);let ea={TEAM_ID:"Team ID",KEY_HASH:"Key Hash",REQUEST_ID:"Request ID",MODEL:"Model",USER_ID:"User ID",END_USER:"End User",STATUS:"Status",KEY_ALIAS:"Key Alias"};var et=a(59341),el=a(12485),er=a(18135),en=a(35242),ei=a(29706),eo=a(77991),ed=a(92280);let ec="".concat("../ui/assets/","audit-logs-preview.png");function em(e){let{userID:s,userRole:a,token:l,accessToken:o,isActive:m,premiumUser:u,allTeams:x}=e,[h,g]=(0,i.useState)(r()().subtract(24,"hours").format("YYYY-MM-DDTHH:mm")),p=(0,i.useRef)(null),j=(0,i.useRef)(null),[v,b]=(0,i.useState)(1),[N]=(0,i.useState)(50),[w,k]=(0,i.useState)({}),[_,S]=(0,i.useState)(""),[C,L]=(0,i.useState)(""),[M,T]=(0,i.useState)(""),[E,D]=(0,i.useState)("all"),[A,I]=(0,i.useState)("all"),[R,O]=(0,i.useState)(!1),[H,q]=(0,i.useState)(!1),F=(0,n.a)({queryKey:["all_audit_logs",o,l,a,s,h],queryFn:async()=>{if(!o||!l||!a||!s)return[];let e=r()(h).utc().format("YYYY-MM-DD HH:mm:ss"),t=r()().utc().format("YYYY-MM-DD HH:mm:ss"),n=[],i=1,c=1;do{let s=await (0,d.uiAuditLogsCall)(o,e,t,i,50);n=n.concat(s.audit_logs),c=s.total_pages,i++}while(i<=c);return n},enabled:!!o&&!!l&&!!a&&!!s&&m,refetchInterval:5e3,refetchIntervalInBackground:!0}),Y=(0,i.useCallback)(async e=>{if(o)try{let s=(await (0,d.keyListCall)(o,null,null,e,null,null,1,10)).keys.find(s=>s.key_alias===e);s?L(s.token):L("")}catch(e){console.error("Error fetching key hash for alias:",e),L("")}},[o]);(0,i.useEffect)(()=>{if(!o)return;let e=!1,s=!1;w["Team ID"]?_!==w["Team ID"]&&(S(w["Team ID"]),e=!0):""!==_&&(S(""),e=!0),w["Key Hash"]?C!==w["Key Hash"]&&(L(w["Key Hash"]),s=!0):w["Key Alias"]?Y(w["Key Alias"]):""!==C&&(L(""),s=!0),(e||s)&&b(1)},[w,o,Y,_,C]),(0,i.useEffect)(()=>{b(1)},[_,C,h,M,E,A]),(0,i.useEffect)(()=>{function e(e){p.current&&!p.current.contains(e.target)&&O(!1),j.current&&!j.current.contains(e.target)&&q(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let K=(0,i.useMemo)(()=>F.data?F.data.filter(e=>{var s,a,t,l,r,n,i;let o=!0,d=!0,c=!0,m=!0,u=!0;if(_){let r="string"==typeof e.before_value?null===(s=JSON.parse(e.before_value))||void 0===s?void 0:s.team_id:null===(a=e.before_value)||void 0===a?void 0:a.team_id,n="string"==typeof e.updated_values?null===(t=JSON.parse(e.updated_values))||void 0===t?void 0:t.team_id:null===(l=e.updated_values)||void 0===l?void 0:l.team_id;o=r===_||n===_}if(C)try{let s="string"==typeof e.before_value?JSON.parse(e.before_value):e.before_value,a="string"==typeof e.updated_values?JSON.parse(e.updated_values):e.updated_values,t=null==s?void 0:s.token,l=null==a?void 0:a.token;d="string"==typeof t&&t.includes(C)||"string"==typeof l&&l.includes(C)}catch(e){d=!1}if(M&&(c=null===(r=e.object_id)||void 0===r?void 0:r.toLowerCase().includes(M.toLowerCase())),"all"!==E&&(m=(null===(n=e.action)||void 0===n?void 0:n.toLowerCase())===E.toLowerCase()),"all"!==A){let s="";switch(A){case"keys":s="litellm_verificationtoken";break;case"teams":s="litellm_teamtable";break;case"users":s="litellm_usertable";break;default:s=A}u=(null===(i=e.table_name)||void 0===i?void 0:i.toLowerCase())===s}return o&&d&&c&&m&&u}):[],[F.data,_,C,M,E,A]),P=K.length,Z=Math.ceil(P/N)||1,U=(0,i.useMemo)(()=>{let e=(v-1)*N,s=e+N;return K.slice(e,s)},[K,v,N]),V=!F.data||0===F.data.length,B=(0,i.useCallback)(e=>{let{row:s}=e;return(0,t.jsx)(e=>{let{rowData:s}=e,{before_value:a,updated_values:l,table_name:r,action:n}=s,i=(e,s)=>{if(!e||0===Object.keys(e).length)return(0,t.jsx)(ed.x,{children:"N/A"});if(s){let s=Object.keys(e),a=["token","spend","max_budget"];if(s.every(e=>a.includes(e))&&s.length>0)return(0,t.jsxs)("div",{children:[s.includes("token")&&(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Token:"})," ",e.token||"N/A"]}),s.includes("spend")&&(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Spend:"})," ",void 0!==e.spend?"$".concat((0,f.pw)(e.spend,6)):"N/A"]}),s.includes("max_budget")&&(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Max Budget:"})," ",void 0!==e.max_budget?"$".concat((0,f.pw)(e.max_budget,6)):"N/A"]})]});if(e["No differing fields detected in 'before' state"]||e["No differing fields detected in 'updated' state"]||e["No fields changed"])return(0,t.jsx)(ed.x,{children:e[Object.keys(e)[0]]})}return(0,t.jsx)("pre",{className:"p-2 bg-gray-50 border rounded text-xs overflow-auto max-h-60",children:JSON.stringify(e,null,2)})},o=a,d=l;if(("updated"===n||"rotated"===n)&&a&&l&&("LiteLLM_TeamTable"===r||"LiteLLM_UserTable"===r||"LiteLLM_VerificationToken"===r)){let e={},s={};new Set([...Object.keys(a),...Object.keys(l)]).forEach(t=>{JSON.stringify(a[t])!==JSON.stringify(l[t])&&(a.hasOwnProperty(t)&&(e[t]=a[t]),l.hasOwnProperty(t)&&(s[t]=l[t]))}),Object.keys(a).forEach(t=>{l.hasOwnProperty(t)||e.hasOwnProperty(t)||(e[t]=a[t],s[t]=void 0)}),Object.keys(l).forEach(t=>{a.hasOwnProperty(t)||s.hasOwnProperty(t)||(s[t]=l[t],e[t]=void 0)}),o=Object.keys(e).length>0?e:{"No differing fields detected in 'before' state":"N/A"},d=Object.keys(s).length>0?s:{"No differing fields detected in 'updated' state":"N/A"},0===Object.keys(e).length&&0===Object.keys(s).length&&(o={"No fields changed":"N/A"},d={"No fields changed":"N/A"})}return(0,t.jsxs)("div",{className:"-mx-4 p-4 bg-slate-100 border-y border-slate-300 grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"font-semibold mb-2 text-sm text-slate-700",children:"Before Value:"}),i(o,"LiteLLM_VerificationToken"===r)]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"font-semibold mb-2 text-sm text-slate-700",children:"Updated Value:"}),i(d,"LiteLLM_VerificationToken"===r)]})]})},{rowData:s.original})},[]);if(!u)return(0,t.jsxs)("div",{style:{textAlign:"center",marginTop:"20px"},children:[(0,t.jsx)("h1",{style:{display:"block",marginBottom:"10px"},children:"✨ Enterprise Feature."}),(0,t.jsx)(ed.x,{style:{display:"block",marginBottom:"10px"},children:"This is a LiteLLM Enterprise feature, and requires a valid key to use."}),(0,t.jsx)(ed.x,{style:{display:"block",marginBottom:"20px",fontStyle:"italic"},children:"Here's a preview of what Audit Logs offer:"}),(0,t.jsx)("img",{src:ec,alt:"Audit Logs Preview",style:{maxWidth:"100%",maxHeight:"700px",borderRadius:"8px",boxShadow:"0 4px 8px rgba(0,0,0,0.1)",margin:"0 auto"},onError:e=>{console.error("Failed to load audit logs preview image"),e.target.style.display="none"}})]});let W=P>0?(v-1)*N+1:0,z=Math.min(v*N,P);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-4"}),(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsxs)("div",{className:"border-b px-6 py-4",children:[(0,t.jsx)("h1",{className:"text-xl font-semibold py-4",children:"Audit Logs"}),(0,t.jsx)(e=>{let{show:s}=e;return s?(0,t.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4 flex items-start mb-6",children:[(0,t.jsx)("div",{className:"text-blue-500 mr-3 flex-shrink-0 mt-0.5",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,t.jsx)("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),(0,t.jsx)("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-blue-800",children:"Audit Logs Not Available"}),(0,t.jsx)("p",{className:"text-sm text-blue-700 mt-1",children:"To enable audit logging, add the following configuration to your LiteLLM proxy configuration file:"}),(0,t.jsx)("pre",{className:"mt-2 bg-white p-3 rounded border border-blue-200 text-xs font-mono overflow-auto",children:"litellm_settings:\n store_audit_logs: true"}),(0,t.jsx)("p",{className:"text-xs text-blue-700 mt-2",children:"Note: This will only affect new requests after the configuration change and proxy restart."})]})]}):null},{show:V}),(0,t.jsxs)("div",{className:"flex flex-col md:flex-row items-start md:items-center justify-between space-y-4 md:space-y-0",children:[(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"flex items-center",children:(0,t.jsx)("input",{type:"text",placeholder:"Search by Object ID...",value:M,onChange:e=>T(e.target.value),className:"px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})}),(0,t.jsxs)("button",{onClick:()=>{F.refetch()},className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",title:"Refresh data",children:[(0,t.jsx)("svg",{className:"w-4 h-4 ".concat(F.isFetching?"animate-spin":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),(0,t.jsx)("span",{children:"Refresh"})]})]})}),(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,t.jsxs)("div",{className:"relative",ref:p,children:[(0,t.jsx)("label",{htmlFor:"actionFilterDisplay",className:"mr-2 text-sm font-medium text-gray-700 sr-only",children:"Action:"}),(0,t.jsxs)("button",{id:"actionFilterDisplay",onClick:()=>O(!R),className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2 bg-white w-40 text-left justify-between",children:[(0,t.jsxs)("span",{children:["all"===E&&"All Actions","created"===E&&"Created","updated"===E&&"Updated","deleted"===E&&"Deleted","rotated"===E&&"Rotated"]}),(0,t.jsx)("svg",{className:"w-4 h-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M19 9l-7 7-7-7"})})]}),R&&(0,t.jsx)("div",{className:"absolute left-0 mt-2 w-40 bg-white rounded-lg shadow-lg border p-1 z-50",children:(0,t.jsx)("div",{className:"space-y-1",children:[{label:"All Actions",value:"all"},{label:"Created",value:"created"},{label:"Updated",value:"updated"},{label:"Deleted",value:"deleted"},{label:"Rotated",value:"rotated"}].map(e=>(0,t.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm hover:bg-gray-50 rounded-md ".concat(E===e.value?"bg-blue-50 text-blue-600 font-medium":"font-normal"),onClick:()=>{D(e.value),O(!1)},children:e.label},e.value))})})]}),(0,t.jsxs)("div",{className:"relative",ref:j,children:[(0,t.jsx)("label",{htmlFor:"tableFilterDisplay",className:"mr-2 text-sm font-medium text-gray-700 sr-only",children:"Table:"}),(0,t.jsxs)("button",{id:"tableFilterDisplay",onClick:()=>q(!H),className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2 bg-white w-40 text-left justify-between",children:[(0,t.jsxs)("span",{children:["all"===A&&"All Tables","keys"===A&&"Keys","teams"===A&&"Teams","users"===A&&"Users"]}),(0,t.jsx)("svg",{className:"w-4 h-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M19 9l-7 7-7-7"})})]}),H&&(0,t.jsx)("div",{className:"absolute left-0 mt-2 w-40 bg-white rounded-lg shadow-lg border p-1 z-50",children:(0,t.jsx)("div",{className:"space-y-1",children:[{label:"All Tables",value:"all"},{label:"Keys",value:"keys"},{label:"Teams",value:"teams"},{label:"Users",value:"users"}].map(e=>(0,t.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm hover:bg-gray-50 rounded-md ".concat(A===e.value?"bg-blue-50 text-blue-600 font-medium":"font-normal"),onClick:()=>{I(e.value),q(!1)},children:e.label},e.value))})})]}),(0,t.jsxs)("span",{className:"text-sm text-gray-700",children:["Showing ",F.isLoading?"...":W," -"," ",F.isLoading?"...":z," of"," ",F.isLoading?"...":P," results"]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsxs)("span",{className:"text-sm text-gray-700",children:["Page ",F.isLoading?"...":v," of"," ",F.isLoading?"...":Z]}),(0,t.jsx)("button",{onClick:()=>b(e=>Math.max(1,e-1)),disabled:F.isLoading||1===v,className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),(0,t.jsx)("button",{onClick:()=>b(e=>Math.min(Z,e+1)),disabled:F.isLoading||v===Z,className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]})]})]}),(0,t.jsx)(c.w,{columns:y,data:U,renderSubComponent:B,getRowCanExpand:()=>!0})]})]})}let eu=(e,s,a)=>{if(e)return"".concat(r()(s).format("MMM D, h:mm A")," - ").concat(r()(a).format("MMM D, h:mm A"));let t=r()(),l=r()(s),n=t.diff(l,"minutes");if(n>=0&&n<2)return"Last 1 Minute";if(n>=2&&n<16)return"Last 15 Minutes";if(n>=16&&n<61)return"Last Hour";let i=t.diff(l,"hours");return i>=1&&i<5?"Last 4 Hours":i>=5&&i<25?"Last 24 Hours":i>=25&&i<169?"Last 7 Days":"".concat(l.format("MMM D")," - ").concat(t.format("MMM D"))};var ex=a(9309);function eh(e){var s,a,l;let{accessToken:m,token:u,userRole:x,userID:h,allTeams:g,premiumUser:p}=e,[f,j]=(0,i.useState)(""),[b,y]=(0,i.useState)(!1),[w,k]=(0,i.useState)(!1),[_,S]=(0,i.useState)(1),[L]=(0,i.useState)(50),T=(0,i.useRef)(null),E=(0,i.useRef)(null),D=(0,i.useRef)(null),[A,I]=(0,i.useState)(r()().subtract(24,"hours").format("YYYY-MM-DDTHH:mm")),[R,O]=(0,i.useState)(r()().format("YYYY-MM-DDTHH:mm")),[H,F]=(0,i.useState)(!1),[Y,K]=(0,i.useState)(!1),[P,Z]=(0,i.useState)(""),[U,V]=(0,i.useState)(""),[B,W]=(0,i.useState)(""),[z,J]=(0,i.useState)(""),[G,X]=(0,i.useState)(""),[ed,ec]=(0,i.useState)(null),[ex,eh]=(0,i.useState)(null),[ep,ef]=(0,i.useState)(""),[ej,ev]=(0,i.useState)(""),[eb,ey]=(0,i.useState)(x&&C.lo.includes(x)),[eN,ew]=(0,i.useState)("request logs"),[ek,e_]=(0,i.useState)(null),[eS,eC]=(0,i.useState)(null),eL=(0,o.NL)(),[eM,eT]=(0,i.useState)(()=>{let e=sessionStorage.getItem("isLiveTail");return null===e||JSON.parse(e)});(0,i.useEffect)(()=>{sessionStorage.setItem("isLiveTail",JSON.stringify(eM))},[eM]);let[eE,eD]=(0,i.useState)({value:24,unit:"hours"});(0,i.useEffect)(()=>{(async()=>{ex&&m&&ec({...(await (0,d.keyInfoV1Call)(m,ex)).info,token:ex,api_key:ex})})()},[ex,m]),(0,i.useEffect)(()=>{function e(e){T.current&&!T.current.contains(e.target)&&k(!1),E.current&&!E.current.contains(e.target)&&y(!1),D.current&&!D.current.contains(e.target)&&K(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,i.useEffect)(()=>{x&&C.lo.includes(x)&&ey(!0)},[x]);let eA=(0,n.a)({queryKey:["logs","table",_,L,A,R,B,z,eb?h:null,ep,G],queryFn:async()=>{if(!m||!u||!x||!h)return{data:[],total:0,page:1,page_size:L,total_pages:0};let e=r()(A).utc().format("YYYY-MM-DD HH:mm:ss"),s=H?r()(R).utc().format("YYYY-MM-DD HH:mm:ss"):r()().utc().format("YYYY-MM-DD HH:mm:ss"),a=await (0,d.uiSpendLogsCall)(m,z||void 0,B||void 0,void 0,e,s,_,L,eb?h:void 0,ej,ep,G);return await N(a.data,e,m,eL),a.data=a.data.map(s=>{let a=eL.getQueryData(["logDetails",s.request_id,e]);return(null==a?void 0:a.messages)&&(null==a?void 0:a.response)&&(s.messages=a.messages,s.response=a.response),s}),a},enabled:!!m&&!!u&&!!x&&!!h&&"request logs"===eN,refetchInterval:!!eM&&1===_&&15e3,refetchIntervalInBackground:!0}),{filters:eI,filteredLogs:eR,allTeams:eO,allKeyAliases:eH,handleFilterChange:eq,handleFilterReset:eF}=function(e){let{logs:s,accessToken:a,startTime:t,endTime:l,pageSize:o=es.d,isCustomDate:c,setCurrentPage:m,userID:u,userRole:x}=e,h=(0,i.useMemo)(()=>({[ea.TEAM_ID]:"",[ea.KEY_HASH]:"",[ea.REQUEST_ID]:"",[ea.MODEL]:"",[ea.USER_ID]:"",[ea.END_USER]:"",[ea.STATUS]:"",[ea.KEY_ALIAS]:""}),[]),[g,p]=(0,i.useState)(h),[f,j]=(0,i.useState)({data:[],total:0,page:1,page_size:50,total_pages:0}),v=(0,i.useRef)(0),b=(0,i.useCallback)(async function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(!a)return;console.log("Filters being sent to API:",e);let n=Date.now();v.current=n;let i=r()(t).utc().format("YYYY-MM-DD HH:mm:ss"),m=c?r()(l).utc().format("YYYY-MM-DD HH:mm:ss"):r()().utc().format("YYYY-MM-DD HH:mm:ss");try{let t=await (0,d.uiSpendLogsCall)(a,e[ea.KEY_HASH]||void 0,e[ea.TEAM_ID]||void 0,e[ea.REQUEST_ID]||void 0,i,m,s,o,e[ea.USER_ID]||void 0,e[ea.END_USER]||void 0,e[ea.STATUS]||void 0,e[ea.MODEL]||void 0,e[ea.KEY_ALIAS]||void 0);n===v.current&&t.data&&j(t)}catch(e){console.error("Error searching users:",e)}},[a,t,l,c,o]),y=(0,i.useMemo)(()=>ee()((e,s)=>b(e,s),300),[b]);(0,i.useEffect)(()=>()=>y.cancel(),[y]);let N=(0,n.a)({queryKey:["allKeys"],queryFn:async()=>{if(!a)throw Error("Access token required");return await (0,$.LO)(a)},enabled:!!a}).data||[],w=(0,i.useMemo)(()=>!!(g[ea.KEY_ALIAS]||g[ea.KEY_HASH]||g[ea.REQUEST_ID]||g[ea.USER_ID]||g[ea.END_USER]),[g]),k=(0,i.useMemo)(()=>{if(!s||!s.data)return{data:[],total:0,page:1,page_size:50,total_pages:0};if(w)return s;let e=[...s.data];return g[ea.TEAM_ID]&&(e=e.filter(e=>e.team_id===g[ea.TEAM_ID])),g[ea.STATUS]&&(e=e.filter(e=>"success"===g[ea.STATUS]?!e.status||"success"===e.status:e.status===g[ea.STATUS])),g[ea.MODEL]&&(e=e.filter(e=>e.model===g[ea.MODEL])),g[ea.KEY_HASH]&&(e=e.filter(e=>e.api_key===g[ea.KEY_HASH])),g[ea.END_USER]&&(e=e.filter(e=>e.end_user===g[ea.END_USER])),{data:e,total:s.total,page:s.page,page_size:s.page_size,total_pages:s.total_pages}},[s,g,w]),_=(0,i.useMemo)(()=>w?f&&f.data&&f.data.length>0?f:s||{data:[],total:0,page:1,page_size:50,total_pages:0}:k,[w,f,k,s]),{data:S}=(0,n.a)({queryKey:["allTeamsForLogFilters",a],queryFn:async()=>a&&await (0,$.IE)(a)||[],enabled:!!a});return{filters:g,filteredLogs:_,allKeyAliases:N,allTeams:S,handleFilterChange:e=>{p(s=>{let a={...s,...e};for(let e of Object.keys(h))e in a||(a[e]=h[e]);return JSON.stringify(a)!==JSON.stringify(s)&&(m(1),y(a,1)),a})},handleFilterReset:()=>{p(h),j({data:[],total:0,page:1,page_size:50,total_pages:0}),y(h,1)}}}({logs:eA.data||{data:[],total:0,page:1,page_size:L||10,total_pages:1},accessToken:m,startTime:A,endTime:R,pageSize:L,isCustomDate:H,setCurrentPage:S,userID:h,userRole:x}),eY=(0,i.useCallback)(async e=>{if(m)try{let s=(await (0,d.keyListCall)(m,null,null,e,null,null,_,L)).keys.find(s=>s.key_alias===e);s&&J(s.token)}catch(e){console.error("Error fetching key hash for alias:",e)}},[m,_,L]);(0,i.useEffect)(()=>{m&&(eI["Team ID"]?W(eI["Team ID"]):W(""),ef(eI.Status||""),X(eI.Model||""),ev(eI["End User"]||""),eI["Key Hash"]?J(eI["Key Hash"]):eI["Key Alias"]?eY(eI["Key Alias"]):J(""))},[eI,m,eY]);let eK=(0,n.a)({queryKey:["sessionLogs",eS],queryFn:async()=>{if(!m||!eS)return{data:[],total:0,page:1,page_size:50,total_pages:1};let e=await (0,d.sessionSpendLogsCall)(m,eS);return{data:e.data||e||[],total:(e.data||e||[]).length,page:1,page_size:1e3,total_pages:1}},enabled:!!m&&!!eS});if((0,i.useEffect)(()=>{var e;(null===(e=eA.data)||void 0===e?void 0:e.data)&&ek&&!eA.data.data.some(e=>e.request_id===ek)&&e_(null)},[null===(s=eA.data)||void 0===s?void 0:s.data,ek]),!m||!u||!x||!h)return null;let eP=eR.data.filter(e=>!f||e.request_id.includes(f)||e.model.includes(f)||e.user&&e.user.includes(f)).map(e=>({...e,duration:(Date.parse(e.endTime)-Date.parse(e.startTime))/1e3,onKeyHashClick:e=>eh(e),onSessionClick:e=>{e&&eC(e)}}))||[],eZ=(null===(l=eK.data)||void 0===l?void 0:null===(a=l.data)||void 0===a?void 0:a.map(e=>({...e,onKeyHashClick:e=>eh(e),onSessionClick:e=>{}})))||[],eU=[{name:"Team ID",label:"Team ID",isSearchable:!0,searchFn:async e=>g&&0!==g.length?g.filter(s=>s.team_id.toLowerCase().includes(e.toLowerCase())||s.team_alias&&s.team_alias.toLowerCase().includes(e.toLowerCase())).map(e=>({label:"".concat(e.team_alias||e.team_id," (").concat(e.team_id,")"),value:e.team_id})):[]},{name:"Status",label:"Status",isSearchable:!1,options:[{label:"Success",value:"success"},{label:"Failure",value:"failure"}]},{name:"Model",label:"Model",isSearchable:!1},{name:"Key Alias",label:"Key Alias",isSearchable:!0,searchFn:async e=>m?(await (0,$.LO)(m)).filter(s=>s.toLowerCase().includes(e.toLowerCase())).map(e=>({label:e,value:e})):[]},{name:"End User",label:"End User",isSearchable:!0,searchFn:async e=>{if(!m)return[];let s=await (0,d.allEndUsersCall)(m);return((null==s?void 0:s.map(e=>e.user_id))||[]).filter(s=>s.toLowerCase().includes(e.toLowerCase())).map(e=>({label:e,value:e}))}},{name:"Key Hash",label:"Key Hash",isSearchable:!1}];if(eS&&eK.data)return(0,t.jsx)("div",{className:"w-full p-6",children:(0,t.jsx)(q,{sessionId:eS,logs:eK.data.data,onBack:()=>eC(null)})});let eV=[{label:"Last 15 Minutes",value:15,unit:"minutes"},{label:"Last Hour",value:1,unit:"hours"},{label:"Last 4 Hours",value:4,unit:"hours"},{label:"Last 24 Hours",value:24,unit:"hours"},{label:"Last 7 Days",value:7,unit:"days"}],eB=eV.find(e=>e.value===eE.value&&e.unit===eE.unit),eW=H?eu(H,A,R):null==eB?void 0:eB.label;return(0,t.jsx)("div",{className:"w-full max-w-screen p-6 overflow-x-hidden box-border",children:(0,t.jsxs)(er.Z,{defaultIndex:0,onIndexChange:e=>ew(0===e?"request logs":"audit logs"),children:[(0,t.jsxs)(en.Z,{children:[(0,t.jsx)(el.Z,{children:"Request Logs"}),(0,t.jsx)(el.Z,{children:"Audit Logs"})]}),(0,t.jsxs)(eo.Z,{children:[(0,t.jsxs)(ei.Z,{children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,t.jsx)("h1",{className:"text-xl font-semibold",children:eS?(0,t.jsxs)(t.Fragment,{children:["Session: ",(0,t.jsx)("span",{className:"font-mono",children:eS}),(0,t.jsx)("button",{className:"ml-4 px-3 py-1 text-sm border rounded hover:bg-gray-50",onClick:()=>eC(null),children:"← Back to All Logs"})]}):"Request Logs"})}),ed&&ex&&ed.api_key===ex?(0,t.jsx)(M.Z,{keyId:ex,keyData:ed,accessToken:m,userID:h,userRole:x,teams:g,onClose:()=>eh(null),premiumUser:p,backButtonText:"Back to Logs"}):eS?(0,t.jsx)("div",{className:"bg-white rounded-lg shadow",children:(0,t.jsx)(c.w,{columns:v,data:eZ,renderSubComponent:eg,getRowCanExpand:()=>!0})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Q.Z,{options:eU,onApplyFilters:eq,onResetFilters:eF}),(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full box-border",children:[(0,t.jsx)("div",{className:"border-b px-6 py-4 w-full max-w-full box-border",children:(0,t.jsxs)("div",{className:"flex flex-col md:flex-row items-start md:items-center justify-between space-y-4 md:space-y-0 w-full max-w-full box-border",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3 w-full max-w-full box-border",children:[(0,t.jsxs)("div",{className:"relative w-64 min-w-0 flex-shrink-0",children:[(0,t.jsx)("input",{type:"text",placeholder:"Search by Request ID",className:"w-full px-3 py-2 pl-8 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",value:f,onChange:e=>j(e.target.value)}),(0,t.jsx)("svg",{className:"absolute left-2.5 top-2.5 h-4 w-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-shrink",children:[(0,t.jsxs)("div",{className:"relative z-50",ref:D,children:[(0,t.jsxs)("button",{onClick:()=>K(!Y),className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",children:[(0,t.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),eW]}),Y&&(0,t.jsx)("div",{className:"absolute right-0 mt-2 w-64 bg-white rounded-lg shadow-lg border p-2 z-50",children:(0,t.jsxs)("div",{className:"space-y-1",children:[eV.map(e=>(0,t.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm hover:bg-gray-50 rounded-md ".concat(eW===e.label?"bg-blue-50 text-blue-600":""),onClick:()=>{O(r()().format("YYYY-MM-DDTHH:mm")),I(r()().subtract(e.value,e.unit).format("YYYY-MM-DDTHH:mm")),eD({value:e.value,unit:e.unit}),F(!1),K(!1)},children:e.label},e.label)),(0,t.jsx)("div",{className:"border-t my-2"}),(0,t.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm hover:bg-gray-50 rounded-md ".concat(H?"bg-blue-50 text-blue-600":""),onClick:()=>F(!H),children:"Custom Range"})]})})]}),(0,t.jsx)(()=>(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900",children:"Live Tail"}),(0,t.jsx)(et.Z,{color:"green",checked:eM,defaultChecked:!0,onChange:eT})]}),{}),(0,t.jsxs)("button",{onClick:()=>{eA.refetch()},className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",title:"Refresh data",children:[(0,t.jsx)("svg",{className:"w-4 h-4 ".concat(eA.isFetching?"animate-spin":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),(0,t.jsx)("span",{children:"Refresh"})]})]}),H&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{children:(0,t.jsx)("input",{type:"datetime-local",value:A,onChange:e=>{I(e.target.value),S(1)},className:"px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})}),(0,t.jsx)("span",{className:"text-gray-500",children:"to"}),(0,t.jsx)("div",{children:(0,t.jsx)("input",{type:"datetime-local",value:R,onChange:e=>{O(e.target.value),S(1)},className:"px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})})]})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,t.jsxs)("span",{className:"text-sm text-gray-700 whitespace-nowrap",children:["Showing ",eA.isLoading?"...":eR?(_-1)*L+1:0," -"," ",eA.isLoading?"...":eR?Math.min(_*L,eR.total):0," ","of ",eA.isLoading?"...":eR?eR.total:0," results"]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsxs)("span",{className:"text-sm text-gray-700 min-w-[90px]",children:["Page ",eA.isLoading?"...":_," of"," ",eA.isLoading?"...":eR?eR.total_pages:1]}),(0,t.jsx)("button",{onClick:()=>S(e=>Math.max(1,e-1)),disabled:eA.isLoading||1===_,className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),(0,t.jsx)("button",{onClick:()=>S(e=>Math.min(eR.total_pages||1,e+1)),disabled:eA.isLoading||_===(eR.total_pages||1),className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]})]})}),eM&&1===_&&(0,t.jsxs)("div",{className:"mb-4 px-4 py-2 bg-green-50 border border-greem-200 rounded-md flex items-center justify-between",children:[(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsx)("span",{className:"text-sm text-green-700",children:"Auto-refreshing every 15 seconds"})}),(0,t.jsx)("button",{onClick:()=>eT(!1),className:"text-sm text-green-600 hover:text-green-800",children:"Stop"})]}),(0,t.jsx)(c.w,{columns:v,data:eP,renderSubComponent:eg,getRowCanExpand:()=>!0})]})]})]}),(0,t.jsx)(ei.Z,{children:(0,t.jsx)(em,{userID:h,userRole:x,token:u,accessToken:m,isActive:"audit logs"===eN,premiumUser:p,allTeams:g})})]})]})})}function eg(e){var s,a,l,r,n,i,o,d,c,m;let{row:x}=e,h=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){}return e},g=x.original.metadata||{},p="failure"===g.status,j=p?g.error_information:null,v=x.original.messages&&(Array.isArray(x.original.messages)?x.original.messages.length>0:Object.keys(x.original.messages).length>0),b=x.original.response&&Object.keys(h(x.original.response)).length>0,y=g.vector_store_request_metadata&&Array.isArray(g.vector_store_request_metadata)&&g.vector_store_request_metadata.length>0,N=null===(s=x.original.metadata)||void 0===s?void 0:s.guardrail_information,w=Array.isArray(N)?N:N?[N]:[],k=w.length>0,C=w.reduce((e,s)=>{let a=null==s?void 0:s.masked_entity_count;return a?e+Object.values(a).reduce((e,s)=>"number"==typeof s?e+s:e,0):e},0),M=1===w.length?null!==(m=null===(a=w[0])||void 0===a?void 0:a.guardrail_name)&&void 0!==m?m:"-":w.length>1?"".concat(w.length," guardrails"):"-",T=(0,ex.aS)(x.original.request_id,64);return(0,t.jsxs)("div",{className:"p-6 bg-gray-50 space-y-6 w-full max-w-full overflow-hidden box-border",children:[(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden",children:[(0,t.jsx)("div",{className:"p-4 border-b",children:(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Request Details"})}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 p-4 w-full max-w-full overflow-hidden",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Request ID:"}),x.original.request_id.length>64?(0,t.jsx)(u.Z,{title:x.original.request_id,children:(0,t.jsx)("span",{className:"font-mono text-sm",children:T})}):(0,t.jsx)("span",{className:"font-mono text-sm",children:x.original.request_id})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Model:"}),(0,t.jsx)("span",{children:x.original.model})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Model ID:"}),(0,t.jsx)("span",{children:x.original.model_id})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Call Type:"}),(0,t.jsx)("span",{children:x.original.call_type})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Provider:"}),(0,t.jsx)("span",{children:x.original.custom_llm_provider||"-"})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"API Base:"}),(0,t.jsx)(u.Z,{title:x.original.api_base||"-",children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:x.original.api_base||"-"})})]}),(null==x?void 0:null===(l=x.original)||void 0===l?void 0:l.requester_ip_address)&&(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"IP Address:"}),(0,t.jsx)("span",{children:null==x?void 0:null===(r=x.original)||void 0===r?void 0:r.requester_ip_address})]}),k&&(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Guardrail:"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-mono",children:M}),C>0&&(0,t.jsxs)("span",{className:"ml-2 px-2 py-0.5 bg-blue-50 text-blue-700 rounded-md text-xs font-medium",children:[C," masked"]})]})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Tokens:"}),(0,t.jsxs)("span",{children:[x.original.total_tokens," (",x.original.prompt_tokens," prompt tokens +"," ",x.original.completion_tokens," completion tokens)"]})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Cache Read Tokens:"}),(0,t.jsx)("span",{children:(0,f.pw)((null===(i=x.original.metadata)||void 0===i?void 0:null===(n=i.additional_usage_values)||void 0===n?void 0:n.cache_read_input_tokens)||0)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Cache Creation Tokens:"}),(0,t.jsx)("span",{children:(0,f.pw)(null===(o=x.original.metadata)||void 0===o?void 0:o.additional_usage_values.cache_creation_input_tokens)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Cost:"}),(0,t.jsxs)("span",{children:["$",(0,f.pw)(x.original.spend||0,6)]})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Cache Hit:"}),(0,t.jsx)("span",{children:x.original.cache_hit})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Status:"}),(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block text-center w-16 ".concat("failure"!==((null===(d=x.original.metadata)||void 0===d?void 0:d.status)||"Success").toLowerCase()?"bg-green-100 text-green-800":"bg-red-100 text-red-800"),children:"failure"!==((null===(c=x.original.metadata)||void 0===c?void 0:c.status)||"Success").toLowerCase()?"Success":"Failure"})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Start Time:"}),(0,t.jsx)("span",{children:x.original.startTime})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"End Time:"}),(0,t.jsx)("span",{children:x.original.endTime})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Duration:"}),(0,t.jsxs)("span",{children:[x.original.duration," s."]})]})]})]})]}),(0,t.jsx)(L,{show:!v&&!b}),(0,t.jsx)("div",{className:"w-full max-w-full overflow-hidden",children:(0,t.jsx)(_,{row:x,hasMessages:v,hasResponse:b,hasError:p,errorInfo:j,getRawRequest:()=>{var e;return(null===(e=x.original)||void 0===e?void 0:e.proxy_server_request)?h(x.original.proxy_server_request):h(x.original.messages)},formattedResponse:()=>p&&j?{error:{message:j.error_message||"An error occurred",type:j.error_class||"error",code:j.error_code||"unknown",param:null}}:h(x.original.response)})}),k&&(0,t.jsx)(G,{data:N}),y&&(0,t.jsx)(F,{data:g.vector_store_request_metadata}),p&&j&&(0,t.jsx)(S,{errorInfo:j}),x.original.request_tags&&Object.keys(x.original.request_tags).length>0&&(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsx)("div",{className:"flex justify-between items-center p-4 border-b",children:(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Request Tags"})}),(0,t.jsx)("div",{className:"p-4",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(x.original.request_tags).map(e=>{let[s,a]=e;return(0,t.jsxs)("span",{className:"px-2 py-1 bg-gray-100 rounded-full text-xs",children:[s,": ",String(a)]},s)})})})]}),x.original.metadata&&Object.keys(x.original.metadata).length>0&&(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b",children:[(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Metadata"}),(0,t.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(JSON.stringify(x.original.metadata,null,2))},className:"p-1 hover:bg-gray-200 rounded",title:"Copy metadata",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]}),(0,t.jsx)("div",{className:"p-4 overflow-auto max-h-64",children:(0,t.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap break-all",children:JSON.stringify(x.original.metadata,null,2)})})]})]})}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3801],{12363:function(e,s,a){a.d(s,{d:function(){return r},n:function(){return l}});var t=a(2265);let l=()=>{let[e,s]=(0,t.useState)("http://localhost:4000");return(0,t.useEffect)(()=>{{let{protocol:e,host:a}=window.location;s("".concat(e,"//").concat(a))}},[]),e},r=25},30841:function(e,s,a){a.d(s,{IE:function(){return r},LO:function(){return l},cT:function(){return n}});var t=a(19250);let l=async e=>{if(!e)return[];try{let{aliases:s}=await (0,t.keyAliasesCall)(e);return Array.from(new Set((s||[]).filter(Boolean)))}catch(e){return console.error("Error fetching all key aliases:",e),[]}},r=async(e,s)=>{if(!e)return[];try{let a=[],l=1,r=!0;for(;r;){let n=await (0,t.teamListCall)(e,s||null,null);a=[...a,...n],l{if(!e)return[];try{let s=[],a=1,l=!0;for(;l;){let r=await (0,t.organizationListCall)(e);s=[...s,...r],a{let{options:s,onApplyFilters:a,onResetFilters:d,initialValues:m={},buttonLabel:u="Filters"}=e,[x,h]=(0,l.useState)(!1),[g,p]=(0,l.useState)(m),[f,j]=(0,l.useState)({}),[v,b]=(0,l.useState)({}),[y,N]=(0,l.useState)({}),[w,k]=(0,l.useState)({}),_=(0,l.useCallback)(c()(async(e,s)=>{if(s.isSearchable&&s.searchFn){b(e=>({...e,[s.name]:!0}));try{let a=await s.searchFn(e);j(e=>({...e,[s.name]:a}))}catch(e){console.error("Error searching:",e),j(e=>({...e,[s.name]:[]}))}finally{b(e=>({...e,[s.name]:!1}))}}},300),[]),S=(0,l.useCallback)(async e=>{if(e.isSearchable&&e.searchFn&&!w[e.name]){b(s=>({...s,[e.name]:!0})),k(s=>({...s,[e.name]:!0}));try{let s=await e.searchFn("");j(a=>({...a,[e.name]:s}))}catch(s){console.error("Error loading initial options:",s),j(s=>({...s,[e.name]:[]}))}finally{b(s=>({...s,[e.name]:!1}))}}},[w]);(0,l.useEffect)(()=>{x&&s.forEach(e=>{e.isSearchable&&!w[e.name]&&S(e)})},[x,s,S,w]);let C=(e,s)=>{let t={...g,[e]:s};p(t),a(t)},L=(e,s)=>{e&&s.isSearchable&&!w[s.name]&&S(s)};return(0,t.jsxs)("div",{className:"w-full",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[(0,t.jsx)(r.ZP,{icon:(0,t.jsx)(o.Z,{className:"h-4 w-4"}),onClick:()=>h(!x),className:"flex items-center gap-2",children:u}),(0,t.jsx)(r.ZP,{onClick:()=>{let e={};s.forEach(s=>{e[s.name]=""}),p(e),d()},children:"Reset Filters"})]}),x&&(0,t.jsx)("div",{className:"grid grid-cols-3 gap-x-6 gap-y-4 mb-6",children:["Team ID","Status","Organization ID","Key Alias","User ID","End User","Key Hash","Model"].map(e=>{let a=s.find(s=>s.label===e||s.name===e);return a?(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)("label",{className:"text-sm text-gray-600",children:a.label||a.name}),a.isSearchable?(0,t.jsx)(n.default,{showSearch:!0,className:"w-full",placeholder:"Search ".concat(a.label||a.name,"..."),value:g[a.name]||void 0,onChange:e=>C(a.name,e),onDropdownVisibleChange:e=>L(e,a),onSearch:e=>{N(s=>({...s,[a.name]:e})),a.searchFn&&_(e,a)},filterOption:!1,loading:v[a.name],options:f[a.name]||[],allowClear:!0,notFoundContent:v[a.name]?"Loading...":"No results found"}):a.options?(0,t.jsx)(n.default,{className:"w-full",placeholder:"Select ".concat(a.label||a.name,"..."),value:g[a.name]||void 0,onChange:e=>C(a.name,e),allowClear:!0,children:a.options.map(e=>(0,t.jsx)(n.default.Option,{value:e.value,children:e.label},e.value))}):(0,t.jsx)(i.default,{className:"w-full",placeholder:"Enter ".concat(a.label||a.name,"..."),value:g[a.name]||"",onChange:e=>C(a.name,e.target.value),allowClear:!0})]},a.name):null})})]})}},33801:function(e,s,a){a.d(s,{I:function(){return eg},Z:function(){return eh}});var t=a(57437),l=a(77398),r=a.n(l),n=a(11713),i=a(2265),o=a(29827),d=a(19250),c=a(12322),m=a(42673),u=a(99981);let x=e=>{try{return new Date(e).toLocaleString("en-US",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0}).replace(",","")}catch(e){return"Error converting time"}},h=e=>{let{utcTime:s}=e;return(0,t.jsx)("span",{style:{fontFamily:"monospace",width:"180px",display:"inline-block"},children:x(s)})};var g=a(41649),p=a(78489),f=a(59872);let j=(e,s)=>{var a,t;return(null===(t=e.metadata)||void 0===t?void 0:null===(a=t.mcp_tool_call_metadata)||void 0===a?void 0:a.mcp_server_logo_url)?e.metadata.mcp_tool_call_metadata.mcp_server_logo_url:s?(0,m.dr)(s).logo:""},v=[{id:"expander",header:()=>null,cell:e=>{let{row:s}=e;return(0,t.jsx)(()=>{let[e,a]=i.useState(s.getIsExpanded()),l=i.useCallback(()=>{a(e=>!e),s.getToggleExpandedHandler()()},[s]);return s.getCanExpand()?(0,t.jsx)("button",{onClick:l,style:{cursor:"pointer"},"aria-label":e?"Collapse row":"Expand row",className:"w-6 h-6 flex items-center justify-center focus:outline-none",children:(0,t.jsx)("svg",{className:"w-4 h-4 transform transition-transform duration-75 ".concat(e?"rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}):(0,t.jsx)("span",{className:"w-6 h-6 flex items-center justify-center",children:"ā—"})},{})}},{header:"Time",accessorKey:"startTime",cell:e=>(0,t.jsx)(h,{utcTime:e.getValue()})},{header:"Status",accessorKey:"metadata.status",cell:e=>{let s="failure"!==(e.getValue()||"Success").toLowerCase();return(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block text-center w-16 ".concat(s?"bg-green-100 text-green-800":"bg-red-100 text-red-800"),children:s?"Success":"Failure"})}},{header:"Session ID",accessorKey:"session_id",cell:e=>{let s=String(e.getValue()||""),a=e.row.original.onSessionClick;return(0,t.jsx)(u.Z,{title:String(e.getValue()||""),children:(0,t.jsx)(p.Z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal text-xs max-w-[15ch] truncate block",onClick:()=>null==a?void 0:a(s),children:String(e.getValue()||"")})})}},{header:"Request ID",accessorKey:"request_id",cell:e=>(0,t.jsx)(u.Z,{title:String(e.getValue()||""),children:(0,t.jsx)("span",{className:"font-mono text-xs max-w-[15ch] truncate block",children:String(e.getValue()||"")})})},{header:"Cost",accessorKey:"spend",cell:e=>(0,t.jsxs)("span",{children:["$",(0,f.pw)(e.getValue()||0,6)]})},{header:"Duration (s)",accessorKey:"duration",cell:e=>(0,t.jsx)(u.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"Team Name",accessorKey:"metadata.user_api_key_team_alias",cell:e=>(0,t.jsx)(u.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"Key Hash",accessorKey:"metadata.user_api_key",cell:e=>{let s=String(e.getValue()||"-"),a=e.row.original.onKeyHashClick;return(0,t.jsx)(u.Z,{title:s,children:(0,t.jsx)("span",{className:"font-mono max-w-[15ch] truncate block cursor-pointer hover:text-blue-600",onClick:()=>null==a?void 0:a(s),children:s})})}},{header:"Key Name",accessorKey:"metadata.user_api_key_alias",cell:e=>(0,t.jsx)(u.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"Model",accessorKey:"model",cell:e=>{let s=e.row.original,a=s.custom_llm_provider,l=String(e.getValue()||"");return(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[a&&(0,t.jsx)("img",{src:j(s,a),alt:"",className:"w-4 h-4",onError:e=>{e.target.style.display="none"}}),(0,t.jsx)(u.Z,{title:l,children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:l})})]})}},{header:"Tokens",accessorKey:"total_tokens",cell:e=>{let s=e.row.original;return(0,t.jsxs)("span",{className:"text-sm",children:[String(s.total_tokens||"0"),(0,t.jsxs)("span",{className:"text-gray-400 text-xs ml-1",children:["(",String(s.prompt_tokens||"0"),"+",String(s.completion_tokens||"0"),")"]})]})}},{header:"Internal User",accessorKey:"user",cell:e=>(0,t.jsx)(u.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"End User",accessorKey:"end_user",cell:e=>(0,t.jsx)(u.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"Tags",accessorKey:"request_tags",cell:e=>{let s=e.getValue();if(!s||0===Object.keys(s).length)return"-";let a=Object.entries(s),l=a[0],r=a.slice(1);return(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:(0,t.jsx)(u.Z,{title:(0,t.jsx)("div",{className:"flex flex-col gap-1",children:a.map(e=>{let[s,a]=e;return(0,t.jsxs)("span",{children:[s,": ",String(a)]},s)})}),children:(0,t.jsxs)("span",{className:"px-2 py-1 bg-gray-100 rounded-full text-xs",children:[l[0],": ",String(l[1]),r.length>0&&" +".concat(r.length)]})})})}}],b=e=>(0,t.jsx)(g.Z,{color:"gray",className:"flex items-center gap-1",children:(0,t.jsx)("span",{className:"whitespace-nowrap text-xs",children:e})}),y=[{id:"expander",header:()=>null,cell:e=>{let{row:s}=e;return(0,t.jsx)(()=>{let[e,a]=i.useState(s.getIsExpanded()),l=i.useCallback(()=>{a(e=>!e),s.getToggleExpandedHandler()()},[s]);return s.getCanExpand()?(0,t.jsx)("button",{onClick:l,style:{cursor:"pointer"},"aria-label":e?"Collapse row":"Expand row",className:"w-6 h-6 flex items-center justify-center focus:outline-none",children:(0,t.jsx)("svg",{className:"w-4 h-4 transform transition-transform ".concat(e?"rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}):(0,t.jsx)("span",{className:"w-6 h-6 flex items-center justify-center",children:"ā—"})},{})}},{header:"Timestamp",accessorKey:"updated_at",cell:e=>(0,t.jsx)(h,{utcTime:e.getValue()})},{header:"Table Name",accessorKey:"table_name",cell:e=>{let s=e.getValue(),a=s;switch(s){case"LiteLLM_VerificationToken":a="Keys";break;case"LiteLLM_TeamTable":a="Teams";break;case"LiteLLM_OrganizationTable":a="Organizations";break;case"LiteLLM_UserTable":a="Users";break;case"LiteLLM_ProxyModelTable":a="Models";break;default:a=s}return(0,t.jsx)("span",{children:a})}},{header:"Action",accessorKey:"action",cell:e=>(0,t.jsx)("span",{children:b(e.getValue())})},{header:"Changed By",accessorKey:"changed_by",cell:e=>{let s=e.row.original.changed_by,a=e.row.original.changed_by_api_key;return(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("div",{className:"font-medium",children:s}),a&&(0,t.jsx)(u.Z,{title:a,children:(0,t.jsxs)("div",{className:"text-xs text-muted-foreground max-w-[15ch] truncate",children:[" ",a]})})]})}},{header:"Affected Item ID",accessorKey:"object_id",cell:e=>(0,t.jsx)(()=>{let s=e.getValue(),[a,l]=(0,i.useState)(!1);if(!s)return(0,t.jsx)(t.Fragment,{children:"-"});let r=async()=>{try{await navigator.clipboard.writeText(String(s)),l(!0),setTimeout(()=>l(!1),1500)}catch(e){console.error("Failed to copy object ID: ",e)}};return(0,t.jsx)(u.Z,{title:a?"Copied!":String(s),children:(0,t.jsx)("span",{className:"max-w-[20ch] truncate block cursor-pointer hover:text-blue-600",onClick:r,children:String(s)})})},{})}],N=async(e,s,a,t)=>{console.log("prefetchLogDetails called with",e.length,"logs");let l=e.map(e=>{if(e.request_id)return console.log("Prefetching details for request_id:",e.request_id),t.prefetchQuery({queryKey:["logDetails",e.request_id,s],queryFn:async()=>{console.log("Fetching details for",e.request_id);let t=await (0,d.uiSpendLogDetailsCall)(a,e.request_id,s);return console.log("Received details for",e.request_id,":",t?"success":"failed"),t},staleTime:6e5,gcTime:6e5})});try{let e=await Promise.all(l);return console.log("All prefetch promises completed:",e.length),e}catch(e){throw console.error("Error in prefetchLogDetails:",e),e}};var w=a(9114),k=a(86669);function _(e){let{row:s,hasMessages:a,hasResponse:l,hasError:r,errorInfo:n,getRawRequest:i,formattedResponse:o}=e,d=async e=>{try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0;{let s=document.createElement("textarea");s.value=e,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.focus(),s.select();let a=document.execCommand("copy");if(document.body.removeChild(s),!a)throw Error("execCommand failed");return!0}}catch(e){return console.error("Copy failed:",e),!1}},c=async()=>{await d(JSON.stringify(i(),null,2))?w.Z.success("Request copied to clipboard"):w.Z.fromBackend("Failed to copy request")},m=async()=>{await d(JSON.stringify(o(),null,2))?w.Z.success("Response copied to clipboard"):w.Z.fromBackend("Failed to copy response")};return(0,t.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4 w-full max-w-full overflow-hidden box-border",children:[(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b",children:[(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Request"}),(0,t.jsx)("button",{onClick:c,className:"p-1 hover:bg-gray-200 rounded",title:"Copy request",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]}),(0,t.jsx)("div",{className:"p-4 overflow-auto max-h-96 w-full max-w-full box-border",children:(0,t.jsx)(k.gc,{data:i(),style:k.jF,clickToExpandNode:!0})})]}),(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b",children:[(0,t.jsxs)("h3",{className:"text-lg font-medium",children:["Response",r&&(0,t.jsxs)("span",{className:"ml-2 text-sm text-red-600",children:["• HTTP code ",(null==n?void 0:n.error_code)||400]})]}),(0,t.jsx)("button",{onClick:m,className:"p-1 hover:bg-gray-200 rounded",title:"Copy response",disabled:!l,children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]}),(0,t.jsx)("div",{className:"p-4 overflow-auto max-h-96 w-full max-w-full box-border",children:l?(0,t.jsx)(k.gc,{data:o(),style:k.jF,clickToExpandNode:!0}):(0,t.jsx)("div",{className:"text-gray-500 text-sm italic text-center py-4",children:"Response data not available"})})]})]})}a(52621);let S=e=>{var s;let{errorInfo:a}=e,[l,r]=i.useState({}),[n,o]=i.useState(!1),d=e=>{r(s=>({...s,[e]:!s[e]}))},c=a.traceback&&(s=a.traceback)?Array.from(s.matchAll(/File "([^"]+)", line (\d+)/g)).map(e=>{let a=e[1],t=e[2],l=a.split("/").pop()||a,r=e.index||0,n=s.indexOf('File "',r+1),i=n>-1?s.substring(r,n).trim():s.substring(r).trim(),o=i.split("\n"),d="";return o.length>1&&(d=o[o.length-1].trim()),{filePath:a,fileName:l,lineNumber:t,code:d,inFunction:i.includes(" in ")?i.split(" in ")[1].split("\n")[0]:""}}):[];return(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsx)("div",{className:"p-4 border-b",children:(0,t.jsxs)("h3",{className:"text-lg font-medium flex items-center text-red-600",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),"Error Details"]})}),(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsxs)("div",{className:"bg-red-50 rounded-md p-4 mb-4",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"text-red-800 font-medium w-20",children:"Type:"}),(0,t.jsx)("span",{className:"text-red-700",children:a.error_class||"Unknown Error"})]}),(0,t.jsxs)("div",{className:"flex mt-2",children:[(0,t.jsx)("span",{className:"text-red-800 font-medium w-20 flex-shrink-0",children:"Message:"}),(0,t.jsx)("span",{className:"text-red-700 break-words whitespace-pre-wrap",children:a.error_message||"Unknown error occurred"})]})]}),a.traceback&&(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-2",children:[(0,t.jsx)("h4",{className:"font-medium",children:"Traceback"}),(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,t.jsx)("button",{onClick:()=>{let e=!n;if(o(e),c.length>0){let s={};c.forEach((a,t)=>{s[t]=e}),r(s)}},className:"text-gray-500 hover:text-gray-700 flex items-center text-sm",children:n?"Collapse All":"Expand All"}),(0,t.jsxs)("button",{onClick:()=>navigator.clipboard.writeText(a.traceback||""),className:"text-gray-500 hover:text-gray-700 flex items-center",title:"Copy traceback",children:[(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),(0,t.jsx)("span",{className:"ml-1",children:"Copy"})]})]})]}),(0,t.jsx)("div",{className:"bg-white rounded-md border border-gray-200 overflow-hidden shadow-sm",children:c.map((e,s)=>(0,t.jsxs)("div",{className:"border-b border-gray-200 last:border-b-0",children:[(0,t.jsxs)("div",{className:"px-4 py-2 flex items-center justify-between cursor-pointer hover:bg-gray-50",onClick:()=>d(s),children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("span",{className:"text-gray-400 mr-2 w-12 text-right",children:e.lineNumber}),(0,t.jsx)("span",{className:"text-gray-600 font-medium",children:e.fileName}),(0,t.jsx)("span",{className:"text-gray-500 mx-1",children:"in"}),(0,t.jsx)("span",{className:"text-indigo-600 font-medium",children:e.inFunction||e.fileName})]}),(0,t.jsx)("svg",{className:"w-5 h-5 text-gray-500 transition-transform ".concat(l[s]?"transform rotate-180":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),(l[s]||!1)&&e.code&&(0,t.jsx)("div",{className:"px-12 py-2 font-mono text-sm text-gray-800 bg-gray-50 overflow-x-auto border-t border-gray-100",children:e.code})]},s))})]})]})]})};var C=a(20347);let L=e=>{let{show:s}=e;return s?(0,t.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4 flex items-start",children:[(0,t.jsx)("div",{className:"text-blue-500 mr-3 flex-shrink-0 mt-0.5",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,t.jsx)("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),(0,t.jsx)("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-blue-800",children:"Request/Response Data Not Available"}),(0,t.jsxs)("p",{className:"text-sm text-blue-700 mt-1",children:["To view request and response details, enable prompt storage in your LiteLLM configuration by adding the following to your ",(0,t.jsx)("code",{className:"bg-blue-100 px-1 py-0.5 rounded",children:"proxy_config.yaml"})," file:"]}),(0,t.jsx)("pre",{className:"mt-2 bg-white p-3 rounded border border-blue-200 text-xs font-mono overflow-auto",children:"general_settings:\n store_model_in_db: true\n store_prompts_in_spend_logs: true"}),(0,t.jsx)("p",{className:"text-xs text-blue-700 mt-2",children:"Note: This will only affect new requests after the configuration change."})]})]}):null};var M=a(94292),T=a(12514),E=a(35829),D=a(84264),A=a(96761),I=a(77331),R=a(5545),O=a(30401),H=a(78867);let q=e=>{let{sessionId:s,logs:a,onBack:l}=e,[r,n]=(0,i.useState)(null),[o,d]=(0,i.useState)({}),m=a.reduce((e,s)=>e+(s.spend||0),0),x=a.reduce((e,s)=>e+(s.total_tokens||0),0),h=a.reduce((e,s)=>{var a,t;return e+((null===(t=s.metadata)||void 0===t?void 0:null===(a=t.additional_usage_values)||void 0===a?void 0:a.cache_read_input_tokens)||0)},0),g=a.reduce((e,s)=>{var a,t;return e+((null===(t=s.metadata)||void 0===t?void 0:null===(a=t.additional_usage_values)||void 0===a?void 0:a.cache_creation_input_tokens)||0)},0),j=x+h+g,b=a.length>0?new Date(a[0].startTime):new Date;(((a.length>0?new Date(a[a.length-1].endTime):new Date).getTime()-b.getTime())/1e3).toFixed(2),a.map(e=>({time:new Date(e.startTime).toISOString(),tokens:e.total_tokens||0,cost:e.spend||0}));let y=async(e,s)=>{await (0,f.vQ)(e)&&(d(e=>({...e,[s]:!0})),setTimeout(()=>{d(e=>({...e,[s]:!1}))},2e3))};return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"mb-8",children:[(0,t.jsx)(p.Z,{icon:I.Z,variant:"light",onClick:l,className:"mb-4",children:"Back to All Logs"}),(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsx)("h1",{className:"text-2xl font-semibold text-gray-900",children:"Session Details"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)("p",{className:"text-sm text-gray-500 font-mono",children:s}),(0,t.jsx)(R.ZP,{type:"text",size:"small",icon:o["session-id"]?(0,t.jsx)(O.Z,{size:12}):(0,t.jsx)(H.Z,{size:12}),onClick:()=>y(s,"session-id"),className:"left-2 z-10 transition-all duration-200 ".concat(o["session-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]}),(0,t.jsxs)("a",{href:"https://docs.litellm.ai/docs/proxy/ui_logs_sessions",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-blue-600 hover:text-blue-800 flex items-center gap-1",children:["Get started with session management here",(0,t.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[(0,t.jsxs)(T.Z,{children:[(0,t.jsx)(D.Z,{children:"Total Requests"}),(0,t.jsx)(E.Z,{children:a.length})]}),(0,t.jsxs)(T.Z,{children:[(0,t.jsx)(D.Z,{children:"Total Cost"}),(0,t.jsxs)(E.Z,{children:["$",(0,f.pw)(m,6)]})]}),(0,t.jsx)(u.Z,{title:(0,t.jsxs)("div",{className:"text-white min-w-[200px]",children:[(0,t.jsx)("div",{className:"text-lg font-medium mb-3",children:"Usage breakdown"}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-base font-medium mb-2",children:"Input usage:"}),(0,t.jsxs)("div",{className:"space-y-2 text-sm text-gray-300",children:[(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"input:"}),(0,t.jsx)("span",{className:"ml-8",children:(0,f.pw)(a.reduce((e,s)=>e+(s.prompt_tokens||0),0))})]}),h>0&&(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"input_cached_tokens:"}),(0,t.jsx)("span",{className:"ml-8",children:(0,f.pw)(h)})]}),g>0&&(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"input_cache_creation_tokens:"}),(0,t.jsx)("span",{className:"ml-8",children:(0,f.pw)(g)})]})]})]}),(0,t.jsxs)("div",{className:"border-t border-gray-600 pt-3",children:[(0,t.jsx)("div",{className:"text-base font-medium mb-2",children:"Output usage:"}),(0,t.jsx)("div",{className:"space-y-2 text-sm text-gray-300",children:(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"output:"}),(0,t.jsx)("span",{className:"ml-8",children:(0,f.pw)(a.reduce((e,s)=>e+(s.completion_tokens||0),0))})]})})]}),(0,t.jsx)("div",{className:"border-t border-gray-600 pt-3",children:(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-base font-medium",children:"Total usage:"}),(0,t.jsx)("span",{className:"text-sm text-gray-300",children:(0,f.pw)(j)})]})})]})]}),placement:"top",overlayStyle:{minWidth:"300px"},children:(0,t.jsxs)(T.Z,{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(D.Z,{children:"Total Tokens"}),(0,t.jsx)("span",{className:"text-gray-400 text-sm",children:"ā“˜"})]}),(0,t.jsx)(E.Z,{children:(0,f.pw)(j)})]})})]}),(0,t.jsx)(A.Z,{children:"Session Logs"}),(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(c.w,{columns:v,data:a,renderSubComponent:eg,getRowCanExpand:()=>!0,loadingMessage:"Loading logs...",noDataMessage:"No logs found"})})]})};function F(e){let{data:s}=e,[a,l]=(0,i.useState)(!0),[r,n]=(0,i.useState)({});if(!s||0===s.length)return null;let o=e=>new Date(1e3*e).toLocaleString(),d=(e,s)=>"".concat(((s-e)*1e3).toFixed(2),"ms"),c=(e,s)=>{let a="".concat(e,"-").concat(s);n(e=>({...e,[a]:!e[a]}))};return(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow mb-6",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b cursor-pointer hover:bg-gray-50",onClick:()=>l(!a),children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 text-gray-600 transition-transform ".concat(a?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Vector Store Requests"})]}),(0,t.jsx)("span",{className:"text-sm text-gray-500",children:a?"Click to collapse":"Click to expand"})]}),a&&(0,t.jsx)("div",{className:"p-4",children:s.map((e,s)=>(0,t.jsxs)("div",{className:"mb-6 last:mb-0",children:[(0,t.jsx)("div",{className:"bg-white rounded-lg border p-4 mb-4",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Query:"}),(0,t.jsx)("span",{className:"font-mono",children:e.query})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Vector Store ID:"}),(0,t.jsx)("span",{className:"font-mono",children:e.vector_store_id})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Provider:"}),(0,t.jsx)("span",{className:"flex items-center",children:(()=>{let{logo:s,displayName:a}=(0,m.dr)(e.custom_llm_provider);return(0,t.jsxs)(t.Fragment,{children:[s&&(0,t.jsx)("img",{src:s,alt:"".concat(a," logo"),className:"h-5 w-5 mr-2"}),a]})})()})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Start Time:"}),(0,t.jsx)("span",{children:o(e.start_time)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"End Time:"}),(0,t.jsx)("span",{children:o(e.end_time)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Duration:"}),(0,t.jsx)("span",{children:d(e.start_time,e.end_time)})]})]})]})}),(0,t.jsx)("h4",{className:"font-medium mb-2",children:"Search Results"}),(0,t.jsx)("div",{className:"space-y-2",children:e.vector_store_search_response.data.map((e,a)=>{let l=r["".concat(s,"-").concat(a)]||!1;return(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center p-3 bg-gray-50 cursor-pointer",onClick:()=>c(s,a),children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(l?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsxs)("span",{className:"font-medium mr-2",children:["Result ",a+1]}),(0,t.jsxs)("span",{className:"text-gray-500 text-sm",children:["Score: ",(0,t.jsx)("span",{className:"font-mono",children:e.score.toFixed(4)})]})]})]}),l&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:e.content.map((e,s)=>(0,t.jsxs)("div",{className:"mb-2 last:mb-0",children:[(0,t.jsx)("div",{className:"text-xs text-gray-500 mb-1",children:e.type}),(0,t.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap break-all bg-gray-50 p-2 rounded",children:e.text})]},s))})]},a)})})]},s))})]})}let Y=e=>e>=.8?"text-green-600":"text-yellow-600";var K=e=>{let{entities:s}=e,[a,l]=(0,i.useState)(!0),[r,n]=(0,i.useState)({}),o=e=>{n(s=>({...s,[e]:!s[e]}))};return s&&0!==s.length?(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsxs)("div",{className:"flex items-center mb-2 cursor-pointer",onClick:()=>l(!a),children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(a?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsxs)("h4",{className:"font-medium",children:["Detected Entities (",s.length,")"]})]}),a&&(0,t.jsx)("div",{className:"space-y-2",children:s.map((e,s)=>{let a=r[s]||!1;return(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 cursor-pointer hover:bg-gray-100",onClick:()=>o(s),children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(a?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsx)("span",{className:"font-medium mr-2",children:e.entity_type}),(0,t.jsxs)("span",{className:"font-mono ".concat(Y(e.score)),children:["Score: ",e.score.toFixed(2)]})]}),(0,t.jsxs)("span",{className:"text-xs text-gray-500",children:["Position: ",e.start,"-",e.end]})]}),a&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-2",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Entity Type:"}),(0,t.jsx)("span",{children:e.entity_type})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Position:"}),(0,t.jsxs)("span",{children:["Characters ",e.start,"-",e.end]})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Confidence:"}),(0,t.jsx)("span",{className:Y(e.score),children:e.score.toFixed(2)})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[e.recognition_metadata&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Recognizer:"}),(0,t.jsx)("span",{children:e.recognition_metadata.recognizer_name})]}),(0,t.jsxs)("div",{className:"flex overflow-hidden",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Identifier:"}),(0,t.jsx)("span",{className:"truncate text-xs font-mono",children:e.recognition_metadata.recognizer_identifier})]})]}),e.analysis_explanation&&(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Explanation:"}),(0,t.jsx)("span",{children:e.analysis_explanation})]})]})]})})]},s)})})]}):null};let P=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"slate";return(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block ".concat({green:"bg-green-100 text-green-800",red:"bg-red-100 text-red-800",blue:"bg-blue-50 text-blue-700",slate:"bg-slate-100 text-slate-800",amber:"bg-amber-100 text-amber-800"}[s]),children:e})},Z=e=>e?P("detected","red"):P("not detected","slate"),U=e=>{let{title:s,count:a,defaultOpen:l=!0,right:r,children:n}=e,[o,d]=(0,i.useState)(l);return(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 cursor-pointer hover:bg-gray-100",onClick:()=>d(e=>!e),children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(o?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsxs)("h5",{className:"font-medium",children:[s," ","number"==typeof a&&(0,t.jsxs)("span",{className:"text-gray-500 font-normal",children:["(",a,")"]})]})]}),(0,t.jsx)("div",{children:r})]}),o&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:n})]})},V=e=>{let{label:s,children:a,mono:l}=e;return(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:s}),(0,t.jsx)("span",{className:l?"font-mono text-sm break-all":"",children:a})]})},B=()=>(0,t.jsx)("div",{className:"my-3 border-t"});var W=e=>{var s,a,l,r,n,i,o,d,c,m;let{response:u}=e;if(!u)return null;let x=null!==(n=null!==(r=u.outputs)&&void 0!==r?r:u.output)&&void 0!==n?n:[],h="GUARDRAIL_INTERVENED"===u.action?"red":"green",g=(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(null===(s=u.guardrailCoverage)||void 0===s?void 0:s.textCharacters)&&P("text guarded ".concat(null!==(i=u.guardrailCoverage.textCharacters.guarded)&&void 0!==i?i:0,"/").concat(null!==(o=u.guardrailCoverage.textCharacters.total)&&void 0!==o?o:0),"blue"),(null===(a=u.guardrailCoverage)||void 0===a?void 0:a.images)&&P("images guarded ".concat(null!==(d=u.guardrailCoverage.images.guarded)&&void 0!==d?d:0,"/").concat(null!==(c=u.guardrailCoverage.images.total)&&void 0!==c?c:0),"blue")]}),p=u.usage&&(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(u.usage).map(e=>{let[s,a]=e;return"number"==typeof a?(0,t.jsxs)("span",{className:"px-2 py-1 bg-slate-100 text-slate-800 rounded-md text-xs font-medium",children:[s,": ",a]},s):null})});return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"border rounded-lg p-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(V,{label:"Action:",children:P(null!==(m=u.action)&&void 0!==m?m:"N/A",h)}),u.actionReason&&(0,t.jsx)(V,{label:"Action Reason:",children:u.actionReason}),u.blockedResponse&&(0,t.jsx)(V,{label:"Blocked Response:",children:(0,t.jsx)("span",{className:"italic",children:u.blockedResponse})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(V,{label:"Coverage:",children:g}),(0,t.jsx)(V,{label:"Usage:",children:p})]})]}),x.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(B,{}),(0,t.jsx)("h4",{className:"font-medium mb-2",children:"Outputs"}),(0,t.jsx)("div",{className:"space-y-2",children:x.map((e,s)=>{var a;return(0,t.jsx)("div",{className:"p-3 bg-gray-50 rounded-md",children:(0,t.jsx)("div",{className:"text-sm whitespace-pre-wrap",children:null!==(a=e.text)&&void 0!==a?a:(0,t.jsx)("em",{children:"(non-text output)"})})},s)})})]})]}),(null===(l=u.assessments)||void 0===l?void 0:l.length)?(0,t.jsx)("div",{className:"space-y-3",children:u.assessments.map((e,s)=>{var a,l,r,n,i,o,d,c,m,u,x,h,g,p,f,j,v,b,y,N,w,k,_,S;let C=(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.wordPolicy&&P("word","slate"),e.contentPolicy&&P("content","slate"),e.topicPolicy&&P("topic","slate"),e.sensitiveInformationPolicy&&P("sensitive-info","slate"),e.contextualGroundingPolicy&&P("contextual-grounding","slate"),e.automatedReasoningPolicy&&P("automated-reasoning","slate")]});return(0,t.jsxs)(U,{title:"Assessment #".concat(s+1),defaultOpen:!0,right:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(null===(a=e.invocationMetrics)||void 0===a?void 0:a.guardrailProcessingLatency)!=null&&P("".concat(e.invocationMetrics.guardrailProcessingLatency," ms"),"amber"),C]}),children:[e.wordPolicy&&(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Word Policy"}),(null!==(j=null===(l=e.wordPolicy.customWords)||void 0===l?void 0:l.length)&&void 0!==j?j:0)>0&&(0,t.jsx)(U,{title:"Custom Words",defaultOpen:!0,children:(0,t.jsx)("div",{className:"space-y-2",children:e.wordPolicy.customWords.map((e,s)=>{var a;return(0,t.jsxs)("div",{className:"flex justify-between items-center p-2 bg-gray-50 rounded",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[P(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-mono text-sm break-all",children:e.match})]}),Z(e.detected)]},s)})})}),(null!==(v=null===(r=e.wordPolicy.managedWordLists)||void 0===r?void 0:r.length)&&void 0!==v?v:0)>0&&(0,t.jsx)(U,{title:"Managed Word Lists",defaultOpen:!1,children:(0,t.jsx)("div",{className:"space-y-2",children:e.wordPolicy.managedWordLists.map((e,s)=>{var a;return(0,t.jsxs)("div",{className:"flex justify-between items-center p-2 bg-gray-50 rounded",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[P(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-mono text-sm break-all",children:e.match}),e.type&&P(e.type,"slate")]}),Z(e.detected)]},s)})})})]}),(null===(i=e.contentPolicy)||void 0===i?void 0:null===(n=i.filters)||void 0===n?void 0:n.length)?(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Content Policy"}),(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"min-w-full text-sm",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"text-left text-gray-600",children:[(0,t.jsx)("th",{className:"py-1 pr-4",children:"Type"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Action"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Detected"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Strength"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Confidence"})]})}),(0,t.jsx)("tbody",{children:e.contentPolicy.filters.map((e,s)=>{var a,l,r,n;return(0,t.jsxs)("tr",{className:"border-t",children:[(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(a=e.type)&&void 0!==a?a:"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:P(null!==(l=e.action)&&void 0!==l?l:"—",e.detected?"red":"slate")}),(0,t.jsx)("td",{className:"py-1 pr-4",children:Z(e.detected)}),(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(r=e.filterStrength)&&void 0!==r?r:"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(n=e.confidence)&&void 0!==n?n:"—"})]},s)})})]})})]}):null,(null===(d=e.contextualGroundingPolicy)||void 0===d?void 0:null===(o=d.filters)||void 0===o?void 0:o.length)?(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Contextual Grounding"}),(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"min-w-full text-sm",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"text-left text-gray-600",children:[(0,t.jsx)("th",{className:"py-1 pr-4",children:"Type"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Action"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Detected"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Score"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Threshold"})]})}),(0,t.jsx)("tbody",{children:e.contextualGroundingPolicy.filters.map((e,s)=>{var a,l,r,n;return(0,t.jsxs)("tr",{className:"border-t",children:[(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(a=e.type)&&void 0!==a?a:"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:P(null!==(l=e.action)&&void 0!==l?l:"—",e.detected?"red":"slate")}),(0,t.jsx)("td",{className:"py-1 pr-4",children:Z(e.detected)}),(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(r=e.score)&&void 0!==r?r:"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(n=e.threshold)&&void 0!==n?n:"—"})]},s)})})]})})]}):null,e.sensitiveInformationPolicy&&(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Sensitive Information"}),(null!==(b=null===(c=e.sensitiveInformationPolicy.piiEntities)||void 0===c?void 0:c.length)&&void 0!==b?b:0)>0&&(0,t.jsx)(U,{title:"PII Entities",defaultOpen:!0,children:(0,t.jsx)("div",{className:"space-y-2",children:e.sensitiveInformationPolicy.piiEntities.map((e,s)=>{var a;return(0,t.jsxs)("div",{className:"flex justify-between items-center p-2 bg-gray-50 rounded",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[P(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),e.type&&P(e.type,"slate"),(0,t.jsx)("span",{className:"font-mono text-xs break-all",children:e.match})]}),Z(e.detected)]},s)})})}),(null!==(y=null===(m=e.sensitiveInformationPolicy.regexes)||void 0===m?void 0:m.length)&&void 0!==y?y:0)>0&&(0,t.jsx)(U,{title:"Custom Regexes",defaultOpen:!1,children:(0,t.jsx)("div",{className:"space-y-2",children:e.sensitiveInformationPolicy.regexes.map((e,s)=>{var a,l;return(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between p-2 bg-gray-50 rounded gap-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[P(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-medium",children:null!==(l=e.name)&&void 0!==l?l:"regex"}),(0,t.jsx)("span",{className:"font-mono text-xs break-all",children:e.regex})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[Z(e.detected),e.match&&(0,t.jsx)("span",{className:"font-mono text-xs break-all",children:e.match})]})]},s)})})})]}),(null===(x=e.topicPolicy)||void 0===x?void 0:null===(u=x.topics)||void 0===u?void 0:u.length)?(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Topic Policy"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:e.topicPolicy.topics.map((e,s)=>{var a,l;return(0,t.jsx)("div",{className:"px-3 py-1.5 bg-gray-50 rounded-md text-xs",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[P(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-medium",children:null!==(l=e.name)&&void 0!==l?l:"topic"}),e.type&&P(e.type,"slate"),Z(e.detected)]})},s)})})]}):null,e.invocationMetrics&&(0,t.jsx)(U,{title:"Invocation Metrics",defaultOpen:!1,children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(V,{label:"Latency (ms)",children:null!==(N=e.invocationMetrics.guardrailProcessingLatency)&&void 0!==N?N:"—"}),(0,t.jsx)(V,{label:"Coverage:",children:(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(null===(h=e.invocationMetrics.guardrailCoverage)||void 0===h?void 0:h.textCharacters)&&P("text ".concat(null!==(w=e.invocationMetrics.guardrailCoverage.textCharacters.guarded)&&void 0!==w?w:0,"/").concat(null!==(k=e.invocationMetrics.guardrailCoverage.textCharacters.total)&&void 0!==k?k:0),"blue"),(null===(g=e.invocationMetrics.guardrailCoverage)||void 0===g?void 0:g.images)&&P("images ".concat(null!==(_=e.invocationMetrics.guardrailCoverage.images.guarded)&&void 0!==_?_:0,"/").concat(null!==(S=e.invocationMetrics.guardrailCoverage.images.total)&&void 0!==S?S:0),"blue")]})})]}),(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsx)(V,{label:"Usage:",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:e.invocationMetrics.usage&&Object.entries(e.invocationMetrics.usage).map(e=>{let[s,a]=e;return"number"==typeof a?(0,t.jsxs)("span",{className:"px-2 py-1 bg-slate-100 text-slate-800 rounded-md text-xs font-medium",children:[s,": ",a]},s):null})})})})]})}),(null===(f=e.automatedReasoningPolicy)||void 0===f?void 0:null===(p=f.findings)||void 0===p?void 0:p.length)?(0,t.jsx)(U,{title:"Automated Reasoning Findings",defaultOpen:!1,children:(0,t.jsx)("div",{className:"space-y-2",children:e.automatedReasoningPolicy.findings.map((e,s)=>(0,t.jsx)("pre",{className:"bg-gray-50 rounded p-2 text-xs overflow-x-auto",children:JSON.stringify(e,null,2)},s))})}):null]},s)})}):null,(0,t.jsx)(U,{title:"Raw Bedrock Guardrail Response",defaultOpen:!1,children:(0,t.jsx)("pre",{className:"bg-gray-50 rounded p-3 text-xs overflow-x-auto",children:JSON.stringify(u,null,2)})})]})};let z=e=>new Date(1e3*e).toLocaleString(),J=e=>{var s,a;let{entry:l,index:r,total:n}=e,i=null!==(s=l.guardrail_provider)&&void 0!==s?s:"presidio",o=null!==(a=l.guardrail_status)&&void 0!==a?a:"unknown",d="success"===o.toLowerCase(),c=l.masked_entity_count||{},m=Object.values(c).reduce((e,s)=>e+("number"==typeof s?s:0),0),x=l.guardrail_response,h=Array.isArray(x)?x:[],g="bedrock"!==i||null===x||"object"!=typeof x||Array.isArray(x)?void 0:x;return(0,t.jsxs)("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:[n>1&&(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsxs)("h4",{className:"text-base font-semibold",children:["Guardrail #",r+1,(0,t.jsx)("span",{className:"ml-2 font-mono text-sm text-gray-600",children:l.guardrail_name})]}),(0,t.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-600 rounded-md text-xs capitalize",children:i})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Guardrail Name:"}),(0,t.jsx)("span",{className:"font-mono break-words",children:l.guardrail_name})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Mode:"}),(0,t.jsx)("span",{className:"font-mono break-words",children:l.guardrail_mode})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Status:"}),(0,t.jsx)(u.Z,{title:d?null:"Guardrail failed to run.",placement:"top",arrow:!0,destroyTooltipOnHide:!0,children:(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block ".concat(d?"bg-green-100 text-green-800":"bg-red-100 text-red-800 cursor-help"),children:o})})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Start Time:"}),(0,t.jsx)("span",{children:z(l.start_time)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"End Time:"}),(0,t.jsx)("span",{children:z(l.end_time)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Duration:"}),(0,t.jsxs)("span",{children:[l.duration.toFixed(4),"s"]})]})]})]}),m>0&&(0,t.jsxs)("div",{className:"mt-4 pt-4 border-t",children:[(0,t.jsx)("h5",{className:"font-medium mb-2",children:"Masked Entity Summary"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(c).map(e=>{let[s,a]=e;return(0,t.jsxs)("span",{className:"px-3 py-1.5 bg-blue-50 text-blue-700 rounded-md text-xs font-medium",children:[s,": ",a]},s)})})]}),"presidio"===i&&h.length>0&&(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(K,{entities:h})}),"bedrock"===i&&g&&(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(W,{response:g})})]})};var G=e=>{let{data:s}=e,a=Array.isArray(s)?s.filter(e=>!!e):s?[s]:[],[l,r]=(0,i.useState)(!0),n=1===a.length?a[0].guardrail_name:"".concat(a.length," guardrails"),o=Array.from(new Set(a.map(e=>e.guardrail_status))).every(e=>"success"===(null!=e?e:"").toLowerCase()),d=a.reduce((e,s)=>e+Object.values(s.masked_entity_count||{}).reduce((e,s)=>e+("number"==typeof s?s:0),0),0);return 0===a.length?null:(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow mb-6",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b cursor-pointer hover:bg-gray-50",onClick:()=>r(!l),children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("svg",{className:"w-5 h-5 text-gray-600 transition-transform ".concat(l?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Guardrail Information"}),(0,t.jsx)(u.Z,{title:o?null:"Guardrail failed to run.",placement:"top",arrow:!0,destroyTooltipOnHide:!0,children:(0,t.jsx)("span",{className:"ml-2 px-2 py-1 rounded-md text-xs font-medium inline-block ".concat(o?"bg-green-100 text-green-800":"bg-red-100 text-red-800 cursor-help"),children:o?"success":"failure"})}),(0,t.jsx)("span",{className:"ml-2 font-mono text-sm text-gray-600",children:n}),d>0&&(0,t.jsxs)("span",{className:"ml-2 px-2 py-1 bg-blue-50 text-blue-700 rounded-md text-xs font-medium",children:[d," masked ",1===d?"entity":"entities"]})]}),(0,t.jsx)("span",{className:"text-sm text-gray-500",children:l?"Click to collapse":"Click to expand"})]}),l&&(0,t.jsx)("div",{className:"p-4 space-y-6",children:a.map((e,s)=>{var l;return(0,t.jsx)(J,{entry:e,index:s,total:a.length},"".concat(null!==(l=e.guardrail_name)&&void 0!==l?l:"guardrail","-").concat(s))})})]})},Q=a(23048),$=a(30841),X=a(7310),ee=a.n(X),es=a(12363);let ea={TEAM_ID:"Team ID",KEY_HASH:"Key Hash",REQUEST_ID:"Request ID",MODEL:"Model",USER_ID:"User ID",END_USER:"End User",STATUS:"Status",KEY_ALIAS:"Key Alias"};var et=a(59341),el=a(12485),er=a(18135),en=a(35242),ei=a(29706),eo=a(77991),ed=a(92280);let ec="".concat("../ui/assets/","audit-logs-preview.png");function em(e){let{userID:s,userRole:a,token:l,accessToken:o,isActive:m,premiumUser:u,allTeams:x}=e,[h,g]=(0,i.useState)(r()().subtract(24,"hours").format("YYYY-MM-DDTHH:mm")),p=(0,i.useRef)(null),j=(0,i.useRef)(null),[v,b]=(0,i.useState)(1),[N]=(0,i.useState)(50),[w,k]=(0,i.useState)({}),[_,S]=(0,i.useState)(""),[C,L]=(0,i.useState)(""),[M,T]=(0,i.useState)(""),[E,D]=(0,i.useState)("all"),[A,I]=(0,i.useState)("all"),[R,O]=(0,i.useState)(!1),[H,q]=(0,i.useState)(!1),F=(0,n.a)({queryKey:["all_audit_logs",o,l,a,s,h],queryFn:async()=>{if(!o||!l||!a||!s)return[];let e=r()(h).utc().format("YYYY-MM-DD HH:mm:ss"),t=r()().utc().format("YYYY-MM-DD HH:mm:ss"),n=[],i=1,c=1;do{let s=await (0,d.uiAuditLogsCall)(o,e,t,i,50);n=n.concat(s.audit_logs),c=s.total_pages,i++}while(i<=c);return n},enabled:!!o&&!!l&&!!a&&!!s&&m,refetchInterval:5e3,refetchIntervalInBackground:!0}),Y=(0,i.useCallback)(async e=>{if(o)try{let s=(await (0,d.keyListCall)(o,null,null,e,null,null,1,10)).keys.find(s=>s.key_alias===e);s?L(s.token):L("")}catch(e){console.error("Error fetching key hash for alias:",e),L("")}},[o]);(0,i.useEffect)(()=>{if(!o)return;let e=!1,s=!1;w["Team ID"]?_!==w["Team ID"]&&(S(w["Team ID"]),e=!0):""!==_&&(S(""),e=!0),w["Key Hash"]?C!==w["Key Hash"]&&(L(w["Key Hash"]),s=!0):w["Key Alias"]?Y(w["Key Alias"]):""!==C&&(L(""),s=!0),(e||s)&&b(1)},[w,o,Y,_,C]),(0,i.useEffect)(()=>{b(1)},[_,C,h,M,E,A]),(0,i.useEffect)(()=>{function e(e){p.current&&!p.current.contains(e.target)&&O(!1),j.current&&!j.current.contains(e.target)&&q(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let K=(0,i.useMemo)(()=>F.data?F.data.filter(e=>{var s,a,t,l,r,n,i;let o=!0,d=!0,c=!0,m=!0,u=!0;if(_){let r="string"==typeof e.before_value?null===(s=JSON.parse(e.before_value))||void 0===s?void 0:s.team_id:null===(a=e.before_value)||void 0===a?void 0:a.team_id,n="string"==typeof e.updated_values?null===(t=JSON.parse(e.updated_values))||void 0===t?void 0:t.team_id:null===(l=e.updated_values)||void 0===l?void 0:l.team_id;o=r===_||n===_}if(C)try{let s="string"==typeof e.before_value?JSON.parse(e.before_value):e.before_value,a="string"==typeof e.updated_values?JSON.parse(e.updated_values):e.updated_values,t=null==s?void 0:s.token,l=null==a?void 0:a.token;d="string"==typeof t&&t.includes(C)||"string"==typeof l&&l.includes(C)}catch(e){d=!1}if(M&&(c=null===(r=e.object_id)||void 0===r?void 0:r.toLowerCase().includes(M.toLowerCase())),"all"!==E&&(m=(null===(n=e.action)||void 0===n?void 0:n.toLowerCase())===E.toLowerCase()),"all"!==A){let s="";switch(A){case"keys":s="litellm_verificationtoken";break;case"teams":s="litellm_teamtable";break;case"users":s="litellm_usertable";break;default:s=A}u=(null===(i=e.table_name)||void 0===i?void 0:i.toLowerCase())===s}return o&&d&&c&&m&&u}):[],[F.data,_,C,M,E,A]),P=K.length,Z=Math.ceil(P/N)||1,U=(0,i.useMemo)(()=>{let e=(v-1)*N,s=e+N;return K.slice(e,s)},[K,v,N]),V=!F.data||0===F.data.length,B=(0,i.useCallback)(e=>{let{row:s}=e;return(0,t.jsx)(e=>{let{rowData:s}=e,{before_value:a,updated_values:l,table_name:r,action:n}=s,i=(e,s)=>{if(!e||0===Object.keys(e).length)return(0,t.jsx)(ed.x,{children:"N/A"});if(s){let s=Object.keys(e),a=["token","spend","max_budget"];if(s.every(e=>a.includes(e))&&s.length>0)return(0,t.jsxs)("div",{children:[s.includes("token")&&(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Token:"})," ",e.token||"N/A"]}),s.includes("spend")&&(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Spend:"})," ",void 0!==e.spend?"$".concat((0,f.pw)(e.spend,6)):"N/A"]}),s.includes("max_budget")&&(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Max Budget:"})," ",void 0!==e.max_budget?"$".concat((0,f.pw)(e.max_budget,6)):"N/A"]})]});if(e["No differing fields detected in 'before' state"]||e["No differing fields detected in 'updated' state"]||e["No fields changed"])return(0,t.jsx)(ed.x,{children:e[Object.keys(e)[0]]})}return(0,t.jsx)("pre",{className:"p-2 bg-gray-50 border rounded text-xs overflow-auto max-h-60",children:JSON.stringify(e,null,2)})},o=a,d=l;if(("updated"===n||"rotated"===n)&&a&&l&&("LiteLLM_TeamTable"===r||"LiteLLM_UserTable"===r||"LiteLLM_VerificationToken"===r)){let e={},s={};new Set([...Object.keys(a),...Object.keys(l)]).forEach(t=>{JSON.stringify(a[t])!==JSON.stringify(l[t])&&(a.hasOwnProperty(t)&&(e[t]=a[t]),l.hasOwnProperty(t)&&(s[t]=l[t]))}),Object.keys(a).forEach(t=>{l.hasOwnProperty(t)||e.hasOwnProperty(t)||(e[t]=a[t],s[t]=void 0)}),Object.keys(l).forEach(t=>{a.hasOwnProperty(t)||s.hasOwnProperty(t)||(s[t]=l[t],e[t]=void 0)}),o=Object.keys(e).length>0?e:{"No differing fields detected in 'before' state":"N/A"},d=Object.keys(s).length>0?s:{"No differing fields detected in 'updated' state":"N/A"},0===Object.keys(e).length&&0===Object.keys(s).length&&(o={"No fields changed":"N/A"},d={"No fields changed":"N/A"})}return(0,t.jsxs)("div",{className:"-mx-4 p-4 bg-slate-100 border-y border-slate-300 grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"font-semibold mb-2 text-sm text-slate-700",children:"Before Value:"}),i(o,"LiteLLM_VerificationToken"===r)]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"font-semibold mb-2 text-sm text-slate-700",children:"Updated Value:"}),i(d,"LiteLLM_VerificationToken"===r)]})]})},{rowData:s.original})},[]);if(!u)return(0,t.jsxs)("div",{style:{textAlign:"center",marginTop:"20px"},children:[(0,t.jsx)("h1",{style:{display:"block",marginBottom:"10px"},children:"✨ Enterprise Feature."}),(0,t.jsx)(ed.x,{style:{display:"block",marginBottom:"10px"},children:"This is a LiteLLM Enterprise feature, and requires a valid key to use."}),(0,t.jsx)(ed.x,{style:{display:"block",marginBottom:"20px",fontStyle:"italic"},children:"Here's a preview of what Audit Logs offer:"}),(0,t.jsx)("img",{src:ec,alt:"Audit Logs Preview",style:{maxWidth:"100%",maxHeight:"700px",borderRadius:"8px",boxShadow:"0 4px 8px rgba(0,0,0,0.1)",margin:"0 auto"},onError:e=>{console.error("Failed to load audit logs preview image"),e.target.style.display="none"}})]});let W=P>0?(v-1)*N+1:0,z=Math.min(v*N,P);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-4"}),(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsxs)("div",{className:"border-b px-6 py-4",children:[(0,t.jsx)("h1",{className:"text-xl font-semibold py-4",children:"Audit Logs"}),(0,t.jsx)(e=>{let{show:s}=e;return s?(0,t.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4 flex items-start mb-6",children:[(0,t.jsx)("div",{className:"text-blue-500 mr-3 flex-shrink-0 mt-0.5",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,t.jsx)("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),(0,t.jsx)("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-blue-800",children:"Audit Logs Not Available"}),(0,t.jsx)("p",{className:"text-sm text-blue-700 mt-1",children:"To enable audit logging, add the following configuration to your LiteLLM proxy configuration file:"}),(0,t.jsx)("pre",{className:"mt-2 bg-white p-3 rounded border border-blue-200 text-xs font-mono overflow-auto",children:"litellm_settings:\n store_audit_logs: true"}),(0,t.jsx)("p",{className:"text-xs text-blue-700 mt-2",children:"Note: This will only affect new requests after the configuration change and proxy restart."})]})]}):null},{show:V}),(0,t.jsxs)("div",{className:"flex flex-col md:flex-row items-start md:items-center justify-between space-y-4 md:space-y-0",children:[(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"flex items-center",children:(0,t.jsx)("input",{type:"text",placeholder:"Search by Object ID...",value:M,onChange:e=>T(e.target.value),className:"px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})}),(0,t.jsxs)("button",{onClick:()=>{F.refetch()},className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",title:"Refresh data",children:[(0,t.jsx)("svg",{className:"w-4 h-4 ".concat(F.isFetching?"animate-spin":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),(0,t.jsx)("span",{children:"Refresh"})]})]})}),(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,t.jsxs)("div",{className:"relative",ref:p,children:[(0,t.jsx)("label",{htmlFor:"actionFilterDisplay",className:"mr-2 text-sm font-medium text-gray-700 sr-only",children:"Action:"}),(0,t.jsxs)("button",{id:"actionFilterDisplay",onClick:()=>O(!R),className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2 bg-white w-40 text-left justify-between",children:[(0,t.jsxs)("span",{children:["all"===E&&"All Actions","created"===E&&"Created","updated"===E&&"Updated","deleted"===E&&"Deleted","rotated"===E&&"Rotated"]}),(0,t.jsx)("svg",{className:"w-4 h-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M19 9l-7 7-7-7"})})]}),R&&(0,t.jsx)("div",{className:"absolute left-0 mt-2 w-40 bg-white rounded-lg shadow-lg border p-1 z-50",children:(0,t.jsx)("div",{className:"space-y-1",children:[{label:"All Actions",value:"all"},{label:"Created",value:"created"},{label:"Updated",value:"updated"},{label:"Deleted",value:"deleted"},{label:"Rotated",value:"rotated"}].map(e=>(0,t.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm hover:bg-gray-50 rounded-md ".concat(E===e.value?"bg-blue-50 text-blue-600 font-medium":"font-normal"),onClick:()=>{D(e.value),O(!1)},children:e.label},e.value))})})]}),(0,t.jsxs)("div",{className:"relative",ref:j,children:[(0,t.jsx)("label",{htmlFor:"tableFilterDisplay",className:"mr-2 text-sm font-medium text-gray-700 sr-only",children:"Table:"}),(0,t.jsxs)("button",{id:"tableFilterDisplay",onClick:()=>q(!H),className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2 bg-white w-40 text-left justify-between",children:[(0,t.jsxs)("span",{children:["all"===A&&"All Tables","keys"===A&&"Keys","teams"===A&&"Teams","users"===A&&"Users"]}),(0,t.jsx)("svg",{className:"w-4 h-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M19 9l-7 7-7-7"})})]}),H&&(0,t.jsx)("div",{className:"absolute left-0 mt-2 w-40 bg-white rounded-lg shadow-lg border p-1 z-50",children:(0,t.jsx)("div",{className:"space-y-1",children:[{label:"All Tables",value:"all"},{label:"Keys",value:"keys"},{label:"Teams",value:"teams"},{label:"Users",value:"users"}].map(e=>(0,t.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm hover:bg-gray-50 rounded-md ".concat(A===e.value?"bg-blue-50 text-blue-600 font-medium":"font-normal"),onClick:()=>{I(e.value),q(!1)},children:e.label},e.value))})})]}),(0,t.jsxs)("span",{className:"text-sm text-gray-700",children:["Showing ",F.isLoading?"...":W," -"," ",F.isLoading?"...":z," of"," ",F.isLoading?"...":P," results"]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsxs)("span",{className:"text-sm text-gray-700",children:["Page ",F.isLoading?"...":v," of"," ",F.isLoading?"...":Z]}),(0,t.jsx)("button",{onClick:()=>b(e=>Math.max(1,e-1)),disabled:F.isLoading||1===v,className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),(0,t.jsx)("button",{onClick:()=>b(e=>Math.min(Z,e+1)),disabled:F.isLoading||v===Z,className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]})]})]}),(0,t.jsx)(c.w,{columns:y,data:U,renderSubComponent:B,getRowCanExpand:()=>!0})]})]})}let eu=(e,s,a)=>{if(e)return"".concat(r()(s).format("MMM D, h:mm A")," - ").concat(r()(a).format("MMM D, h:mm A"));let t=r()(),l=r()(s),n=t.diff(l,"minutes");if(n>=0&&n<2)return"Last 1 Minute";if(n>=2&&n<16)return"Last 15 Minutes";if(n>=16&&n<61)return"Last Hour";let i=t.diff(l,"hours");return i>=1&&i<5?"Last 4 Hours":i>=5&&i<25?"Last 24 Hours":i>=25&&i<169?"Last 7 Days":"".concat(l.format("MMM D")," - ").concat(t.format("MMM D"))};var ex=a(9309);function eh(e){var s,a,l;let{accessToken:m,token:u,userRole:x,userID:h,allTeams:g,premiumUser:p}=e,[f,j]=(0,i.useState)(""),[b,y]=(0,i.useState)(!1),[w,k]=(0,i.useState)(!1),[_,S]=(0,i.useState)(1),[L]=(0,i.useState)(50),T=(0,i.useRef)(null),E=(0,i.useRef)(null),D=(0,i.useRef)(null),[A,I]=(0,i.useState)(r()().subtract(24,"hours").format("YYYY-MM-DDTHH:mm")),[R,O]=(0,i.useState)(r()().format("YYYY-MM-DDTHH:mm")),[H,F]=(0,i.useState)(!1),[Y,K]=(0,i.useState)(!1),[P,Z]=(0,i.useState)(""),[U,V]=(0,i.useState)(""),[B,W]=(0,i.useState)(""),[z,J]=(0,i.useState)(""),[G,X]=(0,i.useState)(""),[ed,ec]=(0,i.useState)(null),[ex,eh]=(0,i.useState)(null),[ep,ef]=(0,i.useState)(""),[ej,ev]=(0,i.useState)(""),[eb,ey]=(0,i.useState)(x&&C.lo.includes(x)),[eN,ew]=(0,i.useState)("request logs"),[ek,e_]=(0,i.useState)(null),[eS,eC]=(0,i.useState)(null),eL=(0,o.NL)(),[eM,eT]=(0,i.useState)(()=>{let e=sessionStorage.getItem("isLiveTail");return null===e||JSON.parse(e)});(0,i.useEffect)(()=>{sessionStorage.setItem("isLiveTail",JSON.stringify(eM))},[eM]);let[eE,eD]=(0,i.useState)({value:24,unit:"hours"});(0,i.useEffect)(()=>{(async()=>{ex&&m&&ec({...(await (0,d.keyInfoV1Call)(m,ex)).info,token:ex,api_key:ex})})()},[ex,m]),(0,i.useEffect)(()=>{function e(e){T.current&&!T.current.contains(e.target)&&k(!1),E.current&&!E.current.contains(e.target)&&y(!1),D.current&&!D.current.contains(e.target)&&K(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,i.useEffect)(()=>{x&&C.lo.includes(x)&&ey(!0)},[x]);let eA=(0,n.a)({queryKey:["logs","table",_,L,A,R,B,z,eb?h:null,ep,G],queryFn:async()=>{if(!m||!u||!x||!h)return{data:[],total:0,page:1,page_size:L,total_pages:0};let e=r()(A).utc().format("YYYY-MM-DD HH:mm:ss"),s=H?r()(R).utc().format("YYYY-MM-DD HH:mm:ss"):r()().utc().format("YYYY-MM-DD HH:mm:ss"),a=await (0,d.uiSpendLogsCall)(m,z||void 0,B||void 0,void 0,e,s,_,L,eb?h:void 0,ej,ep,G);return await N(a.data,e,m,eL),a.data=a.data.map(s=>{let a=eL.getQueryData(["logDetails",s.request_id,e]);return(null==a?void 0:a.messages)&&(null==a?void 0:a.response)&&(s.messages=a.messages,s.response=a.response),s}),a},enabled:!!m&&!!u&&!!x&&!!h&&"request logs"===eN,refetchInterval:!!eM&&1===_&&15e3,refetchIntervalInBackground:!0}),{filters:eI,filteredLogs:eR,allTeams:eO,allKeyAliases:eH,handleFilterChange:eq,handleFilterReset:eF}=function(e){let{logs:s,accessToken:a,startTime:t,endTime:l,pageSize:o=es.d,isCustomDate:c,setCurrentPage:m,userID:u,userRole:x}=e,h=(0,i.useMemo)(()=>({[ea.TEAM_ID]:"",[ea.KEY_HASH]:"",[ea.REQUEST_ID]:"",[ea.MODEL]:"",[ea.USER_ID]:"",[ea.END_USER]:"",[ea.STATUS]:"",[ea.KEY_ALIAS]:""}),[]),[g,p]=(0,i.useState)(h),[f,j]=(0,i.useState)({data:[],total:0,page:1,page_size:50,total_pages:0}),v=(0,i.useRef)(0),b=(0,i.useCallback)(async function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(!a)return;console.log("Filters being sent to API:",e);let n=Date.now();v.current=n;let i=r()(t).utc().format("YYYY-MM-DD HH:mm:ss"),m=c?r()(l).utc().format("YYYY-MM-DD HH:mm:ss"):r()().utc().format("YYYY-MM-DD HH:mm:ss");try{let t=await (0,d.uiSpendLogsCall)(a,e[ea.KEY_HASH]||void 0,e[ea.TEAM_ID]||void 0,e[ea.REQUEST_ID]||void 0,i,m,s,o,e[ea.USER_ID]||void 0,e[ea.END_USER]||void 0,e[ea.STATUS]||void 0,e[ea.MODEL]||void 0,e[ea.KEY_ALIAS]||void 0);n===v.current&&t.data&&j(t)}catch(e){console.error("Error searching users:",e)}},[a,t,l,c,o]),y=(0,i.useMemo)(()=>ee()((e,s)=>b(e,s),300),[b]);(0,i.useEffect)(()=>()=>y.cancel(),[y]);let N=(0,n.a)({queryKey:["allKeys"],queryFn:async()=>{if(!a)throw Error("Access token required");return await (0,$.LO)(a)},enabled:!!a}).data||[],w=(0,i.useMemo)(()=>!!(g[ea.KEY_ALIAS]||g[ea.KEY_HASH]||g[ea.REQUEST_ID]||g[ea.USER_ID]||g[ea.END_USER]),[g]),k=(0,i.useMemo)(()=>{if(!s||!s.data)return{data:[],total:0,page:1,page_size:50,total_pages:0};if(w)return s;let e=[...s.data];return g[ea.TEAM_ID]&&(e=e.filter(e=>e.team_id===g[ea.TEAM_ID])),g[ea.STATUS]&&(e=e.filter(e=>"success"===g[ea.STATUS]?!e.status||"success"===e.status:e.status===g[ea.STATUS])),g[ea.MODEL]&&(e=e.filter(e=>e.model===g[ea.MODEL])),g[ea.KEY_HASH]&&(e=e.filter(e=>e.api_key===g[ea.KEY_HASH])),g[ea.END_USER]&&(e=e.filter(e=>e.end_user===g[ea.END_USER])),{data:e,total:s.total,page:s.page,page_size:s.page_size,total_pages:s.total_pages}},[s,g,w]),_=(0,i.useMemo)(()=>w?f&&f.data&&f.data.length>0?f:s||{data:[],total:0,page:1,page_size:50,total_pages:0}:k,[w,f,k,s]),{data:S}=(0,n.a)({queryKey:["allTeamsForLogFilters",a],queryFn:async()=>a&&await (0,$.IE)(a)||[],enabled:!!a});return{filters:g,filteredLogs:_,allKeyAliases:N,allTeams:S,handleFilterChange:e=>{p(s=>{let a={...s,...e};for(let e of Object.keys(h))e in a||(a[e]=h[e]);return JSON.stringify(a)!==JSON.stringify(s)&&(m(1),y(a,1)),a})},handleFilterReset:()=>{p(h),j({data:[],total:0,page:1,page_size:50,total_pages:0}),y(h,1)}}}({logs:eA.data||{data:[],total:0,page:1,page_size:L||10,total_pages:1},accessToken:m,startTime:A,endTime:R,pageSize:L,isCustomDate:H,setCurrentPage:S,userID:h,userRole:x}),eY=(0,i.useCallback)(async e=>{if(m)try{let s=(await (0,d.keyListCall)(m,null,null,e,null,null,_,L)).keys.find(s=>s.key_alias===e);s&&J(s.token)}catch(e){console.error("Error fetching key hash for alias:",e)}},[m,_,L]);(0,i.useEffect)(()=>{m&&(eI["Team ID"]?W(eI["Team ID"]):W(""),ef(eI.Status||""),X(eI.Model||""),ev(eI["End User"]||""),eI["Key Hash"]?J(eI["Key Hash"]):eI["Key Alias"]?eY(eI["Key Alias"]):J(""))},[eI,m,eY]);let eK=(0,n.a)({queryKey:["sessionLogs",eS],queryFn:async()=>{if(!m||!eS)return{data:[],total:0,page:1,page_size:50,total_pages:1};let e=await (0,d.sessionSpendLogsCall)(m,eS);return{data:e.data||e||[],total:(e.data||e||[]).length,page:1,page_size:1e3,total_pages:1}},enabled:!!m&&!!eS});if((0,i.useEffect)(()=>{var e;(null===(e=eA.data)||void 0===e?void 0:e.data)&&ek&&!eA.data.data.some(e=>e.request_id===ek)&&e_(null)},[null===(s=eA.data)||void 0===s?void 0:s.data,ek]),!m||!u||!x||!h)return null;let eP=eR.data.filter(e=>!f||e.request_id.includes(f)||e.model.includes(f)||e.user&&e.user.includes(f)).map(e=>({...e,duration:(Date.parse(e.endTime)-Date.parse(e.startTime))/1e3,onKeyHashClick:e=>eh(e),onSessionClick:e=>{e&&eC(e)}}))||[],eZ=(null===(l=eK.data)||void 0===l?void 0:null===(a=l.data)||void 0===a?void 0:a.map(e=>({...e,onKeyHashClick:e=>eh(e),onSessionClick:e=>{}})))||[],eU=[{name:"Team ID",label:"Team ID",isSearchable:!0,searchFn:async e=>g&&0!==g.length?g.filter(s=>s.team_id.toLowerCase().includes(e.toLowerCase())||s.team_alias&&s.team_alias.toLowerCase().includes(e.toLowerCase())).map(e=>({label:"".concat(e.team_alias||e.team_id," (").concat(e.team_id,")"),value:e.team_id})):[]},{name:"Status",label:"Status",isSearchable:!1,options:[{label:"Success",value:"success"},{label:"Failure",value:"failure"}]},{name:"Model",label:"Model",isSearchable:!1},{name:"Key Alias",label:"Key Alias",isSearchable:!0,searchFn:async e=>m?(await (0,$.LO)(m)).filter(s=>s.toLowerCase().includes(e.toLowerCase())).map(e=>({label:e,value:e})):[]},{name:"End User",label:"End User",isSearchable:!0,searchFn:async e=>{if(!m)return[];let s=await (0,d.allEndUsersCall)(m);return((null==s?void 0:s.map(e=>e.user_id))||[]).filter(s=>s.toLowerCase().includes(e.toLowerCase())).map(e=>({label:e,value:e}))}},{name:"Key Hash",label:"Key Hash",isSearchable:!1}];if(eS&&eK.data)return(0,t.jsx)("div",{className:"w-full p-6",children:(0,t.jsx)(q,{sessionId:eS,logs:eK.data.data,onBack:()=>eC(null)})});let eV=[{label:"Last 15 Minutes",value:15,unit:"minutes"},{label:"Last Hour",value:1,unit:"hours"},{label:"Last 4 Hours",value:4,unit:"hours"},{label:"Last 24 Hours",value:24,unit:"hours"},{label:"Last 7 Days",value:7,unit:"days"}],eB=eV.find(e=>e.value===eE.value&&e.unit===eE.unit),eW=H?eu(H,A,R):null==eB?void 0:eB.label;return(0,t.jsx)("div",{className:"w-full max-w-screen p-6 overflow-x-hidden box-border",children:(0,t.jsxs)(er.Z,{defaultIndex:0,onIndexChange:e=>ew(0===e?"request logs":"audit logs"),children:[(0,t.jsxs)(en.Z,{children:[(0,t.jsx)(el.Z,{children:"Request Logs"}),(0,t.jsx)(el.Z,{children:"Audit Logs"})]}),(0,t.jsxs)(eo.Z,{children:[(0,t.jsxs)(ei.Z,{children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,t.jsx)("h1",{className:"text-xl font-semibold",children:eS?(0,t.jsxs)(t.Fragment,{children:["Session: ",(0,t.jsx)("span",{className:"font-mono",children:eS}),(0,t.jsx)("button",{className:"ml-4 px-3 py-1 text-sm border rounded hover:bg-gray-50",onClick:()=>eC(null),children:"← Back to All Logs"})]}):"Request Logs"})}),ed&&ex&&ed.api_key===ex?(0,t.jsx)(M.Z,{keyId:ex,keyData:ed,accessToken:m,userID:h,userRole:x,teams:g,onClose:()=>eh(null),premiumUser:p,backButtonText:"Back to Logs"}):eS?(0,t.jsx)("div",{className:"bg-white rounded-lg shadow",children:(0,t.jsx)(c.w,{columns:v,data:eZ,renderSubComponent:eg,getRowCanExpand:()=>!0})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Q.Z,{options:eU,onApplyFilters:eq,onResetFilters:eF}),(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full box-border",children:[(0,t.jsx)("div",{className:"border-b px-6 py-4 w-full max-w-full box-border",children:(0,t.jsxs)("div",{className:"flex flex-col md:flex-row items-start md:items-center justify-between space-y-4 md:space-y-0 w-full max-w-full box-border",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3 w-full max-w-full box-border",children:[(0,t.jsxs)("div",{className:"relative w-64 min-w-0 flex-shrink-0",children:[(0,t.jsx)("input",{type:"text",placeholder:"Search by Request ID",className:"w-full px-3 py-2 pl-8 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",value:f,onChange:e=>j(e.target.value)}),(0,t.jsx)("svg",{className:"absolute left-2.5 top-2.5 h-4 w-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-shrink",children:[(0,t.jsxs)("div",{className:"relative z-50",ref:D,children:[(0,t.jsxs)("button",{onClick:()=>K(!Y),className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",children:[(0,t.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),eW]}),Y&&(0,t.jsx)("div",{className:"absolute right-0 mt-2 w-64 bg-white rounded-lg shadow-lg border p-2 z-50",children:(0,t.jsxs)("div",{className:"space-y-1",children:[eV.map(e=>(0,t.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm hover:bg-gray-50 rounded-md ".concat(eW===e.label?"bg-blue-50 text-blue-600":""),onClick:()=>{O(r()().format("YYYY-MM-DDTHH:mm")),I(r()().subtract(e.value,e.unit).format("YYYY-MM-DDTHH:mm")),eD({value:e.value,unit:e.unit}),F(!1),K(!1)},children:e.label},e.label)),(0,t.jsx)("div",{className:"border-t my-2"}),(0,t.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm hover:bg-gray-50 rounded-md ".concat(H?"bg-blue-50 text-blue-600":""),onClick:()=>F(!H),children:"Custom Range"})]})})]}),(0,t.jsx)(()=>(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900",children:"Live Tail"}),(0,t.jsx)(et.Z,{color:"green",checked:eM,defaultChecked:!0,onChange:eT})]}),{}),(0,t.jsxs)("button",{onClick:()=>{eA.refetch()},className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",title:"Refresh data",children:[(0,t.jsx)("svg",{className:"w-4 h-4 ".concat(eA.isFetching?"animate-spin":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),(0,t.jsx)("span",{children:"Refresh"})]})]}),H&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{children:(0,t.jsx)("input",{type:"datetime-local",value:A,onChange:e=>{I(e.target.value),S(1)},className:"px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})}),(0,t.jsx)("span",{className:"text-gray-500",children:"to"}),(0,t.jsx)("div",{children:(0,t.jsx)("input",{type:"datetime-local",value:R,onChange:e=>{O(e.target.value),S(1)},className:"px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})})]})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,t.jsxs)("span",{className:"text-sm text-gray-700 whitespace-nowrap",children:["Showing ",eA.isLoading?"...":eR?(_-1)*L+1:0," -"," ",eA.isLoading?"...":eR?Math.min(_*L,eR.total):0," ","of ",eA.isLoading?"...":eR?eR.total:0," results"]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsxs)("span",{className:"text-sm text-gray-700 min-w-[90px]",children:["Page ",eA.isLoading?"...":_," of"," ",eA.isLoading?"...":eR?eR.total_pages:1]}),(0,t.jsx)("button",{onClick:()=>S(e=>Math.max(1,e-1)),disabled:eA.isLoading||1===_,className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),(0,t.jsx)("button",{onClick:()=>S(e=>Math.min(eR.total_pages||1,e+1)),disabled:eA.isLoading||_===(eR.total_pages||1),className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]})]})}),eM&&1===_&&(0,t.jsxs)("div",{className:"mb-4 px-4 py-2 bg-green-50 border border-greem-200 rounded-md flex items-center justify-between",children:[(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsx)("span",{className:"text-sm text-green-700",children:"Auto-refreshing every 15 seconds"})}),(0,t.jsx)("button",{onClick:()=>eT(!1),className:"text-sm text-green-600 hover:text-green-800",children:"Stop"})]}),(0,t.jsx)(c.w,{columns:v,data:eP,renderSubComponent:eg,getRowCanExpand:()=>!0})]})]})]}),(0,t.jsx)(ei.Z,{children:(0,t.jsx)(em,{userID:h,userRole:x,token:u,accessToken:m,isActive:"audit logs"===eN,premiumUser:p,allTeams:g})})]})]})})}function eg(e){var s,a,l,r,n,i,o,d,c,m;let{row:x}=e,h=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){}return e},g=x.original.metadata||{},p="failure"===g.status,j=p?g.error_information:null,v=x.original.messages&&(Array.isArray(x.original.messages)?x.original.messages.length>0:Object.keys(x.original.messages).length>0),b=x.original.response&&Object.keys(h(x.original.response)).length>0,y=g.vector_store_request_metadata&&Array.isArray(g.vector_store_request_metadata)&&g.vector_store_request_metadata.length>0,N=null===(s=x.original.metadata)||void 0===s?void 0:s.guardrail_information,w=Array.isArray(N)?N:N?[N]:[],k=w.length>0,C=w.reduce((e,s)=>{let a=null==s?void 0:s.masked_entity_count;return a?e+Object.values(a).reduce((e,s)=>"number"==typeof s?e+s:e,0):e},0),M=1===w.length?null!==(m=null===(a=w[0])||void 0===a?void 0:a.guardrail_name)&&void 0!==m?m:"-":w.length>1?"".concat(w.length," guardrails"):"-",T=(0,ex.aS)(x.original.request_id,64);return(0,t.jsxs)("div",{className:"p-6 bg-gray-50 space-y-6 w-full max-w-full overflow-hidden box-border",children:[(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden",children:[(0,t.jsx)("div",{className:"p-4 border-b",children:(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Request Details"})}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 p-4 w-full max-w-full overflow-hidden",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Request ID:"}),x.original.request_id.length>64?(0,t.jsx)(u.Z,{title:x.original.request_id,children:(0,t.jsx)("span",{className:"font-mono text-sm",children:T})}):(0,t.jsx)("span",{className:"font-mono text-sm",children:x.original.request_id})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Model:"}),(0,t.jsx)("span",{children:x.original.model})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Model ID:"}),(0,t.jsx)("span",{children:x.original.model_id})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Call Type:"}),(0,t.jsx)("span",{children:x.original.call_type})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Provider:"}),(0,t.jsx)("span",{children:x.original.custom_llm_provider||"-"})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"API Base:"}),(0,t.jsx)(u.Z,{title:x.original.api_base||"-",children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:x.original.api_base||"-"})})]}),(null==x?void 0:null===(l=x.original)||void 0===l?void 0:l.requester_ip_address)&&(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"IP Address:"}),(0,t.jsx)("span",{children:null==x?void 0:null===(r=x.original)||void 0===r?void 0:r.requester_ip_address})]}),k&&(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Guardrail:"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-mono",children:M}),C>0&&(0,t.jsxs)("span",{className:"ml-2 px-2 py-0.5 bg-blue-50 text-blue-700 rounded-md text-xs font-medium",children:[C," masked"]})]})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Tokens:"}),(0,t.jsxs)("span",{children:[x.original.total_tokens," (",x.original.prompt_tokens," prompt tokens +"," ",x.original.completion_tokens," completion tokens)"]})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Cache Read Tokens:"}),(0,t.jsx)("span",{children:(0,f.pw)((null===(i=x.original.metadata)||void 0===i?void 0:null===(n=i.additional_usage_values)||void 0===n?void 0:n.cache_read_input_tokens)||0)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Cache Creation Tokens:"}),(0,t.jsx)("span",{children:(0,f.pw)(null===(o=x.original.metadata)||void 0===o?void 0:o.additional_usage_values.cache_creation_input_tokens)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Cost:"}),(0,t.jsxs)("span",{children:["$",(0,f.pw)(x.original.spend||0,6)]})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Cache Hit:"}),(0,t.jsx)("span",{children:x.original.cache_hit})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Status:"}),(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block text-center w-16 ".concat("failure"!==((null===(d=x.original.metadata)||void 0===d?void 0:d.status)||"Success").toLowerCase()?"bg-green-100 text-green-800":"bg-red-100 text-red-800"),children:"failure"!==((null===(c=x.original.metadata)||void 0===c?void 0:c.status)||"Success").toLowerCase()?"Success":"Failure"})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Start Time:"}),(0,t.jsx)("span",{children:x.original.startTime})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"End Time:"}),(0,t.jsx)("span",{children:x.original.endTime})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Duration:"}),(0,t.jsxs)("span",{children:[x.original.duration," s."]})]})]})]})]}),(0,t.jsx)(L,{show:!v&&!b}),(0,t.jsx)("div",{className:"w-full max-w-full overflow-hidden",children:(0,t.jsx)(_,{row:x,hasMessages:v,hasResponse:b,hasError:p,errorInfo:j,getRawRequest:()=>{var e;return(null===(e=x.original)||void 0===e?void 0:e.proxy_server_request)?h(x.original.proxy_server_request):h(x.original.messages)},formattedResponse:()=>p&&j?{error:{message:j.error_message||"An error occurred",type:j.error_class||"error",code:j.error_code||"unknown",param:null}}:h(x.original.response)})}),k&&(0,t.jsx)(G,{data:N}),y&&(0,t.jsx)(F,{data:g.vector_store_request_metadata}),p&&j&&(0,t.jsx)(S,{errorInfo:j}),x.original.request_tags&&Object.keys(x.original.request_tags).length>0&&(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsx)("div",{className:"flex justify-between items-center p-4 border-b",children:(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Request Tags"})}),(0,t.jsx)("div",{className:"p-4",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(x.original.request_tags).map(e=>{let[s,a]=e;return(0,t.jsxs)("span",{className:"px-2 py-1 bg-gray-100 rounded-full text-xs",children:[s,": ",String(a)]},s)})})})]}),x.original.metadata&&Object.keys(x.original.metadata).length>0&&(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b",children:[(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Metadata"}),(0,t.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(JSON.stringify(x.original.metadata,null,2))},className:"p-1 hover:bg-gray-200 rounded",title:"Copy metadata",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]}),(0,t.jsx)("div",{className:"p-4 overflow-auto max-h-64",children:(0,t.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap break-all",children:JSON.stringify(x.original.metadata,null,2)})})]})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/3881-fb9362275df4cfb8.js b/litellm/proxy/_experimental/out/_next/static/chunks/3881-fb9362275df4cfb8.js new file mode 100644 index 00000000000..dc34278e2aa --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/3881-fb9362275df4cfb8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3881],{2894:function(t,e,s){s.d(e,{R:function(){return u},m:function(){return n}});var i=s(18238),r=s(7989),a=s(11255),n=class extends r.F{#t;#e;#s;#i;constructor(t){super(),this.#t=t.client,this.mutationId=t.mutationId,this.#s=t.mutationCache,this.#e=[],this.state=t.state||u(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#e.includes(t)||(this.#e.push(t),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#e=this.#e.filter(e=>e!==t),this.scheduleGc(),this.#s.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#e.length||("pending"===this.state.status?this.scheduleGc():this.#s.remove(this))}continue(){return this.#i?.continue()??this.execute(this.state.variables)}async execute(t){let e=()=>{this.#r({type:"continue"})},s={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#i=(0,a.Mz)({fn:()=>this.options.mutationFn?this.options.mutationFn(t,s):Promise.reject(Error("No mutationFn found")),onFail:(t,e)=>{this.#r({type:"failed",failureCount:t,error:e})},onPause:()=>{this.#r({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#s.canRun(this)});let i="pending"===this.state.status,r=!this.#i.canStart();try{if(i)e();else{this.#r({type:"pending",variables:t,isPaused:r}),await this.#s.config.onMutate?.(t,this,s);let e=await this.options.onMutate?.(t,s);e!==this.state.context&&this.#r({type:"pending",context:e,variables:t,isPaused:r})}let a=await this.#i.start();return await this.#s.config.onSuccess?.(a,t,this.state.context,this,s),await this.options.onSuccess?.(a,t,this.state.context,s),await this.#s.config.onSettled?.(a,null,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(a,null,t,this.state.context,s),this.#r({type:"success",data:a}),a}catch(e){try{throw await this.#s.config.onError?.(e,t,this.state.context,this,s),await this.options.onError?.(e,t,this.state.context,s),await this.#s.config.onSettled?.(void 0,e,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(void 0,e,t,this.state.context,s),e}finally{this.#r({type:"error",error:e})}}finally{this.#s.runNext(this)}}#r(t){this.state=(e=>{switch(t.type){case"failed":return{...e,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...e,isPaused:!0};case"continue":return{...e,isPaused:!1};case"pending":return{...e,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...e,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...e,data:void 0,error:t.error,failureCount:e.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}})(this.state),i.Vr.batch(()=>{this.#e.forEach(e=>{e.onMutationUpdate(t)}),this.#s.notify({mutation:this,type:"updated",action:t})})}};function u(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}},21623:function(t,e,s){s.d(e,{S:function(){return y}});var i=s(45345),r=s(21733),a=s(18238),n=s(24112),u=class extends n.l{constructor(t={}){super(),this.config=t,this.#a=new Map}#a;build(t,e,s){let a=e.queryKey,n=e.queryHash??(0,i.Rm)(a,e),u=this.get(n);return u||(u=new r.A({client:t,queryKey:a,queryHash:n,options:t.defaultQueryOptions(e),state:s,defaultOptions:t.getQueryDefaults(a)}),this.add(u)),u}add(t){this.#a.has(t.queryHash)||(this.#a.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){let e=this.#a.get(t.queryHash);e&&(t.destroy(),e===t&&this.#a.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){a.Vr.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#a.get(t)}getAll(){return[...this.#a.values()]}find(t){let e={exact:!0,...t};return this.getAll().find(t=>(0,i._x)(e,t))}findAll(t={}){let e=this.getAll();return Object.keys(t).length>0?e.filter(e=>(0,i._x)(t,e)):e}notify(t){a.Vr.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){a.Vr.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){a.Vr.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},o=s(2894),h=class extends n.l{constructor(t={}){super(),this.config=t,this.#n=new Set,this.#u=new Map,this.#o=0}#n;#u;#o;build(t,e,s){let i=new o.m({client:t,mutationCache:this,mutationId:++this.#o,options:t.defaultMutationOptions(e),state:s});return this.add(i),i}add(t){this.#n.add(t);let e=c(t);if("string"==typeof e){let s=this.#u.get(e);s?s.push(t):this.#u.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#n.delete(t)){let e=c(t);if("string"==typeof e){let s=this.#u.get(e);if(s){if(s.length>1){let e=s.indexOf(t);-1!==e&&s.splice(e,1)}else s[0]===t&&this.#u.delete(e)}}}this.notify({type:"removed",mutation:t})}canRun(t){let e=c(t);if("string"!=typeof e)return!0;{let s=this.#u.get(e),i=s?.find(t=>"pending"===t.state.status);return!i||i===t}}runNext(t){let e=c(t);if("string"!=typeof e)return Promise.resolve();{let s=this.#u.get(e)?.find(e=>e!==t&&e.state.isPaused);return s?.continue()??Promise.resolve()}}clear(){a.Vr.batch(()=>{this.#n.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#n.clear(),this.#u.clear()})}getAll(){return Array.from(this.#n)}find(t){let e={exact:!0,...t};return this.getAll().find(t=>(0,i.X7)(e,t))}findAll(t={}){return this.getAll().filter(e=>(0,i.X7)(t,e))}notify(t){a.Vr.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){let t=this.getAll().filter(t=>t.state.isPaused);return a.Vr.batch(()=>Promise.all(t.map(t=>t.continue().catch(i.ZT))))}};function c(t){return t.options.scope?.id}var l=s(87045),d=s(57853);function f(t){return{onFetch:(e,s)=>{let r=e.options,a=e.fetchOptions?.meta?.fetchMore?.direction,n=e.state.data?.pages||[],u=e.state.data?.pageParams||[],o={pages:[],pageParams:[]},h=0,c=async()=>{let s=!1,c=t=>{Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(e.signal.aborted?s=!0:e.signal.addEventListener("abort",()=>{s=!0}),e.signal)})},l=(0,i.cG)(e.options,e.fetchOptions),d=async(t,r,a)=>{if(s)return Promise.reject();if(null==r&&t.pages.length)return Promise.resolve(t);let n=(()=>{let t={client:e.client,queryKey:e.queryKey,pageParam:r,direction:a?"backward":"forward",meta:e.options.meta};return c(t),t})(),u=await l(n),{maxPages:o}=e.options,h=a?i.Ht:i.VX;return{pages:h(t.pages,u,o),pageParams:h(t.pageParams,r,o)}};if(a&&n.length){let t="backward"===a,e={pages:n,pageParams:u},s=(t?function(t,{pages:e,pageParams:s}){return e.length>0?t.getPreviousPageParam?.(e[0],e,s[0],s):void 0}:p)(r,e);o=await d(e,s,t)}else{let e=t??n.length;do{let t=0===h?u[0]??r.initialPageParam:p(r,o);if(h>0&&null==t)break;o=await d(o,t),h++}while(he.options.persister?.(c,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},s):e.fetchFn=c}}}function p(t,{pages:e,pageParams:s}){let i=e.length-1;return e.length>0?t.getNextPageParam(e[i],e,s[i],s):void 0}var y=class{#h;#s;#c;#l;#d;#f;#p;#y;constructor(t={}){this.#h=t.queryCache||new u,this.#s=t.mutationCache||new h,this.#c=t.defaultOptions||{},this.#l=new Map,this.#d=new Map,this.#f=0}mount(){this.#f++,1===this.#f&&(this.#p=l.j.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#h.onFocus())}),this.#y=d.N.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#h.onOnline())}))}unmount(){this.#f--,0===this.#f&&(this.#p?.(),this.#p=void 0,this.#y?.(),this.#y=void 0)}isFetching(t){return this.#h.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#s.findAll({...t,status:"pending"}).length}getQueryData(t){let e=this.defaultQueryOptions({queryKey:t});return this.#h.get(e.queryHash)?.state.data}ensureQueryData(t){let e=this.defaultQueryOptions(t),s=this.#h.build(this,e),r=s.state.data;return void 0===r?this.fetchQuery(t):(t.revalidateIfStale&&s.isStaleByTime((0,i.KC)(e.staleTime,s))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return this.#h.findAll(t).map(({queryKey:t,state:e})=>[t,e.data])}setQueryData(t,e,s){let r=this.defaultQueryOptions({queryKey:t}),a=this.#h.get(r.queryHash),n=a?.state.data,u=(0,i.SE)(e,n);if(void 0!==u)return this.#h.build(this,r).setData(u,{...s,manual:!0})}setQueriesData(t,e,s){return a.Vr.batch(()=>this.#h.findAll(t).map(({queryKey:t})=>[t,this.setQueryData(t,e,s)]))}getQueryState(t){let e=this.defaultQueryOptions({queryKey:t});return this.#h.get(e.queryHash)?.state}removeQueries(t){let e=this.#h;a.Vr.batch(()=>{e.findAll(t).forEach(t=>{e.remove(t)})})}resetQueries(t,e){let s=this.#h;return a.Vr.batch(()=>(s.findAll(t).forEach(t=>{t.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){let s={revert:!0,...e};return Promise.all(a.Vr.batch(()=>this.#h.findAll(t).map(t=>t.cancel(s)))).then(i.ZT).catch(i.ZT)}invalidateQueries(t,e={}){return a.Vr.batch(()=>(this.#h.findAll(t).forEach(t=>{t.invalidate()}),t?.refetchType==="none")?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e))}refetchQueries(t,e={}){let s={...e,cancelRefetch:e.cancelRefetch??!0};return Promise.all(a.Vr.batch(()=>this.#h.findAll(t).filter(t=>!t.isDisabled()&&!t.isStatic()).map(t=>{let e=t.fetch(void 0,s);return s.throwOnError||(e=e.catch(i.ZT)),"paused"===t.state.fetchStatus?Promise.resolve():e}))).then(i.ZT)}fetchQuery(t){let e=this.defaultQueryOptions(t);void 0===e.retry&&(e.retry=!1);let s=this.#h.build(this,e);return s.isStaleByTime((0,i.KC)(e.staleTime,s))?s.fetch(e):Promise.resolve(s.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(i.ZT).catch(i.ZT)}fetchInfiniteQuery(t){return t.behavior=f(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(i.ZT).catch(i.ZT)}ensureInfiniteQueryData(t){return t.behavior=f(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return d.N.isOnline()?this.#s.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#h}getMutationCache(){return this.#s}getDefaultOptions(){return this.#c}setDefaultOptions(t){this.#c=t}setQueryDefaults(t,e){this.#l.set((0,i.Ym)(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){let e=[...this.#l.values()],s={};return e.forEach(e=>{(0,i.to)(t,e.queryKey)&&Object.assign(s,e.defaultOptions)}),s}setMutationDefaults(t,e){this.#d.set((0,i.Ym)(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){let e=[...this.#d.values()],s={};return e.forEach(e=>{(0,i.to)(t,e.mutationKey)&&Object.assign(s,e.defaultOptions)}),s}defaultQueryOptions(t){if(t._defaulted)return t;let e={...this.#c.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=(0,i.Rm)(e.queryKey,e)),void 0===e.refetchOnReconnect&&(e.refetchOnReconnect="always"!==e.networkMode),void 0===e.throwOnError&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===i.CN&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#c.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#h.clear(),this.#s.clear()}}},21770:function(t,e,s){s.d(e,{D:function(){return c}});var i=s(2265),r=s(2894),a=s(18238),n=s(24112),u=s(45345),o=class extends n.l{#t;#m=void 0;#g;#b;constructor(t,e){super(),this.#t=t,this.setOptions(e),this.bindMethods(),this.#v()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){let e=this.options;this.options=this.#t.defaultMutationOptions(t),(0,u.VS)(this.options,e)||this.#t.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#g,observer:this}),e?.mutationKey&&this.options.mutationKey&&(0,u.Ym)(e.mutationKey)!==(0,u.Ym)(this.options.mutationKey)?this.reset():this.#g?.state.status==="pending"&&this.#g.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#g?.removeObserver(this)}onMutationUpdate(t){this.#v(),this.#C(t)}getCurrentResult(){return this.#m}reset(){this.#g?.removeObserver(this),this.#g=void 0,this.#v(),this.#C()}mutate(t,e){return this.#b=e,this.#g?.removeObserver(this),this.#g=this.#t.getMutationCache().build(this.#t,this.options),this.#g.addObserver(this),this.#g.execute(t)}#v(){let t=this.#g?.state??(0,r.R)();this.#m={...t,isPending:"pending"===t.status,isSuccess:"success"===t.status,isError:"error"===t.status,isIdle:"idle"===t.status,mutate:this.mutate,reset:this.reset}}#C(t){a.Vr.batch(()=>{if(this.#b&&this.hasListeners()){let e=this.#m.variables,s=this.#m.context,i={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};t?.type==="success"?(this.#b.onSuccess?.(t.data,e,s,i),this.#b.onSettled?.(t.data,null,e,s,i)):t?.type==="error"&&(this.#b.onError?.(t.error,e,s,i),this.#b.onSettled?.(void 0,t.error,e,s,i))}this.listeners.forEach(t=>{t(this.#m)})})}},h=s(29827);function c(t,e){let s=(0,h.NL)(e),[r]=i.useState(()=>new o(s,t));i.useEffect(()=>{r.setOptions(t)},[r,t]);let n=i.useSyncExternalStore(i.useCallback(t=>r.subscribe(a.Vr.batchCalls(t)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),c=i.useCallback((t,e)=>{r.mutate(t,e).catch(u.ZT)},[r]);if(n.error&&(0,u.L3)(r.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:c,mutateAsync:n.mutate}}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/395-053deae1a24be648.js b/litellm/proxy/_experimental/out/_next/static/chunks/395-053deae1a24be648.js deleted file mode 100644 index e539be305fa..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/395-053deae1a24be648.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[395],{34310:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});var n=r(1119),i=r(2265),s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM472 744a40 40 0 1080 0 40 40 0 10-80 0zm16-104h48c4.4 0 8-3.6 8-8V448c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v184c0 4.4 3.6 8 8 8z"}}]},name:"file-exclamation",theme:"outlined"},o=r(55015),a=i.forwardRef(function(e,t){return i.createElement(o.Z,(0,n.Z)({},e,{ref:t,icon:s}))})},38434:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});var n=r(1119),i=r(2265),s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z"}}]},name:"file-text",theme:"outlined"},o=r(55015),a=i.forwardRef(function(e,t){return i.createElement(o.Z,(0,n.Z)({},e,{ref:t,icon:s}))})},3632:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});var n=r(1119),i=r(2265),s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"},o=r(55015),a=i.forwardRef(function(e,t){return i.createElement(o.Z,(0,n.Z)({},e,{ref:t,icon:s}))})},35291:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});var n=r(1119),i=r(2265),s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M464 720a48 48 0 1096 0 48 48 0 10-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z"}}]},name:"warning",theme:"outlined"},o=r(55015),a=i.forwardRef(function(e,t){return i.createElement(o.Z,(0,n.Z)({},e,{ref:t,icon:s}))})},79205:function(e,t,r){"use strict";r.d(t,{Z:function(){return f}});var n=r(2265);let i=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase()),o=e=>{let t=s(e);return t.charAt(0).toUpperCase()+t.slice(1)},a=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim()},u=e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};var c={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let l=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:i=24,strokeWidth:s=2,absoluteStrokeWidth:o,className:l="",children:f,iconNode:h,...d}=e;return(0,n.createElement)("svg",{ref:t,...c,width:i,height:i,stroke:r,strokeWidth:o?24*Number(s)/Number(i):s,className:a("lucide",l),...!f&&!u(d)&&{"aria-hidden":"true"},...d},[...h.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(f)?f:[f]])}),f=(e,t)=>{let r=(0,n.forwardRef)((r,s)=>{let{className:u,...c}=r;return(0,n.createElement)(l,{ref:s,iconNode:t,className:a("lucide-".concat(i(o(e))),"lucide-".concat(e),u),...c})});return r.displayName=o(e),r}},30401:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},78867:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},15452:function(e,t){var r,n,i;n=[],void 0!==(i="function"==typeof(r=function e(){var t,r="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==r?r:{},n=!r.document&&!!r.postMessage,i=r.IS_PAPA_WORKER||!1,s={},o=0,a={};function u(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(e){var t=v(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new d(t),(this._handle.streamer=this)._config=t}).call(this,e),this.parseChunk=function(e,t){var n=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0=this._config.preview,i)r.postMessage({results:s,workerId:a.WORKER_ID,finished:n});else if(k(this._config.chunk)&&!t){if(this._config.chunk(s,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=s=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(s.data),this._completeResults.errors=this._completeResults.errors.concat(s.errors),this._completeResults.meta=s.meta),this._completed||!n||!k(this._config.complete)||s&&s.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),n||s&&s.meta.paused||this._nextChunk(),s}this._halted=!0},this._sendError=function(e){k(this._config.error)?this._config.error(e):i&&this._config.error&&r.postMessage({workerId:a.WORKER_ID,error:e,finished:!1})}}function c(e){var t;(e=e||{}).chunkSize||(e.chunkSize=a.RemoteChunkSize),u.call(this,e),this._nextChunk=n?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),n||(t.onload=b(this._chunkLoaded,this),t.onerror=b(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!n),this._config.downloadRequestHeaders){var e,r,i=this._config.downloadRequestHeaders;for(r in i)t.setRequestHeader(r,i[r])}this._config.chunkSize&&(e=this._start+this._config.chunkSize-1,t.setRequestHeader("Range","bytes="+this._start+"-"+e));try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}n&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){let e;4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize||t.responseText.length,this._finished=!this._config.chunkSize||this._start>=(null!==(e=(e=t).getResponseHeader("Content-Range"))?parseInt(e.substring(e.lastIndexOf("/")+1)):-1),this.parseChunk(t.responseText)))},this._chunkError=function(e){e=t.statusText||e,this._sendError(Error(e))}}function l(e){(e=e||{}).chunkSize||(e.chunkSize=a.LocalChunkSize),u.call(this,e);var t,r,n="undefined"!=typeof FileReader;this.stream=function(e){this._input=e,r=e.slice||e.webkitSlice||e.mozSlice,n?((t=new FileReader).onload=b(this._chunkLoaded,this),t.onerror=b(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function f(e){var t;u.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){var e,r;if(!this._finished)return t=(e=this._config.chunkSize)?(r=t.substring(0,e),t.substring(e)):(r=t,""),this._finished=!t,this.parseChunk(r)}}function h(e){u.call(this,e=e||{});var t=[],r=!0,n=!1;this.pause=function(){u.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){u.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){n&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):r=!0},this._streamData=b(function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),r&&(r=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}},this),this._streamError=b(function(e){this._streamCleanUp(),this._sendError(e)},this),this._streamEnd=b(function(){this._streamCleanUp(),n=!0,this._streamData("")},this),this._streamCleanUp=b(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function d(e){var t,r,n,i,s=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,o=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,u=this,c=0,l=0,f=!1,h=!1,d=[],m={data:[],errors:[],meta:{}};function _(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function y(){if(m&&n&&(w("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+a.DefaultDelimiter+"'"),n=!1),e.skipEmptyLines&&(m.data=m.data.filter(function(e){return!_(e)})),b()){if(m){if(Array.isArray(m.data[0])){for(var t,r=0;b()&&r=d.length?"__parsed_extra":d[i]:a,c=u=e.transform?e.transform(u,a):u,(e.dynamicTypingFunction&&void 0===e.dynamicTyping[r]&&(e.dynamicTyping[r]=e.dynamicTypingFunction(r)),!0===(e.dynamicTyping[r]||e.dynamicTyping))?"true"===c||"TRUE"===c||"false"!==c&&"FALSE"!==c&&((e=>{if(s.test(e)&&-9007199254740992<(e=parseFloat(e))&&e<9007199254740992)return 1})(c)?parseFloat(c):o.test(c)?new Date(c):""===c?null:c):c);"__parsed_extra"===a?(n[a]=n[a]||[],n[a].push(u)):n[a]=u}return e.header&&(i>d.length?w("FieldMismatch","TooManyFields","Too many fields: expected "+d.length+" fields but parsed "+i,l+r):ie.preview?r.abort():(m.data=m.data[0],i(m,u))))}),this.parse=function(i,s,o){var u=e.quoteChar||'"',u=(e.newline||(e.newline=this.guessLineEndings(i,u)),n=!1,e.delimiter?k(e.delimiter)&&(e.delimiter=e.delimiter(i),m.meta.delimiter=e.delimiter):((u=((t,r,n,i,s)=>{var o,u,c,l;s=s||[","," ","|",";",a.RECORD_SEP,a.UNIT_SEP];for(var f=0;f=r.length/2?"\r\n":"\r"}}function p(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function g(e){var t=(e=e||{}).delimiter,r=e.newline,n=e.comments,i=e.step,s=e.preview,o=e.fastMode,u=null,c=!1,l=null==e.quoteChar?'"':e.quoteChar,f=l;if(void 0!==e.escapeChar&&(f=e.escapeChar),("string"!=typeof t||-1=s)return F(!0);break}C.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:E.length,index:h}),T++}}else if(n&&0===O.length&&a.substring(h,h+b)===n){if(-1===L)return F();h=L+v,L=a.indexOf(r,h),j=a.indexOf(t,h)}else if(-1!==j&&(j=s)return F(!0)}return P();function D(e){E.push(e),R=h}function z(e){return -1!==e&&(e=a.substring(T+1,e))&&""===e.trim()?e.length:0}function P(e){return m||(void 0===e&&(e=a.substring(h)),O.push(e),h=_,D(O),w&&Z()),F()}function M(e){h=e,D(O),O=[],L=a.indexOf(r,h)}function F(n){if(e.header&&!g&&E.length&&!c){var i=E[0],s=Object.create(null),o=new Set(i);let t=!1;for(let r=0;r{if("object"==typeof t){if("string"!=typeof t.delimiter||a.BAD_DELIMITERS.filter(function(e){return -1!==t.delimiter.indexOf(e)}).length||(i=t.delimiter),("boolean"==typeof t.quotes||"function"==typeof t.quotes||Array.isArray(t.quotes))&&(r=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(c=t.skipEmptyLines),"string"==typeof t.newline&&(s=t.newline),"string"==typeof t.quoteChar&&(o=t.quoteChar),"boolean"==typeof t.header&&(n=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw Error("Option columns is empty");l=t.columns}void 0!==t.escapeChar&&(u=t.escapeChar+o),t.escapeFormulae instanceof RegExp?f=t.escapeFormulae:"boolean"==typeof t.escapeFormulae&&t.escapeFormulae&&(f=/^[=+\-@\t\r].*$/)}})(),RegExp(p(o),"g"));if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return d(null,e,c);if("object"==typeof e[0])return d(l||Object.keys(e[0]),e,c)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||l),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),d(e.fields||[],e.data||[],c);throw Error("Unable to serialize unrecognized input");function d(e,t,r){var o="",a=("string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t)),Array.isArray(e)&&0{for(var r=0;r=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(e,o),n=i.default.Children.only(t);return i.default.cloneElement(n,c(c({},r),{},{onClick:this.onClick}))}}],function(e,t){for(var r=0;r{let t=n.useContext(s);if(e)return e;if(!t)throw Error("No QueryClient set, use QueryClientProvider to set one");return t},a=e=>{let{client:t,children:r}=e;return n.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),(0,i.jsx)(s.Provider,{value:t,children:r})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/8541-04c822145b2301f8.js b/litellm/proxy/_experimental/out/_next/static/chunks/4073-c83ea30de699cedc.js similarity index 80% rename from litellm/proxy/_experimental/out/_next/static/chunks/8541-04c822145b2301f8.js rename to litellm/proxy/_experimental/out/_next/static/chunks/4073-c83ea30de699cedc.js index 42d2abebd51..df0ede750e0 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/8541-04c822145b2301f8.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/4073-c83ea30de699cedc.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8541,5945],{45246:function(e,t,n){n.d(t,{Z:function(){return c}});var o=n(1119),a=n(2265),r={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M696 480H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h368c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"minus-circle",theme:"outlined"},i=n(55015),c=a.forwardRef(function(e,t){return a.createElement(i.Z,(0,o.Z)({},e,{ref:t,icon:r}))})},89245:function(e,t,n){n.d(t,{Z:function(){return c}});var o=n(1119),a=n(2265),r={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 00-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 01655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 01279 755.2a342.16 342.16 0 01-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 01109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z"}}]},name:"reload",theme:"outlined"},i=n(55015),c=a.forwardRef(function(e,t){return a.createElement(i.Z,(0,o.Z)({},e,{ref:t,icon:r}))})},78355:function(e,t,n){n.d(t,{Z:function(){return c}});var o=n(1119),a=n(2265),r={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M893.3 293.3L730.7 130.7c-7.5-7.5-16.7-13-26.7-16V112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V338.5c0-17-6.7-33.2-18.7-45.2zM384 184h256v104H384V184zm456 656H184V184h136v136c0 17.7 14.3 32 32 32h320c17.7 0 32-14.3 32-32V205.8l136 136V840zM512 442c-79.5 0-144 64.5-144 144s64.5 144 144 144 144-64.5 144-144-64.5-144-144-144zm0 224c-44.2 0-80-35.8-80-80s35.8-80 80-80 80 35.8 80 80-35.8 80-80 80z"}}]},name:"save",theme:"outlined"},i=n(55015),c=a.forwardRef(function(e,t){return a.createElement(i.Z,(0,o.Z)({},e,{ref:t,icon:r}))})},8881:function(e,t,n){n.d(t,{Z:function(){return c}});var o=n(1119),a=n(2265),r={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372 0-89 31.3-170.8 83.5-234.8l523.3 523.3C682.8 852.7 601 884 512 884zm288.5-137.2L277.2 223.5C341.2 171.3 423 140 512 140c205.4 0 372 166.6 372 372 0 89-31.3 170.8-83.5 234.8z"}}]},name:"stop",theme:"outlined"},i=n(55015),c=a.forwardRef(function(e,t){return a.createElement(i.Z,(0,o.Z)({},e,{ref:t,icon:r}))})},3632:function(e,t,n){n.d(t,{Z:function(){return c}});var o=n(1119),a=n(2265),r={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"},i=n(55015),c=a.forwardRef(function(e,t){return a.createElement(i.Z,(0,o.Z)({},e,{ref:t,icon:r}))})},35291:function(e,t,n){n.d(t,{Z:function(){return c}});var o=n(1119),a=n(2265),r={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M464 720a48 48 0 1096 0 48 48 0 10-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z"}}]},name:"warning",theme:"outlined"},i=n(55015),c=a.forwardRef(function(e,t){return a.createElement(i.Z,(0,o.Z)({},e,{ref:t,icon:r}))})},59664:function(e,t,n){n.d(t,{Z:function(){return C}});var o=n(5853),a=n(2265),r=n(47625),i=n(93765),c=n(54061),l=n(97059),s=n(62994),d=n(25311),u=(0,i.z)({chartName:"LineChart",GraphicalChild:c.x,axisComponents:[{axisType:"xAxis",AxisComp:l.K},{axisType:"yAxis",AxisComp:s.B}],formatAxisMap:d.t9}),m=n(56940),b=n(26680),f=n(8147),p=n(22190),g=n(81889),h=n(65278),v=n(98593),y=n(92666),x=n(32644),k=n(7084),w=n(26898),O=n(13241),E=n(1153);let C=a.forwardRef((e,t)=>{let{data:n=[],categories:i=[],index:d,colors:C=w.s,valueFormatter:S=E.Cj,startEndOnly:j=!1,showXAxis:N=!0,showYAxis:z=!0,yAxisWidth:L=56,intervalType:T="equidistantPreserveStart",animationDuration:Z=900,showAnimation:P=!1,showTooltip:M=!0,showLegend:R=!0,showGridLines:I=!0,autoMinValue:B=!1,curveType:W="linear",minValue:D,maxValue:H,connectNulls:A=!1,allowDecimals:F=!0,noDataText:q,className:G,onValueChange:K,enableLegendSlider:V=!1,customTooltip:_,rotateLabelX:X,padding:Y=N||z?{left:20,right:20}:{left:0,right:0},tickGap:$=5,xAxisLabel:Q,yAxisLabel:U}=e,J=(0,o._T)(e,["data","categories","index","colors","valueFormatter","startEndOnly","showXAxis","showYAxis","yAxisWidth","intervalType","animationDuration","showAnimation","showTooltip","showLegend","showGridLines","autoMinValue","curveType","minValue","maxValue","connectNulls","allowDecimals","noDataText","className","onValueChange","enableLegendSlider","customTooltip","rotateLabelX","padding","tickGap","xAxisLabel","yAxisLabel"]),[ee,et]=(0,a.useState)(60),[en,eo]=(0,a.useState)(void 0),[ea,er]=(0,a.useState)(void 0),ei=(0,x.me)(i,C),ec=(0,x.i4)(B,D,H),el=!!K;function es(e){el&&(e===ea&&!en||(0,x.FB)(n,e)&&en&&en.dataKey===e?(er(void 0),null==K||K(null)):(er(e),null==K||K({eventType:"category",categoryClicked:e})),eo(void 0))}return a.createElement("div",Object.assign({ref:t,className:(0,O.q)("w-full h-80",G)},J),a.createElement(r.h,{className:"h-full w-full"},(null==n?void 0:n.length)?a.createElement(u,{data:n,onClick:el&&(ea||en)?()=>{eo(void 0),er(void 0),null==K||K(null)}:void 0,margin:{bottom:Q?30:void 0,left:U?20:void 0,right:U?5:void 0,top:5}},I?a.createElement(m.q,{className:(0,O.q)("stroke-1","stroke-tremor-border","dark:stroke-dark-tremor-border"),horizontal:!0,vertical:!1}):null,a.createElement(l.K,{padding:Y,hide:!N,dataKey:d,interval:j?"preserveStartEnd":T,tick:{transform:"translate(0, 6)"},ticks:j?[n[0][d],n[n.length-1][d]]:void 0,fill:"",stroke:"",className:(0,O.q)("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickLine:!1,axisLine:!1,minTickGap:$,angle:null==X?void 0:X.angle,dy:null==X?void 0:X.verticalShift,height:null==X?void 0:X.xAxisHeight},Q&&a.createElement(b._,{position:"insideBottom",offset:-20,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},Q)),a.createElement(s.B,{width:L,hide:!z,axisLine:!1,tickLine:!1,type:"number",domain:ec,tick:{transform:"translate(-3, 0)"},fill:"",stroke:"",className:(0,O.q)("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickFormatter:S,allowDecimals:F},U&&a.createElement(b._,{position:"insideLeft",style:{textAnchor:"middle"},angle:-90,offset:-15,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},U)),a.createElement(f.u,{wrapperStyle:{outline:"none"},isAnimationActive:!1,cursor:{stroke:"#d1d5db",strokeWidth:1},content:M?e=>{let{active:t,payload:n,label:o}=e;return _?a.createElement(_,{payload:null==n?void 0:n.map(e=>{var t;return Object.assign(Object.assign({},e),{color:null!==(t=ei.get(e.dataKey))&&void 0!==t?t:k.fr.Gray})}),active:t,label:o}):a.createElement(v.ZP,{active:t,payload:n,label:o,valueFormatter:S,categoryColors:ei})}:a.createElement(a.Fragment,null),position:{y:0}}),R?a.createElement(p.D,{verticalAlign:"top",height:ee,content:e=>{let{payload:t}=e;return(0,h.Z)({payload:t},ei,et,ea,el?e=>es(e):void 0,V)}}):null,i.map(e=>{var t;return a.createElement(c.x,{className:(0,O.q)((0,E.bM)(null!==(t=ei.get(e))&&void 0!==t?t:k.fr.Gray,w.K.text).strokeColor),strokeOpacity:en||ea&&ea!==e?.3:1,activeDot:e=>{var t;let{cx:o,cy:r,stroke:i,strokeLinecap:c,strokeLinejoin:l,strokeWidth:s,dataKey:d}=e;return a.createElement(g.o,{className:(0,O.q)("stroke-tremor-background dark:stroke-dark-tremor-background",K?"cursor-pointer":"",(0,E.bM)(null!==(t=ei.get(d))&&void 0!==t?t:k.fr.Gray,w.K.text).fillColor),cx:o,cy:r,r:5,fill:"",stroke:i,strokeLinecap:c,strokeLinejoin:l,strokeWidth:s,onClick:(t,o)=>{o.stopPropagation(),el&&(e.index===(null==en?void 0:en.index)&&e.dataKey===(null==en?void 0:en.dataKey)||(0,x.FB)(n,e.dataKey)&&ea&&ea===e.dataKey?(er(void 0),eo(void 0),null==K||K(null)):(er(e.dataKey),eo({index:e.index,dataKey:e.dataKey}),null==K||K(Object.assign({eventType:"dot",categoryClicked:e.dataKey},e.payload))))}})},dot:t=>{var o;let{stroke:r,strokeLinecap:i,strokeLinejoin:c,strokeWidth:l,cx:s,cy:d,dataKey:u,index:m}=t;return(0,x.FB)(n,e)&&!(en||ea&&ea!==e)||(null==en?void 0:en.index)===m&&(null==en?void 0:en.dataKey)===e?a.createElement(g.o,{key:m,cx:s,cy:d,r:5,stroke:r,fill:"",strokeLinecap:i,strokeLinejoin:c,strokeWidth:l,className:(0,O.q)("stroke-tremor-background dark:stroke-dark-tremor-background",K?"cursor-pointer":"",(0,E.bM)(null!==(o=ei.get(u))&&void 0!==o?o:k.fr.Gray,w.K.text).fillColor)}):a.createElement(a.Fragment,{key:m})},key:e,name:e,type:W,dataKey:e,stroke:"",strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",isAnimationActive:P,animationDuration:Z,connectNulls:A})}),K?i.map(e=>a.createElement(c.x,{className:(0,O.q)("cursor-pointer"),strokeOpacity:0,key:e,name:e,type:W,dataKey:e,stroke:"transparent",fill:"transparent",legendType:"none",tooltipType:"none",strokeWidth:12,connectNulls:A,onClick:(e,t)=>{t.stopPropagation();let{name:n}=e;es(n)}})):null):a.createElement(y.Z,{noDataText:q})))});C.displayName="LineChart"},59341:function(e,t,n){n.d(t,{Z:function(){return Z}});var o=n(5853),a=n(71049),r=n(11323),i=n(2265),c=n(66797),l=n(40099),s=n(74275),d=n(59456),u=n(93980),m=n(65573),b=n(67561),f=n(87550),p=n(628),g=n(80281),h=n(31370),v=n(20131),y=n(38929),x=n(52307),k=n(52724),w=n(7935);let O=(0,i.createContext)(null);O.displayName="GroupContext";let E=i.Fragment,C=Object.assign((0,y.yV)(function(e,t){var n;let o=(0,i.useId)(),E=(0,g.Q)(),C=(0,f.B)(),{id:S=E||"headlessui-switch-".concat(o),disabled:j=C||!1,checked:N,defaultChecked:z,onChange:L,name:T,value:Z,form:P,autoFocus:M=!1,...R}=e,I=(0,i.useContext)(O),[B,W]=(0,i.useState)(null),D=(0,i.useRef)(null),H=(0,b.T)(D,t,null===I?null:I.setSwitch,W),A=(0,s.L)(z),[F,q]=(0,l.q)(N,L,null!=A&&A),G=(0,d.G)(),[K,V]=(0,i.useState)(!1),_=(0,u.z)(()=>{V(!0),null==q||q(!F),G.nextFrame(()=>{V(!1)})}),X=(0,u.z)(e=>{if((0,h.P)(e.currentTarget))return e.preventDefault();e.preventDefault(),_()}),Y=(0,u.z)(e=>{e.key===k.R.Space?(e.preventDefault(),_()):e.key===k.R.Enter&&(0,v.g)(e.currentTarget)}),$=(0,u.z)(e=>e.preventDefault()),Q=(0,w.wp)(),U=(0,x.zH)(),{isFocusVisible:J,focusProps:ee}=(0,a.F)({autoFocus:M}),{isHovered:et,hoverProps:en}=(0,r.X)({isDisabled:j}),{pressed:eo,pressProps:ea}=(0,c.x)({disabled:j}),er=(0,i.useMemo)(()=>({checked:F,disabled:j,hover:et,focus:J,active:eo,autofocus:M,changing:K}),[F,et,J,eo,j,K,M]),ei=(0,y.dG)({id:S,ref:H,role:"switch",type:(0,m.f)(e,B),tabIndex:-1===e.tabIndex?0:null!=(n=e.tabIndex)?n:0,"aria-checked":F,"aria-labelledby":Q,"aria-describedby":U,disabled:j||void 0,autoFocus:M,onClick:X,onKeyUp:Y,onKeyPress:$},ee,en,ea),ec=(0,i.useCallback)(()=>{if(void 0!==A)return null==q?void 0:q(A)},[q,A]),el=(0,y.L6)();return i.createElement(i.Fragment,null,null!=T&&i.createElement(p.Mt,{disabled:j,data:{[T]:Z||"on"},overrides:{type:"checkbox",checked:F},form:P,onReset:ec}),el({ourProps:ei,theirProps:R,slot:er,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var t;let[n,o]=(0,i.useState)(null),[a,r]=(0,w.bE)(),[c,l]=(0,x.fw)(),s=(0,i.useMemo)(()=>({switch:n,setSwitch:o}),[n,o]),d=(0,y.L6)();return i.createElement(l,{name:"Switch.Description",value:c},i.createElement(r,{name:"Switch.Label",value:a,props:{htmlFor:null==(t=s.switch)?void 0:t.id,onClick(e){n&&(e.currentTarget instanceof HTMLLabelElement&&e.preventDefault(),n.click(),n.focus({preventScroll:!0}))}}},i.createElement(O.Provider,{value:s},d({ourProps:{},theirProps:e,slot:{},defaultTag:E,name:"Switch.Group"}))))},Label:w.__,Description:x.dk});var S=n(44140),j=n(26898),N=n(13241),z=n(1153),L=n(47187);let T=(0,z.fn)("Switch"),Z=i.forwardRef((e,t)=>{let{checked:n,defaultChecked:a=!1,onChange:r,color:c,name:l,error:s,errorMessage:d,disabled:u,required:m,tooltip:b,id:f}=e,p=(0,o._T)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),g={bgColor:c?(0,z.bM)(c,j.K.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:c?(0,z.bM)(c,j.K.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[h,v]=(0,S.Z)(a,n),[y,x]=(0,i.useState)(!1),{tooltipProps:k,getReferenceProps:w}=(0,L.l)(300);return i.createElement("div",{className:"flex flex-row items-center justify-start"},i.createElement(L.Z,Object.assign({text:b},k)),i.createElement("div",Object.assign({ref:(0,z.lq)([t,k.refs.setReference]),className:(0,N.q)(T("root"),"flex flex-row relative h-5")},p,w),i.createElement("input",{type:"checkbox",className:(0,N.q)(T("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:l,required:m,checked:h,onChange:e=>{e.preventDefault()}}),i.createElement(C,{checked:h,onChange:e=>{v(e),null==r||r(e)},disabled:u,className:(0,N.q)(T("switch"),"w-10 h-5 group relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-tremor-full","focus:outline-none",u?"cursor-not-allowed":""),onFocus:()=>x(!0),onBlur:()=>x(!1),id:f},i.createElement("span",{className:(0,N.q)(T("sr-only"),"sr-only")},"Switch ",h?"on":"off"),i.createElement("span",{"aria-hidden":"true",className:(0,N.q)(T("background"),h?g.bgColor:"bg-tremor-border dark:bg-dark-tremor-border","pointer-events-none absolute mx-auto h-3 w-9 rounded-tremor-full transition-colors duration-100 ease-in-out")}),i.createElement("span",{"aria-hidden":"true",className:(0,N.q)(T("round"),h?(0,N.q)(g.bgColor,"translate-x-5 border-tremor-background dark:border-dark-tremor-background"):"translate-x-0 bg-tremor-border dark:bg-dark-tremor-border border-tremor-background dark:border-dark-tremor-background","pointer-events-none absolute left-0 inline-block h-5 w-5 transform rounded-tremor-full border-2 shadow-tremor-input duration-100 ease-in-out transition",y?(0,N.q)("ring-2",g.ringColor):"")}))),s&&d?i.createElement("p",{className:(0,N.q)(T("errorMessage"),"text-sm text-red-500 mt-1 ")},d):null)});Z.displayName="Switch"},33866:function(e,t,n){n.d(t,{Z:function(){return P}});var o=n(2265),a=n(36760),r=n.n(a),i=n(66632),c=n(93350),l=n(19722),s=n(71744),d=n(93463),u=n(12918),m=n(18536),b=n(71140),f=n(99320);let p=new d.E4("antStatusProcessing",{"0%":{transform:"scale(0.8)",opacity:.5},"100%":{transform:"scale(2.4)",opacity:0}}),g=new d.E4("antZoomBadgeIn",{"0%":{transform:"scale(0) translate(50%, -50%)",opacity:0},"100%":{transform:"scale(1) translate(50%, -50%)"}}),h=new d.E4("antZoomBadgeOut",{"0%":{transform:"scale(1) translate(50%, -50%)"},"100%":{transform:"scale(0) translate(50%, -50%)",opacity:0}}),v=new d.E4("antNoWrapperZoomBadgeIn",{"0%":{transform:"scale(0)",opacity:0},"100%":{transform:"scale(1)"}}),y=new d.E4("antNoWrapperZoomBadgeOut",{"0%":{transform:"scale(1)"},"100%":{transform:"scale(0)",opacity:0}}),x=new d.E4("antBadgeLoadingCircle",{"0%":{transformOrigin:"50%"},"100%":{transform:"translate(50%, -50%) rotate(360deg)",transformOrigin:"50%"}}),k=e=>{let{componentCls:t,iconCls:n,antCls:o,badgeShadowSize:a,textFontSize:r,textFontSizeSM:i,statusSize:c,dotSize:l,textFontWeight:s,indicatorHeight:b,indicatorHeightSM:f,marginXS:k,calc:w}=e,O="".concat(o,"-scroll-number"),E=(0,m.Z)(e,(e,n)=>{let{darkColor:o}=n;return{["&".concat(t," ").concat(t,"-color-").concat(e)]:{background:o,["&:not(".concat(t,"-count)")]:{color:o},"a:hover &":{background:o}}}});return{[t]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,u.Wf)(e)),{position:"relative",display:"inline-block",width:"fit-content",lineHeight:1,["".concat(t,"-count")]:{display:"inline-flex",justifyContent:"center",zIndex:e.indicatorZIndex,minWidth:b,height:b,color:e.badgeTextColor,fontWeight:s,fontSize:r,lineHeight:(0,d.bf)(b),whiteSpace:"nowrap",textAlign:"center",background:e.badgeColor,borderRadius:w(b).div(2).equal(),boxShadow:"0 0 0 ".concat((0,d.bf)(a)," ").concat(e.badgeShadowColor),transition:"background ".concat(e.motionDurationMid),a:{color:e.badgeTextColor},"a:hover":{color:e.badgeTextColor},"a:hover &":{background:e.badgeColorHover}},["".concat(t,"-count-sm")]:{minWidth:f,height:f,fontSize:i,lineHeight:(0,d.bf)(f),borderRadius:w(f).div(2).equal()},["".concat(t,"-multiple-words")]:{padding:"0 ".concat((0,d.bf)(e.paddingXS)),bdi:{unicodeBidi:"plaintext"}},["".concat(t,"-dot")]:{zIndex:e.indicatorZIndex,width:l,minWidth:l,height:l,background:e.badgeColor,borderRadius:"100%",boxShadow:"0 0 0 ".concat((0,d.bf)(a)," ").concat(e.badgeShadowColor)},["".concat(t,"-count, ").concat(t,"-dot, ").concat(O,"-custom-component")]:{position:"absolute",top:0,insetInlineEnd:0,transform:"translate(50%, -50%)",transformOrigin:"100% 0%",["&".concat(n,"-spin")]:{animationName:x,animationDuration:"1s",animationIterationCount:"infinite",animationTimingFunction:"linear"}},["&".concat(t,"-status")]:{lineHeight:"inherit",verticalAlign:"baseline",["".concat(t,"-status-dot")]:{position:"relative",top:-1,display:"inline-block",width:c,height:c,verticalAlign:"middle",borderRadius:"50%"},["".concat(t,"-status-success")]:{backgroundColor:e.colorSuccess},["".concat(t,"-status-processing")]:{overflow:"visible",color:e.colorInfo,backgroundColor:e.colorInfo,borderColor:"currentcolor","&::after":{position:"absolute",top:0,insetInlineStart:0,width:"100%",height:"100%",borderWidth:a,borderStyle:"solid",borderColor:"inherit",borderRadius:"50%",animationName:p,animationDuration:e.badgeProcessingDuration,animationIterationCount:"infinite",animationTimingFunction:"ease-in-out",content:'""'}},["".concat(t,"-status-default")]:{backgroundColor:e.colorTextPlaceholder},["".concat(t,"-status-error")]:{backgroundColor:e.colorError},["".concat(t,"-status-warning")]:{backgroundColor:e.colorWarning},["".concat(t,"-status-text")]:{marginInlineStart:k,color:e.colorText,fontSize:e.fontSize}}}),E),{["".concat(t,"-zoom-appear, ").concat(t,"-zoom-enter")]:{animationName:g,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack,animationFillMode:"both"},["".concat(t,"-zoom-leave")]:{animationName:h,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack,animationFillMode:"both"},["&".concat(t,"-not-a-wrapper")]:{["".concat(t,"-zoom-appear, ").concat(t,"-zoom-enter")]:{animationName:v,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack},["".concat(t,"-zoom-leave")]:{animationName:y,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack},["&:not(".concat(t,"-status)")]:{verticalAlign:"middle"},["".concat(O,"-custom-component, ").concat(t,"-count")]:{transform:"none"},["".concat(O,"-custom-component, ").concat(O)]:{position:"relative",top:"auto",display:"block",transformOrigin:"50% 50%"}},[O]:{overflow:"hidden",transition:"all ".concat(e.motionDurationMid," ").concat(e.motionEaseOutBack),["".concat(O,"-only")]:{position:"relative",display:"inline-block",height:b,transition:"all ".concat(e.motionDurationSlow," ").concat(e.motionEaseOutBack),WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden",["> p".concat(O,"-only-unit")]:{height:b,margin:0,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden"}},["".concat(O,"-symbol")]:{verticalAlign:"top"}},"&-rtl":{direction:"rtl",["".concat(t,"-count, ").concat(t,"-dot, ").concat(O,"-custom-component")]:{transform:"translate(-50%, -50%)"}}})}},w=e=>{let{fontHeight:t,lineWidth:n,marginXS:o,colorBorderBg:a}=e,r=e.colorTextLightSolid,i=e.colorError,c=e.colorErrorHover;return(0,b.IX)(e,{badgeFontHeight:t,badgeShadowSize:n,badgeTextColor:r,badgeColor:i,badgeColorHover:c,badgeShadowColor:a,badgeProcessingDuration:"1.2s",badgeRibbonOffset:o,badgeRibbonCornerTransform:"scaleY(0.75)",badgeRibbonCornerFilter:"brightness(75%)"})},O=e=>{let{fontSize:t,lineHeight:n,fontSizeSM:o,lineWidth:a}=e;return{indicatorZIndex:"auto",indicatorHeight:Math.round(t*n)-2*a,indicatorHeightSM:t,dotSize:o/2,textFontSize:o,textFontSizeSM:o,textFontWeight:"normal",statusSize:o/2}};var E=(0,f.I$)("Badge",e=>k(w(e)),O);let C=e=>{let{antCls:t,badgeFontHeight:n,marginXS:o,badgeRibbonOffset:a,calc:r}=e,i="".concat(t,"-ribbon"),c=(0,m.Z)(e,(e,t)=>{let{darkColor:n}=t;return{["&".concat(i,"-color-").concat(e)]:{background:n,color:n}}});return{["".concat(t,"-ribbon-wrapper")]:{position:"relative"},[i]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,u.Wf)(e)),{position:"absolute",top:o,padding:"0 ".concat((0,d.bf)(e.paddingXS)),color:e.colorPrimary,lineHeight:(0,d.bf)(n),whiteSpace:"nowrap",backgroundColor:e.colorPrimary,borderRadius:e.borderRadiusSM,["".concat(i,"-text")]:{color:e.badgeTextColor},["".concat(i,"-corner")]:{position:"absolute",top:"100%",width:a,height:a,color:"currentcolor",border:"".concat((0,d.bf)(r(a).div(2).equal())," solid"),transform:e.badgeRibbonCornerTransform,transformOrigin:"top",filter:e.badgeRibbonCornerFilter}}),c),{["&".concat(i,"-placement-end")]:{insetInlineEnd:r(a).mul(-1).equal(),borderEndEndRadius:0,["".concat(i,"-corner")]:{insetInlineEnd:0,borderInlineEndColor:"transparent",borderBlockEndColor:"transparent"}},["&".concat(i,"-placement-start")]:{insetInlineStart:r(a).mul(-1).equal(),borderEndStartRadius:0,["".concat(i,"-corner")]:{insetInlineStart:0,borderBlockEndColor:"transparent",borderInlineStartColor:"transparent"}},"&-rtl":{direction:"rtl"}})}};var S=(0,f.I$)(["Badge","Ribbon"],e=>C(w(e)),O);let j=e=>{let t;let{prefixCls:n,value:a,current:i,offset:c=0}=e;return c&&(t={position:"absolute",top:"".concat(c,"00%"),left:0}),o.createElement("span",{style:t,className:r()("".concat(n,"-only-unit"),{current:i})},a)};var N=e=>{let t,n;let{prefixCls:a,count:r,value:i}=e,c=Number(i),l=Math.abs(r),[s,d]=o.useState(c),[u,m]=o.useState(l),b=()=>{d(c),m(l)};if(o.useEffect(()=>{let e=setTimeout(b,1e3);return()=>clearTimeout(e)},[c]),s===c||Number.isNaN(c)||Number.isNaN(s))t=[o.createElement(j,Object.assign({},e,{key:c,current:!0}))],n={transition:"none"};else{t=[];let a=c+10,r=[];for(let e=c;e<=a;e+=1)r.push(e);let i=ue%10===s);t=(i<0?r.slice(0,d+1):r.slice(d)).map((t,n)=>o.createElement(j,Object.assign({},e,{key:t,value:t%10,offset:i<0?n-d:n,current:n===d}))),n={transform:"translateY(".concat(-function(e,t,n){let o=e,a=0;for(;(o+10)%10!==t;)o+=n,a+=n;return a}(s,c,i),"00%)")}}return o.createElement("span",{className:"".concat(a,"-only"),style:n,onTransitionEnd:b},t)},z=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);at.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(n[o[a]]=e[o[a]]);return n};let L=o.forwardRef((e,t)=>{let{prefixCls:n,count:a,className:i,motionClassName:c,style:d,title:u,show:m,component:b="sup",children:f}=e,p=z(e,["prefixCls","count","className","motionClassName","style","title","show","component","children"]),{getPrefixCls:g}=o.useContext(s.E_),h=g("scroll-number",n),v=Object.assign(Object.assign({},p),{"data-show":m,style:d,className:r()(h,i,c),title:u}),y=a;if(a&&Number(a)%1==0){let e=String(a).split("");y=o.createElement("bdi",null,e.map((t,n)=>o.createElement(N,{prefixCls:h,count:Number(a),value:t,key:e.length-n})))}return((null==d?void 0:d.borderColor)&&(v.style=Object.assign(Object.assign({},d),{boxShadow:"0 0 0 1px ".concat(d.borderColor," inset")})),f)?(0,l.Tm)(f,e=>({className:r()("".concat(h,"-custom-component"),null==e?void 0:e.className,c)})):o.createElement(b,Object.assign({},v,{ref:t}),y)});var T=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);at.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(n[o[a]]=e[o[a]]);return n};let Z=o.forwardRef((e,t)=>{var n,a,d,u,m;let{prefixCls:b,scrollNumberPrefixCls:f,children:p,status:g,text:h,color:v,count:y=null,overflowCount:x=99,dot:k=!1,size:w="default",title:O,offset:C,style:S,className:j,rootClassName:N,classNames:z,styles:Z,showZero:P=!1}=e,M=T(e,["prefixCls","scrollNumberPrefixCls","children","status","text","color","count","overflowCount","dot","size","title","offset","style","className","rootClassName","classNames","styles","showZero"]),{getPrefixCls:R,direction:I,badge:B}=o.useContext(s.E_),W=R("badge",b),[D,H,A]=E(W),F=y>x?"".concat(x,"+"):y,q="0"===F||0===F||"0"===h||0===h,G=null===y||q&&!P,K=(null!=g||null!=v)&&G,V=null!=g||!q,_=k&&!q,X=_?"":F,Y=(0,o.useMemo)(()=>((null==X||""===X)&&(null==h||""===h)||q&&!P)&&!_,[X,q,P,_,h]),$=(0,o.useRef)(y);Y||($.current=y);let Q=$.current,U=(0,o.useRef)(X);Y||(U.current=X);let J=U.current,ee=(0,o.useRef)(_);Y||(ee.current=_);let et=(0,o.useMemo)(()=>{if(!C)return Object.assign(Object.assign({},null==B?void 0:B.style),S);let e={marginTop:C[1]};return"rtl"===I?e.left=Number.parseInt(C[0],10):e.right=-Number.parseInt(C[0],10),Object.assign(Object.assign(Object.assign({},e),null==B?void 0:B.style),S)},[I,C,S,null==B?void 0:B.style]),en=null!=O?O:"string"==typeof Q||"number"==typeof Q?Q:void 0,eo=!Y&&(0===h?P:!!h&&!0!==h),ea=eo?o.createElement("span",{className:"".concat(W,"-status-text")},h):null,er=Q&&"object"==typeof Q?(0,l.Tm)(Q,e=>({style:Object.assign(Object.assign({},et),e.style)})):void 0,ei=(0,c.o2)(v,!1),ec=r()(null==z?void 0:z.indicator,null===(n=null==B?void 0:B.classNames)||void 0===n?void 0:n.indicator,{["".concat(W,"-status-dot")]:K,["".concat(W,"-status-").concat(g)]:!!g,["".concat(W,"-color-").concat(v)]:ei}),el={};v&&!ei&&(el.color=v,el.background=v);let es=r()(W,{["".concat(W,"-status")]:K,["".concat(W,"-not-a-wrapper")]:!p,["".concat(W,"-rtl")]:"rtl"===I},j,N,null==B?void 0:B.className,null===(a=null==B?void 0:B.classNames)||void 0===a?void 0:a.root,null==z?void 0:z.root,H,A);if(!p&&K&&(h||V||!G)){let e=et.color;return D(o.createElement("span",Object.assign({},M,{className:es,style:Object.assign(Object.assign(Object.assign({},null==Z?void 0:Z.root),null===(d=null==B?void 0:B.styles)||void 0===d?void 0:d.root),et)}),o.createElement("span",{className:ec,style:Object.assign(Object.assign(Object.assign({},null==Z?void 0:Z.indicator),null===(u=null==B?void 0:B.styles)||void 0===u?void 0:u.indicator),el)}),eo&&o.createElement("span",{style:{color:e},className:"".concat(W,"-status-text")},h)))}return D(o.createElement("span",Object.assign({ref:t},M,{className:es,style:Object.assign(Object.assign({},null===(m=null==B?void 0:B.styles)||void 0===m?void 0:m.root),null==Z?void 0:Z.root)}),p,o.createElement(i.ZP,{visible:!Y,motionName:"".concat(W,"-zoom"),motionAppear:!1,motionDeadline:1e3},e=>{var t,n;let{className:a}=e,i=R("scroll-number",f),c=ee.current,l=r()(null==z?void 0:z.indicator,null===(t=null==B?void 0:B.classNames)||void 0===t?void 0:t.indicator,{["".concat(W,"-dot")]:c,["".concat(W,"-count")]:!c,["".concat(W,"-count-sm")]:"small"===w,["".concat(W,"-multiple-words")]:!c&&J&&J.toString().length>1,["".concat(W,"-status-").concat(g)]:!!g,["".concat(W,"-color-").concat(v)]:ei}),s=Object.assign(Object.assign(Object.assign({},null==Z?void 0:Z.indicator),null===(n=null==B?void 0:B.styles)||void 0===n?void 0:n.indicator),et);return v&&!ei&&((s=s||{}).background=v),o.createElement(L,{prefixCls:i,show:!Y,motionClassName:a,className:l,count:J,title:en,style:s,key:"scrollNumber"},er)}),ea))});Z.Ribbon=e=>{let{className:t,prefixCls:n,style:a,color:i,children:l,text:d,placement:u="end",rootClassName:m}=e,{getPrefixCls:b,direction:f}=o.useContext(s.E_),p=b("ribbon",n),g="".concat(p,"-wrapper"),[h,v,y]=S(p,g),x=(0,c.o2)(i,!1),k=r()(p,"".concat(p,"-placement-").concat(u),{["".concat(p,"-rtl")]:"rtl"===f,["".concat(p,"-color-").concat(i)]:x},t),w={},O={};return i&&!x&&(w.background=i,O.color=i),h(o.createElement("div",{className:r()(g,m,v,y)},l,o.createElement("div",{className:r()(k,v),style:Object.assign(Object.assign({},w),a)},o.createElement("span",{className:"".concat(p,"-text")},d),o.createElement("div",{className:"".concat(p,"-corner"),style:O}))))};var P=Z},5945:function(e,t,n){n.d(t,{Z:function(){return T}});var o=n(2265),a=n(36760),r=n.n(a),i=n(18694),c=n(71744),l=n(33759),s=n(50337),d=n(65869),u=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);at.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(n[o[a]]=e[o[a]]);return n},m=e=>{var{prefixCls:t,className:n,hoverable:a=!0}=e,i=u(e,["prefixCls","className","hoverable"]);let{getPrefixCls:l}=o.useContext(c.E_),s=l("card",t),d=r()("".concat(s,"-grid"),n,{["".concat(s,"-grid-hoverable")]:a});return o.createElement("div",Object.assign({},i,{className:d}))},b=n(93463),f=n(12918),p=n(99320),g=n(71140);let h=e=>{let{antCls:t,componentCls:n,headerHeight:o,headerPadding:a,tabsMarginBottom:r}=e;return Object.assign(Object.assign({display:"flex",justifyContent:"center",flexDirection:"column",minHeight:o,marginBottom:-1,padding:"0 ".concat((0,b.bf)(a)),color:e.colorTextHeading,fontWeight:e.fontWeightStrong,fontSize:e.headerFontSize,background:e.headerBg,borderBottom:"".concat((0,b.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorderSecondary),borderRadius:"".concat((0,b.bf)(e.borderRadiusLG)," ").concat((0,b.bf)(e.borderRadiusLG)," 0 0")},(0,f.dF)()),{"&-wrapper":{width:"100%",display:"flex",alignItems:"center"},"&-title":Object.assign(Object.assign({display:"inline-block",flex:1},f.vS),{["\n > ".concat(n,"-typography,\n > ").concat(n,"-typography-edit-content\n ")]:{insetInlineStart:0,marginTop:0,marginBottom:0}}),["".concat(t,"-tabs-top")]:{clear:"both",marginBottom:r,color:e.colorText,fontWeight:"normal",fontSize:e.fontSize,"&-bar":{borderBottom:"".concat((0,b.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorderSecondary)}}})},v=e=>{let{cardPaddingBase:t,colorBorderSecondary:n,cardShadow:o,lineWidth:a}=e;return{width:"33.33%",padding:t,border:0,borderRadius:0,boxShadow:"\n ".concat((0,b.bf)(a)," 0 0 0 ").concat(n,",\n 0 ").concat((0,b.bf)(a)," 0 0 ").concat(n,",\n ").concat((0,b.bf)(a)," ").concat((0,b.bf)(a)," 0 0 ").concat(n,",\n ").concat((0,b.bf)(a)," 0 0 0 ").concat(n," inset,\n 0 ").concat((0,b.bf)(a)," 0 0 ").concat(n," inset;\n "),transition:"all ".concat(e.motionDurationMid),"&-hoverable:hover":{position:"relative",zIndex:1,boxShadow:o}}},y=e=>{let{componentCls:t,iconCls:n,actionsLiMargin:o,cardActionsIconSize:a,colorBorderSecondary:r,actionsBg:i}=e;return Object.assign(Object.assign({margin:0,padding:0,listStyle:"none",background:i,borderTop:"".concat((0,b.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(r),display:"flex",borderRadius:"0 0 ".concat((0,b.bf)(e.borderRadiusLG)," ").concat((0,b.bf)(e.borderRadiusLG))},(0,f.dF)()),{"& > li":{margin:o,color:e.colorTextDescription,textAlign:"center","> span":{position:"relative",display:"block",minWidth:e.calc(e.cardActionsIconSize).mul(2).equal(),fontSize:e.fontSize,lineHeight:e.lineHeight,cursor:"pointer","&:hover":{color:e.colorPrimary,transition:"color ".concat(e.motionDurationMid)},["a:not(".concat(t,"-btn), > ").concat(n)]:{display:"inline-block",width:"100%",color:e.colorIcon,lineHeight:(0,b.bf)(e.fontHeight),transition:"color ".concat(e.motionDurationMid),"&:hover":{color:e.colorPrimary}},["> ".concat(n)]:{fontSize:a,lineHeight:(0,b.bf)(e.calc(a).mul(e.lineHeight).equal())}},"&:not(:last-child)":{borderInlineEnd:"".concat((0,b.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(r)}}})},x=e=>Object.assign(Object.assign({margin:"".concat((0,b.bf)(e.calc(e.marginXXS).mul(-1).equal())," 0"),display:"flex"},(0,f.dF)()),{"&-avatar":{paddingInlineEnd:e.padding},"&-detail":{overflow:"hidden",flex:1,"> div:not(:last-child)":{marginBottom:e.marginXS}},"&-title":Object.assign({color:e.colorTextHeading,fontWeight:e.fontWeightStrong,fontSize:e.fontSizeLG},f.vS),"&-description":{color:e.colorTextDescription}}),k=e=>{let{componentCls:t,colorFillAlter:n,headerPadding:o,bodyPadding:a}=e;return{["".concat(t,"-head")]:{padding:"0 ".concat((0,b.bf)(o)),background:n,"&-title":{fontSize:e.fontSize}},["".concat(t,"-body")]:{padding:"".concat((0,b.bf)(e.padding)," ").concat((0,b.bf)(a))}}},w=e=>{let{componentCls:t}=e;return{overflow:"hidden",["".concat(t,"-body")]:{userSelect:"none"}}},O=e=>{let{componentCls:t,cardShadow:n,cardHeadPadding:o,colorBorderSecondary:a,boxShadowTertiary:r,bodyPadding:i,extraColor:c}=e;return{[t]:Object.assign(Object.assign({},(0,f.Wf)(e)),{position:"relative",background:e.colorBgContainer,borderRadius:e.borderRadiusLG,["&:not(".concat(t,"-bordered)")]:{boxShadow:r},["".concat(t,"-head")]:h(e),["".concat(t,"-extra")]:{marginInlineStart:"auto",color:c,fontWeight:"normal",fontSize:e.fontSize},["".concat(t,"-body")]:{padding:i,borderRadius:"0 0 ".concat((0,b.bf)(e.borderRadiusLG)," ").concat((0,b.bf)(e.borderRadiusLG))},["".concat(t,"-grid")]:v(e),["".concat(t,"-cover")]:{"> *":{display:"block",width:"100%",borderRadius:"".concat((0,b.bf)(e.borderRadiusLG)," ").concat((0,b.bf)(e.borderRadiusLG)," 0 0")}},["".concat(t,"-actions")]:y(e),["".concat(t,"-meta")]:x(e)}),["".concat(t,"-bordered")]:{border:"".concat((0,b.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(a),["".concat(t,"-cover")]:{marginTop:-1,marginInlineStart:-1,marginInlineEnd:-1}},["".concat(t,"-hoverable")]:{cursor:"pointer",transition:"box-shadow ".concat(e.motionDurationMid,", border-color ").concat(e.motionDurationMid),"&:hover":{borderColor:"transparent",boxShadow:n}},["".concat(t,"-contain-grid")]:{borderRadius:"".concat((0,b.bf)(e.borderRadiusLG)," ").concat((0,b.bf)(e.borderRadiusLG)," 0 0 "),["".concat(t,"-body")]:{display:"flex",flexWrap:"wrap"},["&:not(".concat(t,"-loading) ").concat(t,"-body")]:{marginBlockStart:e.calc(e.lineWidth).mul(-1).equal(),marginInlineStart:e.calc(e.lineWidth).mul(-1).equal(),padding:0}},["".concat(t,"-contain-tabs")]:{["> div".concat(t,"-head")]:{minHeight:0,["".concat(t,"-head-title, ").concat(t,"-extra")]:{paddingTop:o}}},["".concat(t,"-type-inner")]:k(e),["".concat(t,"-loading")]:w(e),["".concat(t,"-rtl")]:{direction:"rtl"}}},E=e=>{let{componentCls:t,bodyPaddingSM:n,headerPaddingSM:o,headerHeightSM:a,headerFontSizeSM:r}=e;return{["".concat(t,"-small")]:{["> ".concat(t,"-head")]:{minHeight:a,padding:"0 ".concat((0,b.bf)(o)),fontSize:r,["> ".concat(t,"-head-wrapper")]:{["> ".concat(t,"-extra")]:{fontSize:e.fontSize}}},["> ".concat(t,"-body")]:{padding:n}},["".concat(t,"-small").concat(t,"-contain-tabs")]:{["> ".concat(t,"-head")]:{["".concat(t,"-head-title, ").concat(t,"-extra")]:{paddingTop:0,display:"flex",alignItems:"center"}}}}};var C=(0,p.I$)("Card",e=>{let t=(0,g.IX)(e,{cardShadow:e.boxShadowCard,cardHeadPadding:e.padding,cardPaddingBase:e.paddingLG,cardActionsIconSize:e.fontSize});return[O(t),E(t)]},e=>{var t,n;return{headerBg:"transparent",headerFontSize:e.fontSizeLG,headerFontSizeSM:e.fontSize,headerHeight:e.fontSizeLG*e.lineHeightLG+2*e.padding,headerHeightSM:e.fontSize*e.lineHeight+2*e.paddingXS,actionsBg:e.colorBgContainer,actionsLiMargin:"".concat(e.paddingSM,"px 0"),tabsMarginBottom:-e.padding-e.lineWidth,extraColor:e.colorText,bodyPaddingSM:12,headerPaddingSM:12,bodyPadding:null!==(t=e.bodyPadding)&&void 0!==t?t:e.paddingLG,headerPadding:null!==(n=e.headerPadding)&&void 0!==n?n:e.paddingLG}}),S=n(56250),j=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);at.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(n[o[a]]=e[o[a]]);return n};let N=e=>{let{actionClasses:t,actions:n=[],actionStyle:a}=e;return o.createElement("ul",{className:t,style:a},n.map((e,t)=>o.createElement("li",{style:{width:"".concat(100/n.length,"%")},key:"action-".concat(t)},o.createElement("span",null,e))))},z=o.forwardRef((e,t)=>{let n;let{prefixCls:a,className:u,rootClassName:b,style:f,extra:p,headStyle:g={},bodyStyle:h={},title:v,loading:y,bordered:x,variant:k,size:w,type:O,cover:E,actions:z,tabList:L,children:T,activeTabKey:Z,defaultActiveTabKey:P,tabBarExtraContent:M,hoverable:R,tabProps:I={},classNames:B,styles:W}=e,D=j(e,["prefixCls","className","rootClassName","style","extra","headStyle","bodyStyle","title","loading","bordered","variant","size","type","cover","actions","tabList","children","activeTabKey","defaultActiveTabKey","tabBarExtraContent","hoverable","tabProps","classNames","styles"]),{getPrefixCls:H,direction:A,card:F}=o.useContext(c.E_),[q]=(0,S.Z)("card",k,x),G=e=>{var t;return r()(null===(t=null==F?void 0:F.classNames)||void 0===t?void 0:t[e],null==B?void 0:B[e])},K=e=>{var t;return Object.assign(Object.assign({},null===(t=null==F?void 0:F.styles)||void 0===t?void 0:t[e]),null==W?void 0:W[e])},V=o.useMemo(()=>{let e=!1;return o.Children.forEach(T,t=>{(null==t?void 0:t.type)===m&&(e=!0)}),e},[T]),_=H("card",a),[X,Y,$]=C(_),Q=o.createElement(s.Z,{loading:!0,active:!0,paragraph:{rows:4},title:!1},T),U=void 0!==Z,J=Object.assign(Object.assign({},I),{[U?"activeKey":"defaultActiveKey"]:U?Z:P,tabBarExtraContent:M}),ee=(0,l.Z)(w),et=ee&&"default"!==ee?ee:"large",en=L?o.createElement(d.default,Object.assign({size:et},J,{className:"".concat(_,"-head-tabs"),onChange:t=>{var n;null===(n=e.onTabChange)||void 0===n||n.call(e,t)},items:L.map(e=>{var{tab:t}=e;return Object.assign({label:t},j(e,["tab"]))})})):null;if(v||p||en){let e=r()("".concat(_,"-head"),G("header")),t=r()("".concat(_,"-head-title"),G("title")),a=r()("".concat(_,"-extra"),G("extra")),i=Object.assign(Object.assign({},g),K("header"));n=o.createElement("div",{className:e,style:i},o.createElement("div",{className:"".concat(_,"-head-wrapper")},v&&o.createElement("div",{className:t,style:K("title")},v),p&&o.createElement("div",{className:a,style:K("extra")},p)),en)}let eo=r()("".concat(_,"-cover"),G("cover")),ea=E?o.createElement("div",{className:eo,style:K("cover")},E):null,er=r()("".concat(_,"-body"),G("body")),ei=Object.assign(Object.assign({},h),K("body")),ec=o.createElement("div",{className:er,style:ei},y?Q:T),el=r()("".concat(_,"-actions"),G("actions")),es=(null==z?void 0:z.length)?o.createElement(N,{actionClasses:el,actionStyle:K("actions"),actions:z}):null,ed=(0,i.Z)(D,["onTabChange"]),eu=r()(_,null==F?void 0:F.className,{["".concat(_,"-loading")]:y,["".concat(_,"-bordered")]:"borderless"!==q,["".concat(_,"-hoverable")]:R,["".concat(_,"-contain-grid")]:V,["".concat(_,"-contain-tabs")]:null==L?void 0:L.length,["".concat(_,"-").concat(ee)]:ee,["".concat(_,"-type-").concat(O)]:!!O,["".concat(_,"-rtl")]:"rtl"===A},u,b,Y,$),em=Object.assign(Object.assign({},null==F?void 0:F.style),f);return X(o.createElement("div",Object.assign({ref:t},ed,{className:eu,style:em}),n,ea,ec,es))});var L=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);at.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(n[o[a]]=e[o[a]]);return n};z.Grid=m,z.Meta=e=>{let{prefixCls:t,className:n,avatar:a,title:i,description:l}=e,s=L(e,["prefixCls","className","avatar","title","description"]),{getPrefixCls:d}=o.useContext(c.E_),u=d("card",t),m=r()("".concat(u,"-meta"),n),b=a?o.createElement("div",{className:"".concat(u,"-meta-avatar")},a):null,f=i?o.createElement("div",{className:"".concat(u,"-meta-title")},i):null,p=l?o.createElement("div",{className:"".concat(u,"-meta-description")},l):null,g=f||p?o.createElement("div",{className:"".concat(u,"-meta-detail")},f,p):null;return o.createElement("div",Object.assign({},s,{className:m}),b,g)};var T=z},69410:function(e,t,n){var o=n(54998);t.Z=o.Z},867:function(e,t,n){n.d(t,{Z:function(){return C}});var o=n(2265),a=n(54537),r=n(36760),i=n.n(r),c=n(50506),l=n(18694),s=n(71744),d=n(79326),u=n(59367),m=n(92570),b=n(5545),f=n(51248),p=n(55274),g=n(37381),h=n(20435),v=n(99320);let y=e=>{let{componentCls:t,iconCls:n,antCls:o,zIndexPopup:a,colorText:r,colorWarning:i,marginXXS:c,marginXS:l,fontSize:s,fontWeightStrong:d,colorTextHeading:u}=e;return{[t]:{zIndex:a,["&".concat(o,"-popover")]:{fontSize:s},["".concat(t,"-message")]:{marginBottom:l,display:"flex",flexWrap:"nowrap",alignItems:"start",["> ".concat(t,"-message-icon ").concat(n)]:{color:i,fontSize:s,lineHeight:1,marginInlineEnd:l},["".concat(t,"-title")]:{fontWeight:d,color:u,"&:only-child":{fontWeight:"normal"}},["".concat(t,"-description")]:{marginTop:c,color:r}},["".concat(t,"-buttons")]:{textAlign:"end",whiteSpace:"nowrap",button:{marginInlineStart:l}}}}};var x=(0,v.I$)("Popconfirm",e=>y(e),e=>{let{zIndexPopupBase:t}=e;return{zIndexPopup:t+60}},{resetStyle:!1}),k=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);at.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(n[o[a]]=e[o[a]]);return n};let w=e=>{let{prefixCls:t,okButtonProps:n,cancelButtonProps:r,title:i,description:c,cancelText:l,okText:d,okType:h="primary",icon:v=o.createElement(a.Z,null),showCancel:y=!0,close:x,onConfirm:k,onCancel:w,onPopupClick:O}=e,{getPrefixCls:E}=o.useContext(s.E_),[C]=(0,p.Z)("Popconfirm",g.Z.Popconfirm),S=(0,m.Z)(i),j=(0,m.Z)(c);return o.createElement("div",{className:"".concat(t,"-inner-content"),onClick:O},o.createElement("div",{className:"".concat(t,"-message")},v&&o.createElement("span",{className:"".concat(t,"-message-icon")},v),o.createElement("div",{className:"".concat(t,"-message-text")},S&&o.createElement("div",{className:"".concat(t,"-title")},S),j&&o.createElement("div",{className:"".concat(t,"-description")},j))),o.createElement("div",{className:"".concat(t,"-buttons")},y&&o.createElement(b.ZP,Object.assign({onClick:w,size:"small"},r),l||(null==C?void 0:C.cancelText)),o.createElement(u.Z,{buttonProps:Object.assign(Object.assign({size:"small"},(0,f.nx)(h)),n),actionFn:k,close:x,prefixCls:E("btn"),quitOnNullishReturnValue:!0,emitEvent:!0},d||(null==C?void 0:C.okText))))};var O=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);at.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(n[o[a]]=e[o[a]]);return n};let E=o.forwardRef((e,t)=>{var n,r;let{prefixCls:u,placement:m="top",trigger:b="click",okType:f="primary",icon:p=o.createElement(a.Z,null),children:g,overlayClassName:h,onOpenChange:v,onVisibleChange:y,overlayStyle:k,styles:E,classNames:C}=e,S=O(e,["prefixCls","placement","trigger","okType","icon","children","overlayClassName","onOpenChange","onVisibleChange","overlayStyle","styles","classNames"]),{getPrefixCls:j,className:N,style:z,classNames:L,styles:T}=(0,s.dj)("popconfirm"),[Z,P]=(0,c.Z)(!1,{value:null!==(n=e.open)&&void 0!==n?n:e.visible,defaultValue:null!==(r=e.defaultOpen)&&void 0!==r?r:e.defaultVisible}),M=(e,t)=>{P(e,!0),null==y||y(e),null==v||v(e,t)},R=j("popconfirm",u),I=i()(R,N,h,L.root,null==C?void 0:C.root),B=i()(L.body,null==C?void 0:C.body),[W]=x(R);return W(o.createElement(d.Z,Object.assign({},(0,l.Z)(S,["title"]),{trigger:b,placement:m,onOpenChange:(t,n)=>{let{disabled:o=!1}=e;o||M(t,n)},open:Z,ref:t,classNames:{root:I,body:B},styles:{root:Object.assign(Object.assign(Object.assign(Object.assign({},T.root),z),k),null==E?void 0:E.root),body:Object.assign(Object.assign({},T.body),null==E?void 0:E.body)},content:o.createElement(w,Object.assign({okType:f,icon:p},e,{prefixCls:R,close:e=>{M(!1,e)},onConfirm:t=>{var n;return null===(n=e.onConfirm)||void 0===n?void 0:n.call(void 0,t)},onCancel:t=>{var n;M(!1,t),null===(n=e.onCancel)||void 0===n||n.call(void 0,t)}})),"data-popover-inject":!0}),g))});E._InternalPanelDoNotUseOrYouWillBeFired=e=>{let{prefixCls:t,placement:n,className:a,style:r}=e,c=k(e,["prefixCls","placement","className","style"]),{getPrefixCls:l}=o.useContext(s.E_),d=l("popconfirm",t),[u]=x(d);return u(o.createElement(h.ZP,{placement:n,className:i()(d,a),style:r,content:o.createElement(w,Object.assign({prefixCls:d},c))}))};var C=E},47451:function(e,t,n){var o=n(77774);t.Z=o.Z},30401:function(e,t,n){n.d(t,{Z:function(){return o}});let o=(0,n(79205).Z)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},87769:function(e,t,n){n.d(t,{Z:function(){return o}});let o=(0,n(79205).Z)("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]])},42208:function(e,t,n){n.d(t,{Z:function(){return o}});let o=(0,n(79205).Z)("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},88532:function(e,t,n){var o=n(2265);let a=o.forwardRef(function(e,t){return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"}))});t.Z=a},2356:function(e,t,n){var o=n(2265);let a=o.forwardRef(function(e,t){return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"}))});t.Z=a},15731:function(e,t,n){var o=n(2265);let a=o.forwardRef(function(e,t){return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=a},45589:function(e,t,n){var o=n(2265);let a=o.forwardRef(function(e,t){return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"}))});t.Z=a},53410:function(e,t,n){var o=n(2265);let a=o.forwardRef(function(e,t){return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"}))});t.Z=a},91126:function(e,t,n){var o=n(2265);let a=o.forwardRef(function(e,t){return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z"}),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=a},29827:function(e,t,n){n.d(t,{NL:function(){return i},aH:function(){return c}});var o=n(2265),a=n(57437),r=o.createContext(void 0),i=e=>{let t=o.useContext(r);if(e)return e;if(!t)throw Error("No QueryClient set, use QueryClientProvider to set one");return t},c=e=>{let{client:t,children:n}=e;return o.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),(0,a.jsx)(r.Provider,{value:t,children:n})}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4073,5945],{45246:function(e,t,n){n.d(t,{Z:function(){return c}});var o=n(1119),a=n(2265),r={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M696 480H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h368c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"minus-circle",theme:"outlined"},i=n(55015),c=a.forwardRef(function(e,t){return a.createElement(i.Z,(0,o.Z)({},e,{ref:t,icon:r}))})},89245:function(e,t,n){n.d(t,{Z:function(){return c}});var o=n(1119),a=n(2265),r={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 00-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 01655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 01279 755.2a342.16 342.16 0 01-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 01109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z"}}]},name:"reload",theme:"outlined"},i=n(55015),c=a.forwardRef(function(e,t){return a.createElement(i.Z,(0,o.Z)({},e,{ref:t,icon:r}))})},78355:function(e,t,n){n.d(t,{Z:function(){return c}});var o=n(1119),a=n(2265),r={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M893.3 293.3L730.7 130.7c-7.5-7.5-16.7-13-26.7-16V112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V338.5c0-17-6.7-33.2-18.7-45.2zM384 184h256v104H384V184zm456 656H184V184h136v136c0 17.7 14.3 32 32 32h320c17.7 0 32-14.3 32-32V205.8l136 136V840zM512 442c-79.5 0-144 64.5-144 144s64.5 144 144 144 144-64.5 144-144-64.5-144-144-144zm0 224c-44.2 0-80-35.8-80-80s35.8-80 80-80 80 35.8 80 80-35.8 80-80 80z"}}]},name:"save",theme:"outlined"},i=n(55015),c=a.forwardRef(function(e,t){return a.createElement(i.Z,(0,o.Z)({},e,{ref:t,icon:r}))})},8881:function(e,t,n){n.d(t,{Z:function(){return c}});var o=n(1119),a=n(2265),r={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372 0-89 31.3-170.8 83.5-234.8l523.3 523.3C682.8 852.7 601 884 512 884zm288.5-137.2L277.2 223.5C341.2 171.3 423 140 512 140c205.4 0 372 166.6 372 372 0 89-31.3 170.8-83.5 234.8z"}}]},name:"stop",theme:"outlined"},i=n(55015),c=a.forwardRef(function(e,t){return a.createElement(i.Z,(0,o.Z)({},e,{ref:t,icon:r}))})},3632:function(e,t,n){n.d(t,{Z:function(){return c}});var o=n(1119),a=n(2265),r={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"},i=n(55015),c=a.forwardRef(function(e,t){return a.createElement(i.Z,(0,o.Z)({},e,{ref:t,icon:r}))})},35291:function(e,t,n){n.d(t,{Z:function(){return c}});var o=n(1119),a=n(2265),r={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M464 720a48 48 0 1096 0 48 48 0 10-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z"}}]},name:"warning",theme:"outlined"},i=n(55015),c=a.forwardRef(function(e,t){return a.createElement(i.Z,(0,o.Z)({},e,{ref:t,icon:r}))})},59664:function(e,t,n){n.d(t,{Z:function(){return S}});var o=n(5853),a=n(2265),r=n(47625),i=n(93765),c=n(54061),l=n(97059),s=n(62994),d=n(25311),u=(0,i.z)({chartName:"LineChart",GraphicalChild:c.x,axisComponents:[{axisType:"xAxis",AxisComp:l.K},{axisType:"yAxis",AxisComp:s.B}],formatAxisMap:d.t9}),m=n(56940),b=n(26680),p=n(8147),f=n(22190),g=n(81889),h=n(65278),v=n(98593),y=n(92666),x=n(32644),k=n(7084),w=n(26898),O=n(13241),E=n(1153);let S=a.forwardRef((e,t)=>{let{data:n=[],categories:i=[],index:d,colors:S=w.s,valueFormatter:C=E.Cj,startEndOnly:j=!1,showXAxis:N=!0,showYAxis:z=!0,yAxisWidth:L=56,intervalType:T="equidistantPreserveStart",animationDuration:Z=900,showAnimation:P=!1,showTooltip:M=!0,showLegend:R=!0,showGridLines:I=!0,autoMinValue:B=!1,curveType:W="linear",minValue:D,maxValue:H,connectNulls:A=!1,allowDecimals:F=!0,noDataText:q,className:G,onValueChange:K,enableLegendSlider:V=!1,customTooltip:_,rotateLabelX:X,padding:Y=N||z?{left:20,right:20}:{left:0,right:0},tickGap:$=5,xAxisLabel:U,yAxisLabel:Q}=e,J=(0,o._T)(e,["data","categories","index","colors","valueFormatter","startEndOnly","showXAxis","showYAxis","yAxisWidth","intervalType","animationDuration","showAnimation","showTooltip","showLegend","showGridLines","autoMinValue","curveType","minValue","maxValue","connectNulls","allowDecimals","noDataText","className","onValueChange","enableLegendSlider","customTooltip","rotateLabelX","padding","tickGap","xAxisLabel","yAxisLabel"]),[ee,et]=(0,a.useState)(60),[en,eo]=(0,a.useState)(void 0),[ea,er]=(0,a.useState)(void 0),ei=(0,x.me)(i,S),ec=(0,x.i4)(B,D,H),el=!!K;function es(e){el&&(e===ea&&!en||(0,x.FB)(n,e)&&en&&en.dataKey===e?(er(void 0),null==K||K(null)):(er(e),null==K||K({eventType:"category",categoryClicked:e})),eo(void 0))}return a.createElement("div",Object.assign({ref:t,className:(0,O.q)("w-full h-80",G)},J),a.createElement(r.h,{className:"h-full w-full"},(null==n?void 0:n.length)?a.createElement(u,{data:n,onClick:el&&(ea||en)?()=>{eo(void 0),er(void 0),null==K||K(null)}:void 0,margin:{bottom:U?30:void 0,left:Q?20:void 0,right:Q?5:void 0,top:5}},I?a.createElement(m.q,{className:(0,O.q)("stroke-1","stroke-tremor-border","dark:stroke-dark-tremor-border"),horizontal:!0,vertical:!1}):null,a.createElement(l.K,{padding:Y,hide:!N,dataKey:d,interval:j?"preserveStartEnd":T,tick:{transform:"translate(0, 6)"},ticks:j?[n[0][d],n[n.length-1][d]]:void 0,fill:"",stroke:"",className:(0,O.q)("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickLine:!1,axisLine:!1,minTickGap:$,angle:null==X?void 0:X.angle,dy:null==X?void 0:X.verticalShift,height:null==X?void 0:X.xAxisHeight},U&&a.createElement(b._,{position:"insideBottom",offset:-20,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},U)),a.createElement(s.B,{width:L,hide:!z,axisLine:!1,tickLine:!1,type:"number",domain:ec,tick:{transform:"translate(-3, 0)"},fill:"",stroke:"",className:(0,O.q)("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickFormatter:C,allowDecimals:F},Q&&a.createElement(b._,{position:"insideLeft",style:{textAnchor:"middle"},angle:-90,offset:-15,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},Q)),a.createElement(p.u,{wrapperStyle:{outline:"none"},isAnimationActive:!1,cursor:{stroke:"#d1d5db",strokeWidth:1},content:M?e=>{let{active:t,payload:n,label:o}=e;return _?a.createElement(_,{payload:null==n?void 0:n.map(e=>{var t;return Object.assign(Object.assign({},e),{color:null!==(t=ei.get(e.dataKey))&&void 0!==t?t:k.fr.Gray})}),active:t,label:o}):a.createElement(v.ZP,{active:t,payload:n,label:o,valueFormatter:C,categoryColors:ei})}:a.createElement(a.Fragment,null),position:{y:0}}),R?a.createElement(f.D,{verticalAlign:"top",height:ee,content:e=>{let{payload:t}=e;return(0,h.Z)({payload:t},ei,et,ea,el?e=>es(e):void 0,V)}}):null,i.map(e=>{var t;return a.createElement(c.x,{className:(0,O.q)((0,E.bM)(null!==(t=ei.get(e))&&void 0!==t?t:k.fr.Gray,w.K.text).strokeColor),strokeOpacity:en||ea&&ea!==e?.3:1,activeDot:e=>{var t;let{cx:o,cy:r,stroke:i,strokeLinecap:c,strokeLinejoin:l,strokeWidth:s,dataKey:d}=e;return a.createElement(g.o,{className:(0,O.q)("stroke-tremor-background dark:stroke-dark-tremor-background",K?"cursor-pointer":"",(0,E.bM)(null!==(t=ei.get(d))&&void 0!==t?t:k.fr.Gray,w.K.text).fillColor),cx:o,cy:r,r:5,fill:"",stroke:i,strokeLinecap:c,strokeLinejoin:l,strokeWidth:s,onClick:(t,o)=>{o.stopPropagation(),el&&(e.index===(null==en?void 0:en.index)&&e.dataKey===(null==en?void 0:en.dataKey)||(0,x.FB)(n,e.dataKey)&&ea&&ea===e.dataKey?(er(void 0),eo(void 0),null==K||K(null)):(er(e.dataKey),eo({index:e.index,dataKey:e.dataKey}),null==K||K(Object.assign({eventType:"dot",categoryClicked:e.dataKey},e.payload))))}})},dot:t=>{var o;let{stroke:r,strokeLinecap:i,strokeLinejoin:c,strokeWidth:l,cx:s,cy:d,dataKey:u,index:m}=t;return(0,x.FB)(n,e)&&!(en||ea&&ea!==e)||(null==en?void 0:en.index)===m&&(null==en?void 0:en.dataKey)===e?a.createElement(g.o,{key:m,cx:s,cy:d,r:5,stroke:r,fill:"",strokeLinecap:i,strokeLinejoin:c,strokeWidth:l,className:(0,O.q)("stroke-tremor-background dark:stroke-dark-tremor-background",K?"cursor-pointer":"",(0,E.bM)(null!==(o=ei.get(u))&&void 0!==o?o:k.fr.Gray,w.K.text).fillColor)}):a.createElement(a.Fragment,{key:m})},key:e,name:e,type:W,dataKey:e,stroke:"",strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",isAnimationActive:P,animationDuration:Z,connectNulls:A})}),K?i.map(e=>a.createElement(c.x,{className:(0,O.q)("cursor-pointer"),strokeOpacity:0,key:e,name:e,type:W,dataKey:e,stroke:"transparent",fill:"transparent",legendType:"none",tooltipType:"none",strokeWidth:12,connectNulls:A,onClick:(e,t)=>{t.stopPropagation();let{name:n}=e;es(n)}})):null):a.createElement(y.Z,{noDataText:q})))});S.displayName="LineChart"},59341:function(e,t,n){n.d(t,{Z:function(){return Z}});var o=n(5853),a=n(71049),r=n(11323),i=n(2265),c=n(66797),l=n(40099),s=n(74275),d=n(59456),u=n(93980),m=n(65573),b=n(67561),p=n(87550),f=n(628),g=n(80281),h=n(31370),v=n(20131),y=n(38929),x=n(52307),k=n(52724),w=n(7935);let O=(0,i.createContext)(null);O.displayName="GroupContext";let E=i.Fragment,S=Object.assign((0,y.yV)(function(e,t){var n;let o=(0,i.useId)(),E=(0,g.Q)(),S=(0,p.B)(),{id:C=E||"headlessui-switch-".concat(o),disabled:j=S||!1,checked:N,defaultChecked:z,onChange:L,name:T,value:Z,form:P,autoFocus:M=!1,...R}=e,I=(0,i.useContext)(O),[B,W]=(0,i.useState)(null),D=(0,i.useRef)(null),H=(0,b.T)(D,t,null===I?null:I.setSwitch,W),A=(0,s.L)(z),[F,q]=(0,l.q)(N,L,null!=A&&A),G=(0,d.G)(),[K,V]=(0,i.useState)(!1),_=(0,u.z)(()=>{V(!0),null==q||q(!F),G.nextFrame(()=>{V(!1)})}),X=(0,u.z)(e=>{if((0,h.P)(e.currentTarget))return e.preventDefault();e.preventDefault(),_()}),Y=(0,u.z)(e=>{e.key===k.R.Space?(e.preventDefault(),_()):e.key===k.R.Enter&&(0,v.g)(e.currentTarget)}),$=(0,u.z)(e=>e.preventDefault()),U=(0,w.wp)(),Q=(0,x.zH)(),{isFocusVisible:J,focusProps:ee}=(0,a.F)({autoFocus:M}),{isHovered:et,hoverProps:en}=(0,r.X)({isDisabled:j}),{pressed:eo,pressProps:ea}=(0,c.x)({disabled:j}),er=(0,i.useMemo)(()=>({checked:F,disabled:j,hover:et,focus:J,active:eo,autofocus:M,changing:K}),[F,et,J,eo,j,K,M]),ei=(0,y.dG)({id:C,ref:H,role:"switch",type:(0,m.f)(e,B),tabIndex:-1===e.tabIndex?0:null!=(n=e.tabIndex)?n:0,"aria-checked":F,"aria-labelledby":U,"aria-describedby":Q,disabled:j||void 0,autoFocus:M,onClick:X,onKeyUp:Y,onKeyPress:$},ee,en,ea),ec=(0,i.useCallback)(()=>{if(void 0!==A)return null==q?void 0:q(A)},[q,A]),el=(0,y.L6)();return i.createElement(i.Fragment,null,null!=T&&i.createElement(f.Mt,{disabled:j,data:{[T]:Z||"on"},overrides:{type:"checkbox",checked:F},form:P,onReset:ec}),el({ourProps:ei,theirProps:R,slot:er,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var t;let[n,o]=(0,i.useState)(null),[a,r]=(0,w.bE)(),[c,l]=(0,x.fw)(),s=(0,i.useMemo)(()=>({switch:n,setSwitch:o}),[n,o]),d=(0,y.L6)();return i.createElement(l,{name:"Switch.Description",value:c},i.createElement(r,{name:"Switch.Label",value:a,props:{htmlFor:null==(t=s.switch)?void 0:t.id,onClick(e){n&&(e.currentTarget instanceof HTMLLabelElement&&e.preventDefault(),n.click(),n.focus({preventScroll:!0}))}}},i.createElement(O.Provider,{value:s},d({ourProps:{},theirProps:e,slot:{},defaultTag:E,name:"Switch.Group"}))))},Label:w.__,Description:x.dk});var C=n(44140),j=n(26898),N=n(13241),z=n(1153),L=n(47187);let T=(0,z.fn)("Switch"),Z=i.forwardRef((e,t)=>{let{checked:n,defaultChecked:a=!1,onChange:r,color:c,name:l,error:s,errorMessage:d,disabled:u,required:m,tooltip:b,id:p}=e,f=(0,o._T)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),g={bgColor:c?(0,z.bM)(c,j.K.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:c?(0,z.bM)(c,j.K.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[h,v]=(0,C.Z)(a,n),[y,x]=(0,i.useState)(!1),{tooltipProps:k,getReferenceProps:w}=(0,L.l)(300);return i.createElement("div",{className:"flex flex-row items-center justify-start"},i.createElement(L.Z,Object.assign({text:b},k)),i.createElement("div",Object.assign({ref:(0,z.lq)([t,k.refs.setReference]),className:(0,N.q)(T("root"),"flex flex-row relative h-5")},f,w),i.createElement("input",{type:"checkbox",className:(0,N.q)(T("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:l,required:m,checked:h,onChange:e=>{e.preventDefault()}}),i.createElement(S,{checked:h,onChange:e=>{v(e),null==r||r(e)},disabled:u,className:(0,N.q)(T("switch"),"w-10 h-5 group relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-tremor-full","focus:outline-none",u?"cursor-not-allowed":""),onFocus:()=>x(!0),onBlur:()=>x(!1),id:p},i.createElement("span",{className:(0,N.q)(T("sr-only"),"sr-only")},"Switch ",h?"on":"off"),i.createElement("span",{"aria-hidden":"true",className:(0,N.q)(T("background"),h?g.bgColor:"bg-tremor-border dark:bg-dark-tremor-border","pointer-events-none absolute mx-auto h-3 w-9 rounded-tremor-full transition-colors duration-100 ease-in-out")}),i.createElement("span",{"aria-hidden":"true",className:(0,N.q)(T("round"),h?(0,N.q)(g.bgColor,"translate-x-5 border-tremor-background dark:border-dark-tremor-background"):"translate-x-0 bg-tremor-border dark:bg-dark-tremor-border border-tremor-background dark:border-dark-tremor-background","pointer-events-none absolute left-0 inline-block h-5 w-5 transform rounded-tremor-full border-2 shadow-tremor-input duration-100 ease-in-out transition",y?(0,N.q)("ring-2",g.ringColor):"")}))),s&&d?i.createElement("p",{className:(0,N.q)(T("errorMessage"),"text-sm text-red-500 mt-1 ")},d):null)});Z.displayName="Switch"},33866:function(e,t,n){n.d(t,{Z:function(){return P}});var o=n(2265),a=n(36760),r=n.n(a),i=n(66632),c=n(93350),l=n(19722),s=n(71744),d=n(93463),u=n(12918),m=n(18536),b=n(71140),p=n(99320);let f=new d.E4("antStatusProcessing",{"0%":{transform:"scale(0.8)",opacity:.5},"100%":{transform:"scale(2.4)",opacity:0}}),g=new d.E4("antZoomBadgeIn",{"0%":{transform:"scale(0) translate(50%, -50%)",opacity:0},"100%":{transform:"scale(1) translate(50%, -50%)"}}),h=new d.E4("antZoomBadgeOut",{"0%":{transform:"scale(1) translate(50%, -50%)"},"100%":{transform:"scale(0) translate(50%, -50%)",opacity:0}}),v=new d.E4("antNoWrapperZoomBadgeIn",{"0%":{transform:"scale(0)",opacity:0},"100%":{transform:"scale(1)"}}),y=new d.E4("antNoWrapperZoomBadgeOut",{"0%":{transform:"scale(1)"},"100%":{transform:"scale(0)",opacity:0}}),x=new d.E4("antBadgeLoadingCircle",{"0%":{transformOrigin:"50%"},"100%":{transform:"translate(50%, -50%) rotate(360deg)",transformOrigin:"50%"}}),k=e=>{let{componentCls:t,iconCls:n,antCls:o,badgeShadowSize:a,textFontSize:r,textFontSizeSM:i,statusSize:c,dotSize:l,textFontWeight:s,indicatorHeight:b,indicatorHeightSM:p,marginXS:k,calc:w}=e,O="".concat(o,"-scroll-number"),E=(0,m.Z)(e,(e,n)=>{let{darkColor:o}=n;return{["&".concat(t," ").concat(t,"-color-").concat(e)]:{background:o,["&:not(".concat(t,"-count)")]:{color:o},"a:hover &":{background:o}}}});return{[t]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,u.Wf)(e)),{position:"relative",display:"inline-block",width:"fit-content",lineHeight:1,["".concat(t,"-count")]:{display:"inline-flex",justifyContent:"center",zIndex:e.indicatorZIndex,minWidth:b,height:b,color:e.badgeTextColor,fontWeight:s,fontSize:r,lineHeight:(0,d.bf)(b),whiteSpace:"nowrap",textAlign:"center",background:e.badgeColor,borderRadius:w(b).div(2).equal(),boxShadow:"0 0 0 ".concat((0,d.bf)(a)," ").concat(e.badgeShadowColor),transition:"background ".concat(e.motionDurationMid),a:{color:e.badgeTextColor},"a:hover":{color:e.badgeTextColor},"a:hover &":{background:e.badgeColorHover}},["".concat(t,"-count-sm")]:{minWidth:p,height:p,fontSize:i,lineHeight:(0,d.bf)(p),borderRadius:w(p).div(2).equal()},["".concat(t,"-multiple-words")]:{padding:"0 ".concat((0,d.bf)(e.paddingXS)),bdi:{unicodeBidi:"plaintext"}},["".concat(t,"-dot")]:{zIndex:e.indicatorZIndex,width:l,minWidth:l,height:l,background:e.badgeColor,borderRadius:"100%",boxShadow:"0 0 0 ".concat((0,d.bf)(a)," ").concat(e.badgeShadowColor)},["".concat(t,"-count, ").concat(t,"-dot, ").concat(O,"-custom-component")]:{position:"absolute",top:0,insetInlineEnd:0,transform:"translate(50%, -50%)",transformOrigin:"100% 0%",["&".concat(n,"-spin")]:{animationName:x,animationDuration:"1s",animationIterationCount:"infinite",animationTimingFunction:"linear"}},["&".concat(t,"-status")]:{lineHeight:"inherit",verticalAlign:"baseline",["".concat(t,"-status-dot")]:{position:"relative",top:-1,display:"inline-block",width:c,height:c,verticalAlign:"middle",borderRadius:"50%"},["".concat(t,"-status-success")]:{backgroundColor:e.colorSuccess},["".concat(t,"-status-processing")]:{overflow:"visible",color:e.colorInfo,backgroundColor:e.colorInfo,borderColor:"currentcolor","&::after":{position:"absolute",top:0,insetInlineStart:0,width:"100%",height:"100%",borderWidth:a,borderStyle:"solid",borderColor:"inherit",borderRadius:"50%",animationName:f,animationDuration:e.badgeProcessingDuration,animationIterationCount:"infinite",animationTimingFunction:"ease-in-out",content:'""'}},["".concat(t,"-status-default")]:{backgroundColor:e.colorTextPlaceholder},["".concat(t,"-status-error")]:{backgroundColor:e.colorError},["".concat(t,"-status-warning")]:{backgroundColor:e.colorWarning},["".concat(t,"-status-text")]:{marginInlineStart:k,color:e.colorText,fontSize:e.fontSize}}}),E),{["".concat(t,"-zoom-appear, ").concat(t,"-zoom-enter")]:{animationName:g,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack,animationFillMode:"both"},["".concat(t,"-zoom-leave")]:{animationName:h,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack,animationFillMode:"both"},["&".concat(t,"-not-a-wrapper")]:{["".concat(t,"-zoom-appear, ").concat(t,"-zoom-enter")]:{animationName:v,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack},["".concat(t,"-zoom-leave")]:{animationName:y,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack},["&:not(".concat(t,"-status)")]:{verticalAlign:"middle"},["".concat(O,"-custom-component, ").concat(t,"-count")]:{transform:"none"},["".concat(O,"-custom-component, ").concat(O)]:{position:"relative",top:"auto",display:"block",transformOrigin:"50% 50%"}},[O]:{overflow:"hidden",transition:"all ".concat(e.motionDurationMid," ").concat(e.motionEaseOutBack),["".concat(O,"-only")]:{position:"relative",display:"inline-block",height:b,transition:"all ".concat(e.motionDurationSlow," ").concat(e.motionEaseOutBack),WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden",["> p".concat(O,"-only-unit")]:{height:b,margin:0,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden"}},["".concat(O,"-symbol")]:{verticalAlign:"top"}},"&-rtl":{direction:"rtl",["".concat(t,"-count, ").concat(t,"-dot, ").concat(O,"-custom-component")]:{transform:"translate(-50%, -50%)"}}})}},w=e=>{let{fontHeight:t,lineWidth:n,marginXS:o,colorBorderBg:a}=e,r=e.colorTextLightSolid,i=e.colorError,c=e.colorErrorHover;return(0,b.IX)(e,{badgeFontHeight:t,badgeShadowSize:n,badgeTextColor:r,badgeColor:i,badgeColorHover:c,badgeShadowColor:a,badgeProcessingDuration:"1.2s",badgeRibbonOffset:o,badgeRibbonCornerTransform:"scaleY(0.75)",badgeRibbonCornerFilter:"brightness(75%)"})},O=e=>{let{fontSize:t,lineHeight:n,fontSizeSM:o,lineWidth:a}=e;return{indicatorZIndex:"auto",indicatorHeight:Math.round(t*n)-2*a,indicatorHeightSM:t,dotSize:o/2,textFontSize:o,textFontSizeSM:o,textFontWeight:"normal",statusSize:o/2}};var E=(0,p.I$)("Badge",e=>k(w(e)),O);let S=e=>{let{antCls:t,badgeFontHeight:n,marginXS:o,badgeRibbonOffset:a,calc:r}=e,i="".concat(t,"-ribbon"),c=(0,m.Z)(e,(e,t)=>{let{darkColor:n}=t;return{["&".concat(i,"-color-").concat(e)]:{background:n,color:n}}});return{["".concat(t,"-ribbon-wrapper")]:{position:"relative"},[i]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,u.Wf)(e)),{position:"absolute",top:o,padding:"0 ".concat((0,d.bf)(e.paddingXS)),color:e.colorPrimary,lineHeight:(0,d.bf)(n),whiteSpace:"nowrap",backgroundColor:e.colorPrimary,borderRadius:e.borderRadiusSM,["".concat(i,"-text")]:{color:e.badgeTextColor},["".concat(i,"-corner")]:{position:"absolute",top:"100%",width:a,height:a,color:"currentcolor",border:"".concat((0,d.bf)(r(a).div(2).equal())," solid"),transform:e.badgeRibbonCornerTransform,transformOrigin:"top",filter:e.badgeRibbonCornerFilter}}),c),{["&".concat(i,"-placement-end")]:{insetInlineEnd:r(a).mul(-1).equal(),borderEndEndRadius:0,["".concat(i,"-corner")]:{insetInlineEnd:0,borderInlineEndColor:"transparent",borderBlockEndColor:"transparent"}},["&".concat(i,"-placement-start")]:{insetInlineStart:r(a).mul(-1).equal(),borderEndStartRadius:0,["".concat(i,"-corner")]:{insetInlineStart:0,borderBlockEndColor:"transparent",borderInlineStartColor:"transparent"}},"&-rtl":{direction:"rtl"}})}};var C=(0,p.I$)(["Badge","Ribbon"],e=>S(w(e)),O);let j=e=>{let t;let{prefixCls:n,value:a,current:i,offset:c=0}=e;return c&&(t={position:"absolute",top:"".concat(c,"00%"),left:0}),o.createElement("span",{style:t,className:r()("".concat(n,"-only-unit"),{current:i})},a)};var N=e=>{let t,n;let{prefixCls:a,count:r,value:i}=e,c=Number(i),l=Math.abs(r),[s,d]=o.useState(c),[u,m]=o.useState(l),b=()=>{d(c),m(l)};if(o.useEffect(()=>{let e=setTimeout(b,1e3);return()=>clearTimeout(e)},[c]),s===c||Number.isNaN(c)||Number.isNaN(s))t=[o.createElement(j,Object.assign({},e,{key:c,current:!0}))],n={transition:"none"};else{t=[];let a=c+10,r=[];for(let e=c;e<=a;e+=1)r.push(e);let i=ue%10===s);t=(i<0?r.slice(0,d+1):r.slice(d)).map((t,n)=>o.createElement(j,Object.assign({},e,{key:t,value:t%10,offset:i<0?n-d:n,current:n===d}))),n={transform:"translateY(".concat(-function(e,t,n){let o=e,a=0;for(;(o+10)%10!==t;)o+=n,a+=n;return a}(s,c,i),"00%)")}}return o.createElement("span",{className:"".concat(a,"-only"),style:n,onTransitionEnd:b},t)},z=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);at.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(n[o[a]]=e[o[a]]);return n};let L=o.forwardRef((e,t)=>{let{prefixCls:n,count:a,className:i,motionClassName:c,style:d,title:u,show:m,component:b="sup",children:p}=e,f=z(e,["prefixCls","count","className","motionClassName","style","title","show","component","children"]),{getPrefixCls:g}=o.useContext(s.E_),h=g("scroll-number",n),v=Object.assign(Object.assign({},f),{"data-show":m,style:d,className:r()(h,i,c),title:u}),y=a;if(a&&Number(a)%1==0){let e=String(a).split("");y=o.createElement("bdi",null,e.map((t,n)=>o.createElement(N,{prefixCls:h,count:Number(a),value:t,key:e.length-n})))}return((null==d?void 0:d.borderColor)&&(v.style=Object.assign(Object.assign({},d),{boxShadow:"0 0 0 1px ".concat(d.borderColor," inset")})),p)?(0,l.Tm)(p,e=>({className:r()("".concat(h,"-custom-component"),null==e?void 0:e.className,c)})):o.createElement(b,Object.assign({},v,{ref:t}),y)});var T=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);at.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(n[o[a]]=e[o[a]]);return n};let Z=o.forwardRef((e,t)=>{var n,a,d,u,m;let{prefixCls:b,scrollNumberPrefixCls:p,children:f,status:g,text:h,color:v,count:y=null,overflowCount:x=99,dot:k=!1,size:w="default",title:O,offset:S,style:C,className:j,rootClassName:N,classNames:z,styles:Z,showZero:P=!1}=e,M=T(e,["prefixCls","scrollNumberPrefixCls","children","status","text","color","count","overflowCount","dot","size","title","offset","style","className","rootClassName","classNames","styles","showZero"]),{getPrefixCls:R,direction:I,badge:B}=o.useContext(s.E_),W=R("badge",b),[D,H,A]=E(W),F=y>x?"".concat(x,"+"):y,q="0"===F||0===F||"0"===h||0===h,G=null===y||q&&!P,K=(null!=g||null!=v)&&G,V=null!=g||!q,_=k&&!q,X=_?"":F,Y=(0,o.useMemo)(()=>((null==X||""===X)&&(null==h||""===h)||q&&!P)&&!_,[X,q,P,_,h]),$=(0,o.useRef)(y);Y||($.current=y);let U=$.current,Q=(0,o.useRef)(X);Y||(Q.current=X);let J=Q.current,ee=(0,o.useRef)(_);Y||(ee.current=_);let et=(0,o.useMemo)(()=>{if(!S)return Object.assign(Object.assign({},null==B?void 0:B.style),C);let e={marginTop:S[1]};return"rtl"===I?e.left=Number.parseInt(S[0],10):e.right=-Number.parseInt(S[0],10),Object.assign(Object.assign(Object.assign({},e),null==B?void 0:B.style),C)},[I,S,C,null==B?void 0:B.style]),en=null!=O?O:"string"==typeof U||"number"==typeof U?U:void 0,eo=!Y&&(0===h?P:!!h&&!0!==h),ea=eo?o.createElement("span",{className:"".concat(W,"-status-text")},h):null,er=U&&"object"==typeof U?(0,l.Tm)(U,e=>({style:Object.assign(Object.assign({},et),e.style)})):void 0,ei=(0,c.o2)(v,!1),ec=r()(null==z?void 0:z.indicator,null===(n=null==B?void 0:B.classNames)||void 0===n?void 0:n.indicator,{["".concat(W,"-status-dot")]:K,["".concat(W,"-status-").concat(g)]:!!g,["".concat(W,"-color-").concat(v)]:ei}),el={};v&&!ei&&(el.color=v,el.background=v);let es=r()(W,{["".concat(W,"-status")]:K,["".concat(W,"-not-a-wrapper")]:!f,["".concat(W,"-rtl")]:"rtl"===I},j,N,null==B?void 0:B.className,null===(a=null==B?void 0:B.classNames)||void 0===a?void 0:a.root,null==z?void 0:z.root,H,A);if(!f&&K&&(h||V||!G)){let e=et.color;return D(o.createElement("span",Object.assign({},M,{className:es,style:Object.assign(Object.assign(Object.assign({},null==Z?void 0:Z.root),null===(d=null==B?void 0:B.styles)||void 0===d?void 0:d.root),et)}),o.createElement("span",{className:ec,style:Object.assign(Object.assign(Object.assign({},null==Z?void 0:Z.indicator),null===(u=null==B?void 0:B.styles)||void 0===u?void 0:u.indicator),el)}),eo&&o.createElement("span",{style:{color:e},className:"".concat(W,"-status-text")},h)))}return D(o.createElement("span",Object.assign({ref:t},M,{className:es,style:Object.assign(Object.assign({},null===(m=null==B?void 0:B.styles)||void 0===m?void 0:m.root),null==Z?void 0:Z.root)}),f,o.createElement(i.ZP,{visible:!Y,motionName:"".concat(W,"-zoom"),motionAppear:!1,motionDeadline:1e3},e=>{var t,n;let{className:a}=e,i=R("scroll-number",p),c=ee.current,l=r()(null==z?void 0:z.indicator,null===(t=null==B?void 0:B.classNames)||void 0===t?void 0:t.indicator,{["".concat(W,"-dot")]:c,["".concat(W,"-count")]:!c,["".concat(W,"-count-sm")]:"small"===w,["".concat(W,"-multiple-words")]:!c&&J&&J.toString().length>1,["".concat(W,"-status-").concat(g)]:!!g,["".concat(W,"-color-").concat(v)]:ei}),s=Object.assign(Object.assign(Object.assign({},null==Z?void 0:Z.indicator),null===(n=null==B?void 0:B.styles)||void 0===n?void 0:n.indicator),et);return v&&!ei&&((s=s||{}).background=v),o.createElement(L,{prefixCls:i,show:!Y,motionClassName:a,className:l,count:J,title:en,style:s,key:"scrollNumber"},er)}),ea))});Z.Ribbon=e=>{let{className:t,prefixCls:n,style:a,color:i,children:l,text:d,placement:u="end",rootClassName:m}=e,{getPrefixCls:b,direction:p}=o.useContext(s.E_),f=b("ribbon",n),g="".concat(f,"-wrapper"),[h,v,y]=C(f,g),x=(0,c.o2)(i,!1),k=r()(f,"".concat(f,"-placement-").concat(u),{["".concat(f,"-rtl")]:"rtl"===p,["".concat(f,"-color-").concat(i)]:x},t),w={},O={};return i&&!x&&(w.background=i,O.color=i),h(o.createElement("div",{className:r()(g,m,v,y)},l,o.createElement("div",{className:r()(k,v),style:Object.assign(Object.assign({},w),a)},o.createElement("span",{className:"".concat(f,"-text")},d),o.createElement("div",{className:"".concat(f,"-corner"),style:O}))))};var P=Z},5945:function(e,t,n){n.d(t,{Z:function(){return T}});var o=n(2265),a=n(36760),r=n.n(a),i=n(18694),c=n(71744),l=n(33759),s=n(50337),d=n(65869),u=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);at.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(n[o[a]]=e[o[a]]);return n},m=e=>{var{prefixCls:t,className:n,hoverable:a=!0}=e,i=u(e,["prefixCls","className","hoverable"]);let{getPrefixCls:l}=o.useContext(c.E_),s=l("card",t),d=r()("".concat(s,"-grid"),n,{["".concat(s,"-grid-hoverable")]:a});return o.createElement("div",Object.assign({},i,{className:d}))},b=n(93463),p=n(12918),f=n(99320),g=n(71140);let h=e=>{let{antCls:t,componentCls:n,headerHeight:o,headerPadding:a,tabsMarginBottom:r}=e;return Object.assign(Object.assign({display:"flex",justifyContent:"center",flexDirection:"column",minHeight:o,marginBottom:-1,padding:"0 ".concat((0,b.bf)(a)),color:e.colorTextHeading,fontWeight:e.fontWeightStrong,fontSize:e.headerFontSize,background:e.headerBg,borderBottom:"".concat((0,b.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorderSecondary),borderRadius:"".concat((0,b.bf)(e.borderRadiusLG)," ").concat((0,b.bf)(e.borderRadiusLG)," 0 0")},(0,p.dF)()),{"&-wrapper":{width:"100%",display:"flex",alignItems:"center"},"&-title":Object.assign(Object.assign({display:"inline-block",flex:1},p.vS),{["\n > ".concat(n,"-typography,\n > ").concat(n,"-typography-edit-content\n ")]:{insetInlineStart:0,marginTop:0,marginBottom:0}}),["".concat(t,"-tabs-top")]:{clear:"both",marginBottom:r,color:e.colorText,fontWeight:"normal",fontSize:e.fontSize,"&-bar":{borderBottom:"".concat((0,b.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorderSecondary)}}})},v=e=>{let{cardPaddingBase:t,colorBorderSecondary:n,cardShadow:o,lineWidth:a}=e;return{width:"33.33%",padding:t,border:0,borderRadius:0,boxShadow:"\n ".concat((0,b.bf)(a)," 0 0 0 ").concat(n,",\n 0 ").concat((0,b.bf)(a)," 0 0 ").concat(n,",\n ").concat((0,b.bf)(a)," ").concat((0,b.bf)(a)," 0 0 ").concat(n,",\n ").concat((0,b.bf)(a)," 0 0 0 ").concat(n," inset,\n 0 ").concat((0,b.bf)(a)," 0 0 ").concat(n," inset;\n "),transition:"all ".concat(e.motionDurationMid),"&-hoverable:hover":{position:"relative",zIndex:1,boxShadow:o}}},y=e=>{let{componentCls:t,iconCls:n,actionsLiMargin:o,cardActionsIconSize:a,colorBorderSecondary:r,actionsBg:i}=e;return Object.assign(Object.assign({margin:0,padding:0,listStyle:"none",background:i,borderTop:"".concat((0,b.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(r),display:"flex",borderRadius:"0 0 ".concat((0,b.bf)(e.borderRadiusLG)," ").concat((0,b.bf)(e.borderRadiusLG))},(0,p.dF)()),{"& > li":{margin:o,color:e.colorTextDescription,textAlign:"center","> span":{position:"relative",display:"block",minWidth:e.calc(e.cardActionsIconSize).mul(2).equal(),fontSize:e.fontSize,lineHeight:e.lineHeight,cursor:"pointer","&:hover":{color:e.colorPrimary,transition:"color ".concat(e.motionDurationMid)},["a:not(".concat(t,"-btn), > ").concat(n)]:{display:"inline-block",width:"100%",color:e.colorIcon,lineHeight:(0,b.bf)(e.fontHeight),transition:"color ".concat(e.motionDurationMid),"&:hover":{color:e.colorPrimary}},["> ".concat(n)]:{fontSize:a,lineHeight:(0,b.bf)(e.calc(a).mul(e.lineHeight).equal())}},"&:not(:last-child)":{borderInlineEnd:"".concat((0,b.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(r)}}})},x=e=>Object.assign(Object.assign({margin:"".concat((0,b.bf)(e.calc(e.marginXXS).mul(-1).equal())," 0"),display:"flex"},(0,p.dF)()),{"&-avatar":{paddingInlineEnd:e.padding},"&-detail":{overflow:"hidden",flex:1,"> div:not(:last-child)":{marginBottom:e.marginXS}},"&-title":Object.assign({color:e.colorTextHeading,fontWeight:e.fontWeightStrong,fontSize:e.fontSizeLG},p.vS),"&-description":{color:e.colorTextDescription}}),k=e=>{let{componentCls:t,colorFillAlter:n,headerPadding:o,bodyPadding:a}=e;return{["".concat(t,"-head")]:{padding:"0 ".concat((0,b.bf)(o)),background:n,"&-title":{fontSize:e.fontSize}},["".concat(t,"-body")]:{padding:"".concat((0,b.bf)(e.padding)," ").concat((0,b.bf)(a))}}},w=e=>{let{componentCls:t}=e;return{overflow:"hidden",["".concat(t,"-body")]:{userSelect:"none"}}},O=e=>{let{componentCls:t,cardShadow:n,cardHeadPadding:o,colorBorderSecondary:a,boxShadowTertiary:r,bodyPadding:i,extraColor:c}=e;return{[t]:Object.assign(Object.assign({},(0,p.Wf)(e)),{position:"relative",background:e.colorBgContainer,borderRadius:e.borderRadiusLG,["&:not(".concat(t,"-bordered)")]:{boxShadow:r},["".concat(t,"-head")]:h(e),["".concat(t,"-extra")]:{marginInlineStart:"auto",color:c,fontWeight:"normal",fontSize:e.fontSize},["".concat(t,"-body")]:{padding:i,borderRadius:"0 0 ".concat((0,b.bf)(e.borderRadiusLG)," ").concat((0,b.bf)(e.borderRadiusLG))},["".concat(t,"-grid")]:v(e),["".concat(t,"-cover")]:{"> *":{display:"block",width:"100%",borderRadius:"".concat((0,b.bf)(e.borderRadiusLG)," ").concat((0,b.bf)(e.borderRadiusLG)," 0 0")}},["".concat(t,"-actions")]:y(e),["".concat(t,"-meta")]:x(e)}),["".concat(t,"-bordered")]:{border:"".concat((0,b.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(a),["".concat(t,"-cover")]:{marginTop:-1,marginInlineStart:-1,marginInlineEnd:-1}},["".concat(t,"-hoverable")]:{cursor:"pointer",transition:"box-shadow ".concat(e.motionDurationMid,", border-color ").concat(e.motionDurationMid),"&:hover":{borderColor:"transparent",boxShadow:n}},["".concat(t,"-contain-grid")]:{borderRadius:"".concat((0,b.bf)(e.borderRadiusLG)," ").concat((0,b.bf)(e.borderRadiusLG)," 0 0 "),["".concat(t,"-body")]:{display:"flex",flexWrap:"wrap"},["&:not(".concat(t,"-loading) ").concat(t,"-body")]:{marginBlockStart:e.calc(e.lineWidth).mul(-1).equal(),marginInlineStart:e.calc(e.lineWidth).mul(-1).equal(),padding:0}},["".concat(t,"-contain-tabs")]:{["> div".concat(t,"-head")]:{minHeight:0,["".concat(t,"-head-title, ").concat(t,"-extra")]:{paddingTop:o}}},["".concat(t,"-type-inner")]:k(e),["".concat(t,"-loading")]:w(e),["".concat(t,"-rtl")]:{direction:"rtl"}}},E=e=>{let{componentCls:t,bodyPaddingSM:n,headerPaddingSM:o,headerHeightSM:a,headerFontSizeSM:r}=e;return{["".concat(t,"-small")]:{["> ".concat(t,"-head")]:{minHeight:a,padding:"0 ".concat((0,b.bf)(o)),fontSize:r,["> ".concat(t,"-head-wrapper")]:{["> ".concat(t,"-extra")]:{fontSize:e.fontSize}}},["> ".concat(t,"-body")]:{padding:n}},["".concat(t,"-small").concat(t,"-contain-tabs")]:{["> ".concat(t,"-head")]:{["".concat(t,"-head-title, ").concat(t,"-extra")]:{paddingTop:0,display:"flex",alignItems:"center"}}}}};var S=(0,f.I$)("Card",e=>{let t=(0,g.IX)(e,{cardShadow:e.boxShadowCard,cardHeadPadding:e.padding,cardPaddingBase:e.paddingLG,cardActionsIconSize:e.fontSize});return[O(t),E(t)]},e=>{var t,n;return{headerBg:"transparent",headerFontSize:e.fontSizeLG,headerFontSizeSM:e.fontSize,headerHeight:e.fontSizeLG*e.lineHeightLG+2*e.padding,headerHeightSM:e.fontSize*e.lineHeight+2*e.paddingXS,actionsBg:e.colorBgContainer,actionsLiMargin:"".concat(e.paddingSM,"px 0"),tabsMarginBottom:-e.padding-e.lineWidth,extraColor:e.colorText,bodyPaddingSM:12,headerPaddingSM:12,bodyPadding:null!==(t=e.bodyPadding)&&void 0!==t?t:e.paddingLG,headerPadding:null!==(n=e.headerPadding)&&void 0!==n?n:e.paddingLG}}),C=n(56250),j=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);at.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(n[o[a]]=e[o[a]]);return n};let N=e=>{let{actionClasses:t,actions:n=[],actionStyle:a}=e;return o.createElement("ul",{className:t,style:a},n.map((e,t)=>o.createElement("li",{style:{width:"".concat(100/n.length,"%")},key:"action-".concat(t)},o.createElement("span",null,e))))},z=o.forwardRef((e,t)=>{let n;let{prefixCls:a,className:u,rootClassName:b,style:p,extra:f,headStyle:g={},bodyStyle:h={},title:v,loading:y,bordered:x,variant:k,size:w,type:O,cover:E,actions:z,tabList:L,children:T,activeTabKey:Z,defaultActiveTabKey:P,tabBarExtraContent:M,hoverable:R,tabProps:I={},classNames:B,styles:W}=e,D=j(e,["prefixCls","className","rootClassName","style","extra","headStyle","bodyStyle","title","loading","bordered","variant","size","type","cover","actions","tabList","children","activeTabKey","defaultActiveTabKey","tabBarExtraContent","hoverable","tabProps","classNames","styles"]),{getPrefixCls:H,direction:A,card:F}=o.useContext(c.E_),[q]=(0,C.Z)("card",k,x),G=e=>{var t;return r()(null===(t=null==F?void 0:F.classNames)||void 0===t?void 0:t[e],null==B?void 0:B[e])},K=e=>{var t;return Object.assign(Object.assign({},null===(t=null==F?void 0:F.styles)||void 0===t?void 0:t[e]),null==W?void 0:W[e])},V=o.useMemo(()=>{let e=!1;return o.Children.forEach(T,t=>{(null==t?void 0:t.type)===m&&(e=!0)}),e},[T]),_=H("card",a),[X,Y,$]=S(_),U=o.createElement(s.Z,{loading:!0,active:!0,paragraph:{rows:4},title:!1},T),Q=void 0!==Z,J=Object.assign(Object.assign({},I),{[Q?"activeKey":"defaultActiveKey"]:Q?Z:P,tabBarExtraContent:M}),ee=(0,l.Z)(w),et=ee&&"default"!==ee?ee:"large",en=L?o.createElement(d.default,Object.assign({size:et},J,{className:"".concat(_,"-head-tabs"),onChange:t=>{var n;null===(n=e.onTabChange)||void 0===n||n.call(e,t)},items:L.map(e=>{var{tab:t}=e;return Object.assign({label:t},j(e,["tab"]))})})):null;if(v||f||en){let e=r()("".concat(_,"-head"),G("header")),t=r()("".concat(_,"-head-title"),G("title")),a=r()("".concat(_,"-extra"),G("extra")),i=Object.assign(Object.assign({},g),K("header"));n=o.createElement("div",{className:e,style:i},o.createElement("div",{className:"".concat(_,"-head-wrapper")},v&&o.createElement("div",{className:t,style:K("title")},v),f&&o.createElement("div",{className:a,style:K("extra")},f)),en)}let eo=r()("".concat(_,"-cover"),G("cover")),ea=E?o.createElement("div",{className:eo,style:K("cover")},E):null,er=r()("".concat(_,"-body"),G("body")),ei=Object.assign(Object.assign({},h),K("body")),ec=o.createElement("div",{className:er,style:ei},y?U:T),el=r()("".concat(_,"-actions"),G("actions")),es=(null==z?void 0:z.length)?o.createElement(N,{actionClasses:el,actionStyle:K("actions"),actions:z}):null,ed=(0,i.Z)(D,["onTabChange"]),eu=r()(_,null==F?void 0:F.className,{["".concat(_,"-loading")]:y,["".concat(_,"-bordered")]:"borderless"!==q,["".concat(_,"-hoverable")]:R,["".concat(_,"-contain-grid")]:V,["".concat(_,"-contain-tabs")]:null==L?void 0:L.length,["".concat(_,"-").concat(ee)]:ee,["".concat(_,"-type-").concat(O)]:!!O,["".concat(_,"-rtl")]:"rtl"===A},u,b,Y,$),em=Object.assign(Object.assign({},null==F?void 0:F.style),p);return X(o.createElement("div",Object.assign({ref:t},ed,{className:eu,style:em}),n,ea,ec,es))});var L=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);at.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(n[o[a]]=e[o[a]]);return n};z.Grid=m,z.Meta=e=>{let{prefixCls:t,className:n,avatar:a,title:i,description:l}=e,s=L(e,["prefixCls","className","avatar","title","description"]),{getPrefixCls:d}=o.useContext(c.E_),u=d("card",t),m=r()("".concat(u,"-meta"),n),b=a?o.createElement("div",{className:"".concat(u,"-meta-avatar")},a):null,p=i?o.createElement("div",{className:"".concat(u,"-meta-title")},i):null,f=l?o.createElement("div",{className:"".concat(u,"-meta-description")},l):null,g=p||f?o.createElement("div",{className:"".concat(u,"-meta-detail")},p,f):null;return o.createElement("div",Object.assign({},s,{className:m}),b,g)};var T=z},69410:function(e,t,n){var o=n(54998);t.Z=o.Z},867:function(e,t,n){n.d(t,{Z:function(){return S}});var o=n(2265),a=n(54537),r=n(36760),i=n.n(r),c=n(50506),l=n(18694),s=n(71744),d=n(79326),u=n(59367),m=n(92570),b=n(5545),p=n(51248),f=n(55274),g=n(37381),h=n(20435),v=n(99320);let y=e=>{let{componentCls:t,iconCls:n,antCls:o,zIndexPopup:a,colorText:r,colorWarning:i,marginXXS:c,marginXS:l,fontSize:s,fontWeightStrong:d,colorTextHeading:u}=e;return{[t]:{zIndex:a,["&".concat(o,"-popover")]:{fontSize:s},["".concat(t,"-message")]:{marginBottom:l,display:"flex",flexWrap:"nowrap",alignItems:"start",["> ".concat(t,"-message-icon ").concat(n)]:{color:i,fontSize:s,lineHeight:1,marginInlineEnd:l},["".concat(t,"-title")]:{fontWeight:d,color:u,"&:only-child":{fontWeight:"normal"}},["".concat(t,"-description")]:{marginTop:c,color:r}},["".concat(t,"-buttons")]:{textAlign:"end",whiteSpace:"nowrap",button:{marginInlineStart:l}}}}};var x=(0,v.I$)("Popconfirm",e=>y(e),e=>{let{zIndexPopupBase:t}=e;return{zIndexPopup:t+60}},{resetStyle:!1}),k=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);at.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(n[o[a]]=e[o[a]]);return n};let w=e=>{let{prefixCls:t,okButtonProps:n,cancelButtonProps:r,title:i,description:c,cancelText:l,okText:d,okType:h="primary",icon:v=o.createElement(a.Z,null),showCancel:y=!0,close:x,onConfirm:k,onCancel:w,onPopupClick:O}=e,{getPrefixCls:E}=o.useContext(s.E_),[S]=(0,f.Z)("Popconfirm",g.Z.Popconfirm),C=(0,m.Z)(i),j=(0,m.Z)(c);return o.createElement("div",{className:"".concat(t,"-inner-content"),onClick:O},o.createElement("div",{className:"".concat(t,"-message")},v&&o.createElement("span",{className:"".concat(t,"-message-icon")},v),o.createElement("div",{className:"".concat(t,"-message-text")},C&&o.createElement("div",{className:"".concat(t,"-title")},C),j&&o.createElement("div",{className:"".concat(t,"-description")},j))),o.createElement("div",{className:"".concat(t,"-buttons")},y&&o.createElement(b.ZP,Object.assign({onClick:w,size:"small"},r),l||(null==S?void 0:S.cancelText)),o.createElement(u.Z,{buttonProps:Object.assign(Object.assign({size:"small"},(0,p.nx)(h)),n),actionFn:k,close:x,prefixCls:E("btn"),quitOnNullishReturnValue:!0,emitEvent:!0},d||(null==S?void 0:S.okText))))};var O=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);at.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(n[o[a]]=e[o[a]]);return n};let E=o.forwardRef((e,t)=>{var n,r;let{prefixCls:u,placement:m="top",trigger:b="click",okType:p="primary",icon:f=o.createElement(a.Z,null),children:g,overlayClassName:h,onOpenChange:v,onVisibleChange:y,overlayStyle:k,styles:E,classNames:S}=e,C=O(e,["prefixCls","placement","trigger","okType","icon","children","overlayClassName","onOpenChange","onVisibleChange","overlayStyle","styles","classNames"]),{getPrefixCls:j,className:N,style:z,classNames:L,styles:T}=(0,s.dj)("popconfirm"),[Z,P]=(0,c.Z)(!1,{value:null!==(n=e.open)&&void 0!==n?n:e.visible,defaultValue:null!==(r=e.defaultOpen)&&void 0!==r?r:e.defaultVisible}),M=(e,t)=>{P(e,!0),null==y||y(e),null==v||v(e,t)},R=j("popconfirm",u),I=i()(R,N,h,L.root,null==S?void 0:S.root),B=i()(L.body,null==S?void 0:S.body),[W]=x(R);return W(o.createElement(d.Z,Object.assign({},(0,l.Z)(C,["title"]),{trigger:b,placement:m,onOpenChange:(t,n)=>{let{disabled:o=!1}=e;o||M(t,n)},open:Z,ref:t,classNames:{root:I,body:B},styles:{root:Object.assign(Object.assign(Object.assign(Object.assign({},T.root),z),k),null==E?void 0:E.root),body:Object.assign(Object.assign({},T.body),null==E?void 0:E.body)},content:o.createElement(w,Object.assign({okType:p,icon:f},e,{prefixCls:R,close:e=>{M(!1,e)},onConfirm:t=>{var n;return null===(n=e.onConfirm)||void 0===n?void 0:n.call(void 0,t)},onCancel:t=>{var n;M(!1,t),null===(n=e.onCancel)||void 0===n||n.call(void 0,t)}})),"data-popover-inject":!0}),g))});E._InternalPanelDoNotUseOrYouWillBeFired=e=>{let{prefixCls:t,placement:n,className:a,style:r}=e,c=k(e,["prefixCls","placement","className","style"]),{getPrefixCls:l}=o.useContext(s.E_),d=l("popconfirm",t),[u]=x(d);return u(o.createElement(h.ZP,{placement:n,className:i()(d,a),style:r,content:o.createElement(w,Object.assign({prefixCls:d},c))}))};var S=E},47451:function(e,t,n){var o=n(77774);t.Z=o.Z},30401:function(e,t,n){n.d(t,{Z:function(){return o}});let o=(0,n(79205).Z)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},87769:function(e,t,n){n.d(t,{Z:function(){return o}});let o=(0,n(79205).Z)("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]])},42208:function(e,t,n){n.d(t,{Z:function(){return o}});let o=(0,n(79205).Z)("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},2356:function(e,t,n){var o=n(2265);let a=o.forwardRef(function(e,t){return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"}))});t.Z=a},15731:function(e,t,n){var o=n(2265);let a=o.forwardRef(function(e,t){return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=a},45589:function(e,t,n){var o=n(2265);let a=o.forwardRef(function(e,t){return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"}))});t.Z=a},53410:function(e,t,n){var o=n(2265);let a=o.forwardRef(function(e,t){return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"}))});t.Z=a},91126:function(e,t,n){var o=n(2265);let a=o.forwardRef(function(e,t){return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z"}),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=a}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/4292-28669d6dfecbbf62.js b/litellm/proxy/_experimental/out/_next/static/chunks/4292-28669d6dfecbbf62.js deleted file mode 100644 index db96efde944..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/4292-28669d6dfecbbf62.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4292],{84717:function(e,s,t){t.d(s,{Ct:function(){return a.Z},Dx:function(){return x.Z},OK:function(){return n.Z},Zb:function(){return r.Z},nP:function(){return m.Z},rj:function(){return i.Z},td:function(){return o.Z},v0:function(){return d.Z},x4:function(){return c.Z},xv:function(){return u.Z},zx:function(){return l.Z}});var a=t(41649),l=t(78489),r=t(12514),i=t(67101),n=t(12485),d=t(18135),o=t(35242),c=t(29706),m=t(77991),u=t(84264),x=t(96761)},40728:function(e,s,t){t.d(s,{C:function(){return a.Z},x:function(){return l.Z}});var a=t(41649),l=t(84264)},16721:function(e,s,t){t.d(s,{Dx:function(){return d.Z},JX:function(){return l.Z},oi:function(){return n.Z},rj:function(){return r.Z},xv:function(){return i.Z},zx:function(){return a.Z}});var a=t(78489),l=t(49804),r=t(67101),i=t(84264),n=t(49566),d=t(96761)},64504:function(e,s,t){t.d(s,{o:function(){return l.Z},z:function(){return a.Z}});var a=t(78489),l=t(49566)},67479:function(e,s,t){var a=t(57437),l=t(2265),r=t(37592),i=t(19250);s.Z=e=>{let{onChange:s,value:t,className:n,accessToken:d,disabled:o}=e,[c,m]=(0,l.useState)([]),[u,x]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{(async()=>{if(d){x(!0);try{let e=await (0,i.getGuardrailsList)(d);console.log("Guardrails response:",e),e.guardrails&&(console.log("Guardrails data:",e.guardrails),m(e.guardrails))}catch(e){console.error("Error fetching guardrails:",e)}finally{x(!1)}}})()},[d]),(0,a.jsx)("div",{children:(0,a.jsx)(r.default,{mode:"multiple",disabled:o,placeholder:o?"Setting guardrails is a premium feature.":"Select guardrails",onChange:e=>{console.log("Selected guardrails:",e),s(e)},value:t,loading:u,className:n,options:c.map(e=>(console.log("Mapping guardrail:",e),{label:"".concat(e.guardrail_name),value:e.guardrail_name})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"}})})}},27799:function(e,s,t){var a=t(57437);t(2265);var l=t(40728),r=t(82182),i=t(91777),n=t(97434);s.Z=function(e){let{loggingConfigs:s=[],disabledCallbacks:t=[],variant:d="card",className:o=""}=e,c=e=>{var s;return(null===(s=Object.entries(n.Lo).find(s=>{let[t,a]=s;return a===e}))||void 0===s?void 0:s[0])||e},m=e=>{switch(e){case"success":return"green";case"failure":return"red";case"success_and_failure":return"blue";default:return"gray"}},u=e=>{switch(e){case"success":return"Success Only";case"failure":return"Failure Only";case"success_and_failure":return"Success & Failure";default:return e}},x=(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(r.Z,{className:"h-4 w-4 text-blue-600"}),(0,a.jsx)(l.x,{className:"font-semibold text-gray-900",children:"Logging Integrations"}),(0,a.jsx)(l.C,{color:"blue",size:"xs",children:s.length})]}),s.length>0?(0,a.jsx)("div",{className:"space-y-3",children:s.map((e,s)=>{var t;let i=c(e.callback_name),d=null===(t=n.Dg[i])||void 0===t?void 0:t.logo;return(0,a.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-blue-50 border border-blue-200",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[d?(0,a.jsx)("img",{src:d,alt:i,className:"w-5 h-5 object-contain"}):(0,a.jsx)(r.Z,{className:"h-5 w-5 text-gray-400"}),(0,a.jsxs)("div",{children:[(0,a.jsx)(l.x,{className:"font-medium text-blue-800",children:i}),(0,a.jsxs)(l.x,{className:"text-xs text-blue-600",children:[Object.keys(e.callback_vars).length," parameters configured"]})]})]}),(0,a.jsx)(l.C,{color:m(e.callback_type),size:"sm",children:u(e.callback_type)})]},s)})}):(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,a.jsx)(r.Z,{className:"h-4 w-4 text-gray-400"}),(0,a.jsx)(l.x,{className:"text-gray-500 text-sm",children:"No logging integrations configured"})]})]}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(i.Z,{className:"h-4 w-4 text-red-600"}),(0,a.jsx)(l.x,{className:"font-semibold text-gray-900",children:"Disabled Callbacks"}),(0,a.jsx)(l.C,{color:"red",size:"xs",children:t.length})]}),t.length>0?(0,a.jsx)("div",{className:"space-y-3",children:t.map((e,s)=>{var t;let r=n.RD[e]||e,d=null===(t=n.Dg[r])||void 0===t?void 0:t.logo;return(0,a.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-red-50 border border-red-200",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[d?(0,a.jsx)("img",{src:d,alt:r,className:"w-5 h-5 object-contain"}):(0,a.jsx)(i.Z,{className:"h-5 w-5 text-gray-400"}),(0,a.jsxs)("div",{children:[(0,a.jsx)(l.x,{className:"font-medium text-red-800",children:r}),(0,a.jsx)(l.x,{className:"text-xs text-red-600",children:"Disabled for this key"})]})]}),(0,a.jsx)(l.C,{color:"red",size:"sm",children:"Disabled"})]},s)})}):(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,a.jsx)(i.Z,{className:"h-4 w-4 text-gray-400"}),(0,a.jsx)(l.x,{className:"text-gray-500 text-sm",children:"No callbacks disabled"})]})]})]});return"card"===d?(0,a.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6 ".concat(o),children:[(0,a.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,a.jsxs)("div",{children:[(0,a.jsx)(l.x,{className:"font-semibold text-gray-900",children:"Logging Settings"}),(0,a.jsx)(l.x,{className:"text-xs text-gray-500",children:"Active logging integrations and disabled callbacks for this key"})]})}),x]}):(0,a.jsxs)("div",{className:"".concat(o),children:[(0,a.jsx)(l.x,{className:"font-medium text-gray-900 mb-3",children:"Logging Settings"}),x]})}},98015:function(e,s,t){t.d(s,{Z:function(){return g}});var a=t(57437),l=t(2265),r=t(92280),i=t(40728),n=t(79814),d=t(19250),o=function(e){let{vectorStores:s,accessToken:t}=e,[r,o]=(0,l.useState)([]);(0,l.useEffect)(()=>{(async()=>{if(t&&0!==s.length)try{let e=await (0,d.vectorStoreListCall)(t);e.data&&o(e.data.map(e=>({vector_store_id:e.vector_store_id,vector_store_name:e.vector_store_name})))}catch(e){console.error("Error fetching vector stores:",e)}})()},[t,s.length]);let c=e=>{let s=r.find(s=>s.vector_store_id===e);return s?"".concat(s.vector_store_name||s.vector_store_id," (").concat(s.vector_store_id,")"):e};return(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(n.Z,{className:"h-4 w-4 text-blue-600"}),(0,a.jsx)(i.x,{className:"font-semibold text-gray-900",children:"Vector Stores"}),(0,a.jsx)(i.C,{color:"blue",size:"xs",children:s.length})]}),s.length>0?(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:s.map((e,s)=>(0,a.jsx)("div",{className:"inline-flex items-center px-3 py-1.5 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-sm font-medium",children:c(e)},s))}):(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,a.jsx)(n.Z,{className:"h-4 w-4 text-gray-400"}),(0,a.jsx)(i.x,{className:"text-gray-500 text-sm",children:"No vector stores configured"})]})]})},c=t(25327),m=t(86462),u=t(47686),x=t(99981),h=function(e){let{mcpServers:s,mcpAccessGroups:r=[],mcpToolPermissions:n={},accessToken:o}=e,[h,g]=(0,l.useState)([]),[p,j]=(0,l.useState)([]),[v,b]=(0,l.useState)(new Set),y=e=>{b(s=>{let t=new Set(s);return t.has(e)?t.delete(e):t.add(e),t})};(0,l.useEffect)(()=>{(async()=>{if(o&&s.length>0)try{let e=await (0,d.fetchMCPServers)(o);e&&Array.isArray(e)?g(e):e.data&&Array.isArray(e.data)&&g(e.data)}catch(e){console.error("Error fetching MCP servers:",e)}})()},[o,s.length]),(0,l.useEffect)(()=>{(async()=>{if(o&&r.length>0)try{let e=await Promise.resolve().then(t.bind(t,19250)).then(e=>e.fetchMCPAccessGroups(o));j(Array.isArray(e)?e:e.data||[])}catch(e){console.error("Error fetching MCP access groups:",e)}})()},[o,r.length]);let _=e=>{let s=h.find(s=>s.server_id===e);if(s){let t=e.length>7?"".concat(e.slice(0,3),"...").concat(e.slice(-4)):e;return"".concat(s.alias," (").concat(t,")")}return e},f=e=>e,N=[...s.map(e=>({type:"server",value:e})),...r.map(e=>({type:"accessGroup",value:e}))],k=N.length;return(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(c.Z,{className:"h-4 w-4 text-blue-600"}),(0,a.jsx)(i.x,{className:"font-semibold text-gray-900",children:"MCP Servers"}),(0,a.jsx)(i.C,{color:"blue",size:"xs",children:k})]}),k>0?(0,a.jsx)("div",{className:"max-h-[400px] overflow-y-auto space-y-2 pr-1",children:N.map((e,s)=>{let t="server"===e.type?n[e.value]:void 0,l=t&&t.length>0,r=v.has(e.value);return(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{onClick:()=>l&&y(e.value),className:"flex items-center gap-3 py-2 px-3 rounded-lg border border-gray-200 transition-all ".concat(l?"cursor-pointer hover:bg-gray-50 hover:border-gray-300":"bg-white"),children:[(0,a.jsx)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:"server"===e.type?(0,a.jsx)(x.Z,{title:"Full ID: ".concat(e.value),placement:"top",children:(0,a.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,a.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-blue-500 rounded-full flex-shrink-0"}),(0,a.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:_(e.value)})]})}):(0,a.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,a.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-green-500 rounded-full flex-shrink-0"}),(0,a.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:f(e.value)}),(0,a.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-[9px] font-semibold text-green-600 bg-green-50 border border-green-200 rounded uppercase tracking-wide flex-shrink-0",children:"Group"})]})}),l&&(0,a.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0 whitespace-nowrap",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-gray-600",children:t.length}),(0,a.jsx)("span",{className:"text-xs text-gray-500",children:1===t.length?"tool":"tools"}),r?(0,a.jsx)(m.Z,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"}):(0,a.jsx)(u.Z,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"})]})]}),l&&r&&(0,a.jsx)("div",{className:"ml-4 pl-4 border-l-2 border-blue-200 pb-1",children:(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:t.map((e,s)=>(0,a.jsx)("span",{className:"inline-flex items-center px-2.5 py-1 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-xs font-medium",children:e},s))})})]},s)})}):(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,a.jsx)(c.Z,{className:"h-4 w-4 text-gray-400"}),(0,a.jsx)(i.x,{className:"text-gray-500 text-sm",children:"No MCP servers or access groups configured"})]})]})},g=function(e){let{objectPermission:s,variant:t="card",className:l="",accessToken:i}=e,n=(null==s?void 0:s.vector_stores)||[],d=(null==s?void 0:s.mcp_servers)||[],c=(null==s?void 0:s.mcp_access_groups)||[],m=(null==s?void 0:s.mcp_tool_permissions)||{},u=(0,a.jsxs)("div",{className:"card"===t?"grid grid-cols-1 md:grid-cols-2 gap-6":"space-y-4",children:[(0,a.jsx)(o,{vectorStores:n,accessToken:i}),(0,a.jsx)(h,{mcpServers:d,mcpAccessGroups:c,mcpToolPermissions:m,accessToken:i})]});return"card"===t?(0,a.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6 ".concat(l),children:[(0,a.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,a.jsxs)("div",{children:[(0,a.jsx)(r.x,{className:"font-semibold text-gray-900",children:"Object Permissions"}),(0,a.jsx)(r.x,{className:"text-xs text-gray-500",children:"Access control for Vector Stores and MCP Servers"})]})}),u]}):(0,a.jsxs)("div",{className:"".concat(l),children:[(0,a.jsx)(r.x,{className:"font-medium text-gray-900 mb-3",children:"Object Permissions"}),u]})}},21425:function(e,s,t){var a=t(57437);t(2265);var l=t(54507);s.Z=e=>{let{value:s,onChange:t,disabledCallbacks:r=[],onDisabledCallbacksChange:i}=e;return(0,a.jsx)(l.Z,{value:s,onChange:t,disabledCallbacks:r,onDisabledCallbacksChange:i})}},94292:function(e,s,t){t.d(s,{Z:function(){return ee}});var a=t(57437),l=t(59872),r=t(33304),i=t(10900),n=t(23628),d=t(74998),o=t(84717),c=t(10032),m=t(5545),u=t(99981),x=t(30401),h=t(78867),g=t(2265),p=t(20347),j=t(97434),v=t(40728),b=t(58710),y=e=>{let{autoRotate:s=!1,rotationInterval:t,lastRotationAt:l,keyRotationAt:r,nextRotationAt:i,variant:d="card",className:o=""}=e,c=e=>{let s=new Date(e),t=s.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),a=s.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return"".concat(t," at ").concat(a)},m=(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsx)("div",{className:"space-y-3",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(n.Z,{className:"h-4 w-4 text-blue-600"}),(0,a.jsx)(v.x,{className:"font-semibold text-gray-900",children:"Auto-Rotation"}),(0,a.jsx)(v.C,{color:s?"green":"gray",size:"xs",children:s?"Enabled":"Disabled"}),s&&t&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(v.x,{className:"text-gray-400",children:"•"}),(0,a.jsxs)(v.x,{className:"text-sm text-gray-600",children:["Every ",t]})]})]})}),(s||l||r||i)&&(0,a.jsxs)("div",{className:"space-y-3",children:[l&&(0,a.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-200 rounded-md",children:[(0,a.jsx)(b.Z,{className:"w-4 h-4 text-gray-500"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)(v.x,{className:"font-medium text-gray-700",children:"Last Rotation"}),(0,a.jsx)(v.x,{className:"text-sm text-gray-600",children:c(l)})]})]}),(r||i)&&(0,a.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-200 rounded-md",children:[(0,a.jsx)(b.Z,{className:"w-4 h-4 text-gray-500"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)(v.x,{className:"font-medium text-gray-700",children:"Next Scheduled Rotation"}),(0,a.jsx)(v.x,{className:"text-sm text-gray-600",children:c(i||r||"")})]})]}),s&&!l&&!r&&!i&&(0,a.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-100 rounded-md",children:[(0,a.jsx)(b.Z,{className:"w-4 h-4 text-gray-500"}),(0,a.jsx)(v.x,{className:"text-gray-600",children:"No rotation history available"})]})]}),!s&&!l&&!r&&!i&&(0,a.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-100 rounded-md",children:[(0,a.jsx)(n.Z,{className:"w-4 h-4 text-gray-400"}),(0,a.jsx)(v.x,{className:"text-gray-600",children:"Auto-rotation is not enabled for this key"})]})]});return"card"===d?(0,a.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6 ".concat(o),children:[(0,a.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,a.jsxs)("div",{children:[(0,a.jsx)(v.x,{className:"font-semibold text-gray-900",children:"Auto-Rotation"}),(0,a.jsx)(v.x,{className:"text-xs text-gray-500",children:"Automatic key rotation settings and status for this key"})]})}),m]}):(0,a.jsxs)("div",{className:"".concat(o),children:[(0,a.jsx)(v.x,{className:"font-medium text-gray-900 mb-3",children:"Auto-Rotation"}),m]})};let _=["logging"],f=e=>e&&"object"==typeof e?Object.fromEntries(Object.entries(e).filter(e=>{let[s]=e;return!_.includes(s)})):{},N=e=>e&&"object"==typeof e&&Array.isArray(e.logging)?e.logging:[],k=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return JSON.stringify(f(e),null,s)},w=e=>{if(!e||"object"!=typeof e)return e;let{tags:s,...t}=e;return t};var Z=t(27799),S=t(9114),C=t(19250),A=t(98015),I=t(16721),P=t(22116),L=t(19015),M=t(92668),D=t(29233);function T(e){let{selectedToken:s,visible:t,onClose:l,accessToken:r,premiumUser:i,setAccessToken:n,onKeyUpdate:d}=e,[o]=c.Z.useForm(),[m,u]=(0,g.useState)(null),[x,h]=(0,g.useState)(null),[p,j]=(0,g.useState)(null),[v,b]=(0,g.useState)(!1),[y,_]=(0,g.useState)(!1),[f,N]=(0,g.useState)(null);(0,g.useEffect)(()=>{t&&s&&r&&(o.setFieldsValue({key_alias:s.key_alias,max_budget:s.max_budget,tpm_limit:s.tpm_limit,rpm_limit:s.rpm_limit,duration:s.duration||""}),N(r),_(s.key_name===r))},[t,s,o,r]),(0,g.useEffect)(()=>{t||(u(null),b(!1),_(!1),N(null),o.resetFields())},[t,o]);let k=e=>{if(!e)return null;try{let s;let t=new Date;if(e.endsWith("s"))s=(0,M.I)(t,{seconds:parseInt(e)});else if(e.endsWith("h"))s=(0,M.I)(t,{hours:parseInt(e)});else if(e.endsWith("d"))s=(0,M.I)(t,{days:parseInt(e)});else throw Error("Invalid duration format");return s.toLocaleString()}catch(e){return null}};(0,g.useEffect)(()=>{(null==x?void 0:x.duration)?j(k(x.duration)):j(null)},[null==x?void 0:x.duration]);let w=async()=>{if(s&&f){b(!0);try{let e=await o.validateFields(),t=await (0,C.regenerateKeyCall)(f,s.token||s.token_id,e);u(t.key),S.Z.success("API Key regenerated successfully"),console.log("Full regenerate response:",t);let a={token:t.token||t.key_id||s.token,key_name:t.key,max_budget:e.max_budget,tpm_limit:e.tpm_limit,rpm_limit:e.rpm_limit,expires:e.duration?k(e.duration):s.expires,...t};console.log("Updated key data with new token:",a),y&&(N(t.key),n&&n(t.key)),d&&d(a),b(!1)}catch(e){console.error("Error regenerating key:",e),S.Z.fromBackend(e),b(!1)}}},Z=()=>{u(null),b(!1),_(!1),N(null),o.resetFields(),l()};return(0,a.jsx)(P.Z,{title:"Regenerate API Key",open:t,onCancel:Z,footer:m?[(0,a.jsx)(I.zx,{onClick:Z,children:"Close"},"close")]:[(0,a.jsx)(I.zx,{onClick:Z,className:"mr-2",children:"Cancel"},"cancel"),(0,a.jsx)(I.zx,{onClick:w,disabled:v,children:v?"Regenerating...":"Regenerate"},"regenerate")],children:m?(0,a.jsxs)(I.rj,{numItems:1,className:"gap-2 w-full",children:[(0,a.jsx)(I.Dx,{children:"Regenerated Key"}),(0,a.jsx)(I.JX,{numColSpan:1,children:(0,a.jsxs)("p",{children:["Please replace your old key with the new key generated. For security reasons,"," ",(0,a.jsx)("b",{children:"you will not be able to view it again"})," through your LiteLLM account. If you lose this secret key, you will need to generate a new one."]})}),(0,a.jsxs)(I.JX,{numColSpan:1,children:[(0,a.jsx)(I.xv,{className:"mt-3",children:"Key Alias:"}),(0,a.jsx)("div",{className:"bg-gray-100 p-2 rounded mb-2",children:(0,a.jsx)("pre",{className:"break-words whitespace-normal",children:(null==s?void 0:s.key_alias)||"No alias set"})}),(0,a.jsx)(I.xv,{className:"mt-3",children:"New API Key:"}),(0,a.jsx)("div",{className:"bg-gray-100 p-2 rounded mb-2",children:(0,a.jsx)("pre",{className:"break-words whitespace-normal",children:m})}),(0,a.jsx)(D.CopyToClipboard,{text:m,onCopy:()=>S.Z.success("API Key copied to clipboard"),children:(0,a.jsx)(I.zx,{className:"mt-3",children:"Copy API Key"})})]})]}):(0,a.jsxs)(c.Z,{form:o,layout:"vertical",onValuesChange:e=>{"duration"in e&&h(s=>({...s,duration:e.duration}))},children:[(0,a.jsx)(c.Z.Item,{name:"key_alias",label:"Key Alias",children:(0,a.jsx)(I.oi,{disabled:!0})}),(0,a.jsx)(c.Z.Item,{name:"max_budget",label:"Max Budget (USD)",children:(0,a.jsx)(L.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,a.jsx)(c.Z.Item,{name:"tpm_limit",label:"TPM Limit",children:(0,a.jsx)(L.Z,{style:{width:"100%"}})}),(0,a.jsx)(c.Z.Item,{name:"rpm_limit",label:"RPM Limit",children:(0,a.jsx)(L.Z,{style:{width:"100%"}})}),(0,a.jsx)(c.Z.Item,{name:"duration",label:"Expire Key (eg: 30s, 30h, 30d)",className:"mt-8",children:(0,a.jsx)(I.oi,{placeholder:""})}),(0,a.jsxs)("div",{className:"mt-2 text-sm text-gray-500",children:["Current expiry: ",(null==s?void 0:s.expires)?new Date(s.expires).toLocaleString():"Never"]}),p&&(0,a.jsxs)("div",{className:"mt-2 text-sm text-green-600",children:["New expiry: ",p]})]})})}var R=t(85968),E=t(67479),z=t(64504),F=t(37592),K=t(4260),O=t(63709),U=t(62099),V=t(95096),G=t(65895),B=t(95920),W=t(68473),q=t(30874),J=t(24199),$=t(21425),Q=t(97415),X=t(15424);let Y=e=>e&&0!==e.length?e.includes("llm_api_routes")?"llm_api":e.includes("management_routes")?"management":e.includes("info_routes")?"read_only":"default":"default";function H(e){var s,t,l,r,i,n,d,o,m,x,h,p;let{keyData:v,onCancel:b,onSubmit:y,teams:_,accessToken:f,userID:Z,userRole:A,premiumUser:I=!1}=e,[P]=c.Z.useForm(),[L,M]=(0,g.useState)([]),[D,T]=(0,g.useState)([]),[R,H]=(0,g.useState)({}),ee=null==_?void 0:_.find(e=>e.team_id===v.team_id),[es,et]=(0,g.useState)([]),[ea,el]=(0,g.useState)([]),[er,ei]=(0,g.useState)(!1),[en,ed]=(0,g.useState)(Array.isArray(null===(s=v.metadata)||void 0===s?void 0:s.litellm_disabled_callbacks)?(0,j.PA)(v.metadata.litellm_disabled_callbacks):[]),[eo,ec]=(0,g.useState)(v.auto_rotate||!1),[em,eu]=(0,g.useState)(v.rotation_interval||""),[ex,eh]=(0,g.useState)(!1);(0,g.useEffect)(()=>{let e=async()=>{if(Z&&A&&f)try{if(null===v.team_id){let e=(await (0,C.modelAvailableCall)(f,Z,A)).data.map(e=>e.id);et(e)}else if(null==ee?void 0:ee.team_id){let e=await (0,q.wk)(Z,A,f,ee.team_id);et(Array.from(new Set([...ee.models,...e])))}}catch(e){console.error("Error fetching models:",e)}};(async()=>{if(f)try{let e=await (0,C.getPromptsList)(f);T(e.prompts.map(e=>e.prompt_id))}catch(e){console.error("Failed to fetch prompts:",e)}})(),e()},[Z,A,f,ee,v.team_id]),(0,g.useEffect)(()=>{P.setFieldValue("disabled_callbacks",en)},[P,en]);let eg=e=>e&&({"24h":"daily","7d":"weekly","30d":"monthly"})[e]||null,ep={...v,token:v.token||v.token_id,budget_duration:eg(v.budget_duration),metadata:k(w(v.metadata)),guardrails:null===(t=v.metadata)||void 0===t?void 0:t.guardrails,disable_global_guardrails:(null===(l=v.metadata)||void 0===l?void 0:l.disable_global_guardrails)||!1,prompts:null===(r=v.metadata)||void 0===r?void 0:r.prompts,tags:null===(i=v.metadata)||void 0===i?void 0:i.tags,vector_stores:(null===(n=v.object_permission)||void 0===n?void 0:n.vector_stores)||[],mcp_servers_and_groups:{servers:(null===(d=v.object_permission)||void 0===d?void 0:d.mcp_servers)||[],accessGroups:(null===(o=v.object_permission)||void 0===o?void 0:o.mcp_access_groups)||[]},mcp_tool_permissions:(null===(m=v.object_permission)||void 0===m?void 0:m.mcp_tool_permissions)||{},logging_settings:N(v.metadata),disabled_callbacks:Array.isArray(null===(x=v.metadata)||void 0===x?void 0:x.litellm_disabled_callbacks)?(0,j.PA)(v.metadata.litellm_disabled_callbacks):[],auto_rotate:v.auto_rotate||!1,...v.rotation_interval&&{rotation_interval:v.rotation_interval},allowed_routes:v.allowed_routes};(0,g.useEffect)(()=>{var e,s,t,a,l,r,i,n,d;P.setFieldsValue({...v,token:v.token||v.token_id,budget_duration:eg(v.budget_duration),metadata:k(w(v.metadata)),guardrails:null===(e=v.metadata)||void 0===e?void 0:e.guardrails,disable_global_guardrails:(null===(s=v.metadata)||void 0===s?void 0:s.disable_global_guardrails)||!1,prompts:null===(t=v.metadata)||void 0===t?void 0:t.prompts,tags:null===(a=v.metadata)||void 0===a?void 0:a.tags,vector_stores:(null===(l=v.object_permission)||void 0===l?void 0:l.vector_stores)||[],mcp_servers_and_groups:{servers:(null===(r=v.object_permission)||void 0===r?void 0:r.mcp_servers)||[],accessGroups:(null===(i=v.object_permission)||void 0===i?void 0:i.mcp_access_groups)||[]},mcp_tool_permissions:(null===(n=v.object_permission)||void 0===n?void 0:n.mcp_tool_permissions)||{},logging_settings:N(v.metadata),disabled_callbacks:Array.isArray(null===(d=v.metadata)||void 0===d?void 0:d.litellm_disabled_callbacks)?(0,j.PA)(v.metadata.litellm_disabled_callbacks):[],auto_rotate:v.auto_rotate||!1,...v.rotation_interval&&{rotation_interval:v.rotation_interval},allowed_routes:v.allowed_routes})},[v,P]),(0,g.useEffect)(()=>{P.setFieldValue("auto_rotate",eo)},[eo,P]),(0,g.useEffect)(()=>{em&&P.setFieldValue("rotation_interval",em)},[em,P]),(0,g.useEffect)(()=>{(async()=>{if(f)try{let e=await (0,C.tagListCall)(f);H(e)}catch(e){S.Z.fromBackend("Error fetching tags: "+e)}})()},[f]),console.log("premiumUser:",I);let ej=async e=>{try{eh(!0),await y(e)}finally{eh(!1)}};return(0,a.jsxs)(c.Z,{form:P,onFinish:ej,initialValues:ep,layout:"vertical",children:[(0,a.jsx)(c.Z.Item,{label:"Key Alias",name:"key_alias",children:(0,a.jsx)(z.o,{})}),(0,a.jsx)(c.Z.Item,{label:"Models",name:"models",children:(0,a.jsx)(c.Z.Item,{noStyle:!0,shouldUpdate:(e,s)=>e.allowed_routes!==s.allowed_routes||e.models!==s.models,children:e=>{let{getFieldValue:s,setFieldValue:t}=e,l=s("allowed_routes")||[],r=l.includes("management_routes")||l.includes("info_routes"),i=s("models")||[];return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(F.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},disabled:r,value:r?[]:i,onChange:e=>t("models",e),children:[es.length>0&&(0,a.jsx)(F.default.Option,{value:"all-team-models",children:"All Team Models"}),es.map(e=>(0,a.jsx)(F.default.Option,{value:e,children:e},e))]}),r&&(0,a.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Models field is disabled for this key type"})]})}})}),(0,a.jsx)(c.Z.Item,{label:"Key Type",children:(0,a.jsx)(c.Z.Item,{noStyle:!0,shouldUpdate:(e,s)=>e.allowed_routes!==s.allowed_routes,children:e=>{let{getFieldValue:s,setFieldValue:t}=e,l=Y(s("allowed_routes"));return(0,a.jsxs)(F.default,{placeholder:"Select key type",style:{width:"100%"},optionLabelProp:"label",value:l,onChange:e=>{switch(e){case"default":t("allowed_routes",[]);break;case"llm_api":t("allowed_routes",["llm_api_routes"]);break;case"management":t("allowed_routes",["management_routes"]),t("models",[])}},children:[(0,a.jsx)(F.default.Option,{value:"default",label:"Default",children:(0,a.jsxs)("div",{style:{padding:"4px 0"},children:[(0,a.jsx)("div",{style:{fontWeight:500},children:"Default"}),(0,a.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call LLM API + Management routes"})]})}),(0,a.jsx)(F.default.Option,{value:"llm_api",label:"LLM API",children:(0,a.jsxs)("div",{style:{padding:"4px 0"},children:[(0,a.jsx)("div",{style:{fontWeight:500},children:"LLM API"}),(0,a.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call only LLM API routes (chat/completions, embeddings, etc.)"})]})}),(0,a.jsx)(F.default.Option,{value:"management",label:"Management",children:(0,a.jsxs)("div",{style:{padding:"4px 0"},children:[(0,a.jsx)("div",{style:{fontWeight:500},children:"Management"}),(0,a.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call only management routes (user/team/key management)"})]})})]})}})}),(0,a.jsx)(c.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,a.jsx)(J.Z,{step:.01,style:{width:"100%"},placeholder:"Enter a numerical value"})}),(0,a.jsx)(c.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,a.jsxs)(F.default,{placeholder:"n/a",children:[(0,a.jsx)(F.default.Option,{value:"daily",children:"Daily"}),(0,a.jsx)(F.default.Option,{value:"weekly",children:"Weekly"}),(0,a.jsx)(F.default.Option,{value:"monthly",children:"Monthly"})]})}),(0,a.jsx)(c.Z.Item,{label:"TPM Limit",name:"tpm_limit",children:(0,a.jsx)(J.Z,{min:0})}),(0,a.jsx)(G.Z,{type:"tpm",name:"tpm_limit_type",showDetailedDescriptions:!1}),(0,a.jsx)(c.Z.Item,{label:"RPM Limit",name:"rpm_limit",children:(0,a.jsx)(J.Z,{min:0})}),(0,a.jsx)(G.Z,{type:"rpm",name:"rpm_limit_type",showDetailedDescriptions:!1}),(0,a.jsx)(c.Z.Item,{label:"Max Parallel Requests",name:"max_parallel_requests",children:(0,a.jsx)(J.Z,{min:0})}),(0,a.jsx)(c.Z.Item,{label:"Model TPM Limit",name:"model_tpm_limit",children:(0,a.jsx)(K.default.TextArea,{rows:4,placeholder:'{"gpt-4": 100, "claude-v1": 200}'})}),(0,a.jsx)(c.Z.Item,{label:"Model RPM Limit",name:"model_rpm_limit",children:(0,a.jsx)(K.default.TextArea,{rows:4,placeholder:'{"gpt-4": 100, "claude-v1": 200}'})}),(0,a.jsx)(c.Z.Item,{label:"Guardrails",name:"guardrails",children:f&&(0,a.jsx)(E.Z,{onChange:e=>{P.setFieldValue("guardrails",e)},accessToken:f,disabled:!I})}),(0,a.jsx)(c.Z.Item,{label:(0,a.jsxs)("span",{children:["Disable Global Guardrails"," ",(0,a.jsx)(u.Z,{title:"When enabled, this key will bypass any guardrails configured to run on every request (global guardrails)",children:(0,a.jsx)(X.Z,{style:{marginLeft:"4px"}})})]}),name:"disable_global_guardrails",valuePropName:"checked",children:(0,a.jsx)(O.Z,{disabled:!I,checkedChildren:"Yes",unCheckedChildren:"No"})}),(0,a.jsx)(c.Z.Item,{label:"Tags",name:"tags",children:(0,a.jsx)(F.default,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter tags",options:Object.values(R).map(e=>({value:e.name,label:e.name,title:e.description||e.name}))})}),(0,a.jsx)(c.Z.Item,{label:"Prompts",name:"prompts",children:(0,a.jsx)(u.Z,{title:I?"":"Setting prompts by key is a premium feature",placement:"top",children:(0,a.jsx)(F.default,{mode:"tags",style:{width:"100%"},disabled:!I,placeholder:I?Array.isArray(null===(h=v.metadata)||void 0===h?void 0:h.prompts)&&v.metadata.prompts.length>0?"Current: ".concat(v.metadata.prompts.join(", ")):"Select or enter prompts":"Premium feature - Upgrade to set prompts by key",options:D.map(e=>({value:e,label:e}))})})}),(0,a.jsx)(c.Z.Item,{label:"Allowed Pass Through Routes",name:"allowed_passthrough_routes",children:(0,a.jsx)(u.Z,{title:I?"":"Setting allowed pass through routes by key is a premium feature",placement:"top",children:(0,a.jsx)(V.Z,{onChange:e=>P.setFieldValue("allowed_passthrough_routes",e),value:P.getFieldValue("allowed_passthrough_routes"),accessToken:f||"",placeholder:I?Array.isArray(null===(p=v.metadata)||void 0===p?void 0:p.allowed_passthrough_routes)&&v.metadata.allowed_passthrough_routes.length>0?"Current: ".concat(v.metadata.allowed_passthrough_routes.join(", ")):"Select or enter allowed pass through routes":"Premium feature - Upgrade to set allowed pass through routes by key",disabled:!I})})}),(0,a.jsx)(c.Z.Item,{label:"Vector Stores",name:"vector_stores",children:(0,a.jsx)(Q.Z,{onChange:e=>P.setFieldValue("vector_stores",e),value:P.getFieldValue("vector_stores"),accessToken:f||"",placeholder:"Select vector stores"})}),(0,a.jsx)(c.Z.Item,{label:"MCP Servers / Access Groups",name:"mcp_servers_and_groups",children:(0,a.jsx)(B.Z,{onChange:e=>P.setFieldValue("mcp_servers_and_groups",e),value:P.getFieldValue("mcp_servers_and_groups"),accessToken:f||"",placeholder:"Select MCP servers or access groups (optional)"})}),(0,a.jsx)(c.Z.Item,{name:"mcp_tool_permissions",initialValue:{},hidden:!0,children:(0,a.jsx)(K.default,{type:"hidden"})}),(0,a.jsx)(c.Z.Item,{noStyle:!0,shouldUpdate:(e,s)=>e.mcp_servers_and_groups!==s.mcp_servers_and_groups||e.mcp_tool_permissions!==s.mcp_tool_permissions,children:()=>{var e;return(0,a.jsx)("div",{className:"mb-6",children:(0,a.jsx)(W.Z,{accessToken:f||"",selectedServers:(null===(e=P.getFieldValue("mcp_servers_and_groups"))||void 0===e?void 0:e.servers)||[],toolPermissions:P.getFieldValue("mcp_tool_permissions")||{},onChange:e=>P.setFieldsValue({mcp_tool_permissions:e})})})}}),(0,a.jsx)(c.Z.Item,{label:"Team ID",name:"team_id",children:(0,a.jsx)(F.default,{placeholder:"Select team",style:{width:"100%"},children:null==_?void 0:_.map(e=>(0,a.jsx)(F.default.Option,{value:e.team_id,children:"".concat(e.team_alias," (").concat(e.team_id,")")},e.team_id))})}),(0,a.jsx)(c.Z.Item,{label:"Logging Settings",name:"logging_settings",children:(0,a.jsx)($.Z,{value:P.getFieldValue("logging_settings"),onChange:e=>P.setFieldValue("logging_settings",e),disabledCallbacks:en,onDisabledCallbacksChange:e=>{ed((0,j.PA)(e)),P.setFieldValue("disabled_callbacks",e)}})}),(0,a.jsx)(c.Z.Item,{label:"Metadata",name:"metadata",children:(0,a.jsx)(K.default.TextArea,{rows:10})}),(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsx)(U.Z,{form:P,autoRotationEnabled:eo,onAutoRotationChange:ec,rotationInterval:em,onRotationIntervalChange:eu}),(0,a.jsx)(c.Z.Item,{name:"duration",hidden:!0,initialValue:"",children:(0,a.jsx)(K.default,{})})]}),(0,a.jsx)(c.Z.Item,{name:"token",hidden:!0,children:(0,a.jsx)(K.default,{})}),(0,a.jsx)(c.Z.Item,{name:"allowed_routes",hidden:!0,children:(0,a.jsx)(K.default,{})}),(0,a.jsx)(c.Z.Item,{name:"disabled_callbacks",hidden:!0,children:(0,a.jsx)(K.default,{})}),(0,a.jsx)(c.Z.Item,{name:"auto_rotate",hidden:!0,children:(0,a.jsx)(K.default,{})}),(0,a.jsx)(c.Z.Item,{name:"rotation_interval",hidden:!0,children:(0,a.jsx)(K.default,{})}),(0,a.jsx)("div",{className:"sticky z-10 bg-white p-4 border-t border-gray-200 bottom-[-1.5rem] inset-x-[-1.5rem]",children:(0,a.jsxs)("div",{className:"flex justify-end items-center gap-2",children:[(0,a.jsx)(z.z,{variant:"secondary",onClick:b,disabled:ex,children:"Cancel"}),(0,a.jsx)(z.z,{type:"submit",loading:ex,children:"Save Changes"})]})})]})}function ee(e){var s,t,v,b,_,f,I,P;let{keyId:L,onClose:M,keyData:D,accessToken:E,userID:z,userRole:F,teams:K,onKeyDataUpdate:O,onDelete:U,premiumUser:V,setAccessToken:G,backButtonText:B="Back to Keys"}=e,[W,q]=(0,g.useState)(!1),[J]=c.Z.useForm(),[$,Q]=(0,g.useState)(!1),[X,Y]=(0,g.useState)(""),[ee,es]=(0,g.useState)(!1),[et,ea]=(0,g.useState)({}),[el,er]=(0,g.useState)(D),[ei,en]=(0,g.useState)(null),[ed,eo]=(0,g.useState)(!1);if((0,g.useEffect)(()=>{D&&er(D)},[D]),(0,g.useEffect)(()=>{if(ed){let e=setTimeout(()=>{eo(!1)},5e3);return()=>clearTimeout(e)}},[ed]),!el)return(0,a.jsxs)("div",{className:"p-4",children:[(0,a.jsx)(o.zx,{icon:i.Z,variant:"light",onClick:M,className:"mb-4",children:B}),(0,a.jsx)(o.xv,{children:"Key not found"})]});let ec=async e=>{try{var s,t,a,l;if(!E)return;let i=e.token;if(e.key=i,V||(delete e.guardrails,delete e.prompts),e.max_budget=(0,r.C)(e.max_budget),void 0!==e.vector_stores&&(e.object_permission={...el.object_permission,vector_stores:e.vector_stores||[]},delete e.vector_stores),void 0!==e.mcp_servers_and_groups){let{servers:s,accessGroups:t}=e.mcp_servers_and_groups||{servers:[],accessGroups:[]};e.object_permission={...el.object_permission,mcp_servers:s||[],mcp_access_groups:t||[]},delete e.mcp_servers_and_groups}if(void 0!==e.mcp_tool_permissions){let s=e.mcp_tool_permissions||{};Object.keys(s).length>0&&(e.object_permission={...e.object_permission,mcp_tool_permissions:s}),delete e.mcp_tool_permissions}if(e.max_budget=(0,r.C)(e.max_budget),e.tpm_limit=(0,r.C)(e.tpm_limit),e.rpm_limit=(0,r.C)(e.rpm_limit),e.max_parallel_requests=(0,r.C)(e.max_parallel_requests),e.metadata&&"string"==typeof e.metadata)try{let a=JSON.parse(e.metadata);"tags"in a&&delete a.tags,e.metadata={...a,...Array.isArray(e.tags)&&e.tags.length>0?{tags:e.tags}:{},...(null===(s=e.guardrails)||void 0===s?void 0:s.length)>0?{guardrails:e.guardrails}:{},...e.logging_settings?{logging:e.logging_settings}:{},...(null===(t=e.disabled_callbacks)||void 0===t?void 0:t.length)>0?{litellm_disabled_callbacks:(0,j.Z3)(e.disabled_callbacks)}:{}}}catch(e){console.error("Error parsing metadata JSON:",e),S.Z.error("Invalid metadata JSON");return}else{let{tags:s,...t}=e.metadata||{};e.metadata={...t,...Array.isArray(e.tags)&&e.tags.length>0?{tags:e.tags}:{},...(null===(a=e.guardrails)||void 0===a?void 0:a.length)>0?{guardrails:e.guardrails}:{},...e.logging_settings?{logging:e.logging_settings}:{},...(null===(l=e.disabled_callbacks)||void 0===l?void 0:l.length)>0?{litellm_disabled_callbacks:(0,j.Z3)(e.disabled_callbacks)}:{}}}"tags"in e&&delete e.tags,delete e.logging_settings,e.budget_duration&&(e.budget_duration=({daily:"24h",weekly:"7d",monthly:"30d"})[e.budget_duration]);let n=await (0,C.keyUpdateCall)(E,e);er(e=>e?{...e,...n}:void 0),O&&O(n),S.Z.success("Key updated successfully"),q(!1)}catch(e){S.Z.fromBackend((0,R.O)(e)),console.error("Error updating key:",e)}},em=async()=>{try{if(!E)return;await (0,C.keyDeleteCall)(E,el.token||el.token_id),S.Z.success("Key deleted successfully"),U&&U(),M()}catch(e){console.error("Error deleting the key:",e),S.Z.fromBackend(e)}Y("")},eu=async(e,s)=>{await (0,l.vQ)(e)&&(ea(e=>({...e,[s]:!0})),setTimeout(()=>{ea(e=>({...e,[s]:!1}))},2e3))},ex=e=>{let s=new Date(e),t=s.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),a=s.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return"".concat(t," at ").concat(a)};return(0,a.jsxs)("div",{className:"w-full h-screen p-4",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(o.zx,{icon:i.Z,variant:"light",onClick:M,className:"mb-4",children:B}),(0,a.jsx)(o.Dx,{children:el.key_alias||"API Key"}),(0,a.jsxs)("div",{className:"flex items-center cursor-pointer mb-2 space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(o.xv,{className:"text-xs text-gray-400 uppercase tracking-wide mt-2",children:"Key ID"}),(0,a.jsx)(o.xv,{className:"text-gray-500 font-mono text-sm",children:el.token_id||el.token})]}),(0,a.jsx)(m.ZP,{type:"text",size:"small",icon:et["key-id"]?(0,a.jsx)(x.Z,{size:12}):(0,a.jsx)(h.Z,{size:12}),onClick:()=>eu(el.token_id||el.token,"key-id"),className:"ml-2 transition-all duration-200".concat(et["key-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,a.jsx)(o.xv,{className:"text-sm text-gray-500",children:el.updated_at&&el.updated_at!==el.created_at?"Updated: ".concat(ex(el.updated_at)):"Created: ".concat(ex(el.created_at))}),ed&&(0,a.jsx)(o.Ct,{color:"green",size:"xs",className:"animate-pulse",children:"Recently Regenerated"}),ei&&(0,a.jsx)(o.Ct,{color:"blue",size:"xs",children:"Regenerated"})]})]}),F&&p.LQ.includes(F)&&(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(u.Z,{title:V?"":"This is a LiteLLM Enterprise feature, and requires a valid key to use.",children:(0,a.jsx)("span",{className:"inline-block",children:(0,a.jsx)(o.zx,{icon:n.Z,variant:"secondary",onClick:()=>es(!0),className:"flex items-center",disabled:!V,children:"Regenerate Key"})})}),(0,a.jsx)(o.zx,{icon:d.Z,variant:"secondary",onClick:()=>Q(!0),className:"flex items-center text-red-500 border-red-500 hover:text-red-700",children:"Delete Key"})]})]}),(0,a.jsx)(T,{selectedToken:el,visible:ee,onClose:()=>es(!1),accessToken:E,premiumUser:V,setAccessToken:G,onKeyUpdate:e=>{er(s=>{if(s)return{...s,...e,created_at:new Date().toLocaleString()}}),en(new Date),eo(!0),O&&O({...e,created_at:new Date().toLocaleString()})}}),$&&(()=>{let e=(null==el?void 0:el.key_alias)||(null==el?void 0:el.token_id)||"API Key",s=X===e;return(0,a.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:(0,a.jsxs)("div",{className:"bg-white rounded-lg shadow-xl w-full max-w-2xl min-h-[380px] py-6 overflow-hidden transform transition-all flex flex-col justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-gray-900",children:"Delete Key"}),(0,a.jsx)("button",{onClick:()=>{Q(!1),Y("")},className:"text-gray-400 hover:text-gray-500 focus:outline-none",children:(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,a.jsxs)("div",{className:"px-6 py-4",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3 p-4 bg-red-50 border border-red-100 rounded-md mb-5",children:[(0,a.jsx)("div",{className:"text-red-500 mt-0.5",children:(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.082 16.5c-.77.833.192 2.5 1.732 2.5z"})})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-base font-medium text-red-600",children:"Warning: You are about to delete this API key."}),(0,a.jsx)("p",{className:"text-base text-red-600 mt-2",children:"This action is irreversible and will immediately revoke access for any applications using this key."})]})]}),(0,a.jsx)("p",{className:"text-base text-gray-600 mb-5",children:"Are you sure you want to delete this API key?"}),(0,a.jsxs)("div",{className:"mb-5",children:[(0,a.jsxs)("label",{className:"block text-base font-medium text-gray-700 mb-2",children:["Type ",(0,a.jsx)("span",{className:"underline",children:e})," to confirm deletion:"]}),(0,a.jsx)("input",{type:"text",value:X,onChange:e=>Y(e.target.value),placeholder:"Enter key name exactly",className:"w-full px-4 py-3 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-base",autoFocus:!0})]})]})]}),(0,a.jsxs)("div",{className:"px-6 py-4 bg-gray-50 flex justify-end gap-4",children:[(0,a.jsx)("button",{onClick:()=>{Q(!1),Y("")},className:"px-5 py-3 bg-white border border-gray-300 rounded-md text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:"Cancel"}),(0,a.jsx)("button",{onClick:em,disabled:!s,className:"px-5 py-3 rounded-md text-base font-medium text-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 ".concat(s?"bg-red-600 hover:bg-red-700":"bg-red-300 cursor-not-allowed"),children:"Delete Key"})]})]})})})(),(0,a.jsxs)(o.v0,{children:[(0,a.jsxs)(o.td,{className:"mb-4",children:[(0,a.jsx)(o.OK,{children:"Overview"}),(0,a.jsx)(o.OK,{children:"Settings"})]}),(0,a.jsxs)(o.nP,{children:[(0,a.jsx)(o.x4,{children:(0,a.jsxs)(o.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,a.jsxs)(o.Zb,{children:[(0,a.jsx)(o.xv,{children:"Spend"}),(0,a.jsxs)("div",{className:"mt-2",children:[(0,a.jsxs)(o.Dx,{children:["$",(0,l.pw)(el.spend,4)]}),(0,a.jsxs)(o.xv,{children:["of"," ",null!==el.max_budget?"$".concat((0,l.pw)(el.max_budget)):"Unlimited"]})]})]}),(0,a.jsxs)(o.Zb,{children:[(0,a.jsx)(o.xv,{children:"Rate Limits"}),(0,a.jsxs)("div",{className:"mt-2",children:[(0,a.jsxs)(o.xv,{children:["TPM: ",null!==el.tpm_limit?el.tpm_limit:"Unlimited"]}),(0,a.jsxs)(o.xv,{children:["RPM: ",null!==el.rpm_limit?el.rpm_limit:"Unlimited"]})]})]}),(0,a.jsxs)(o.Zb,{children:[(0,a.jsx)(o.xv,{children:"Models"}),(0,a.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:el.models&&el.models.length>0?el.models.map((e,s)=>(0,a.jsx)(o.Ct,{color:"red",children:e},s)):(0,a.jsx)(o.xv,{children:"No models specified"})})]}),(0,a.jsx)(o.Zb,{children:(0,a.jsx)(A.Z,{objectPermission:el.object_permission,variant:"inline",accessToken:E})}),(0,a.jsx)(Z.Z,{loggingConfigs:N(el.metadata),disabledCallbacks:Array.isArray(null===(s=el.metadata)||void 0===s?void 0:s.litellm_disabled_callbacks)?(0,j.PA)(el.metadata.litellm_disabled_callbacks):[],variant:"card"}),(0,a.jsx)(y,{autoRotate:el.auto_rotate,rotationInterval:el.rotation_interval,lastRotationAt:el.last_rotation_at,keyRotationAt:el.key_rotation_at,nextRotationAt:el.next_rotation_at,variant:"card"})]})}),(0,a.jsx)(o.x4,{children:(0,a.jsxs)(o.Zb,{className:"overflow-y-auto max-h-[65vh]",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,a.jsx)(o.Dx,{children:"Key Settings"}),!W&&F&&p.LQ.includes(F)&&(0,a.jsx)(o.zx,{onClick:()=>q(!0),children:"Edit Settings"})]}),W?(0,a.jsx)(H,{keyData:el,onCancel:()=>q(!1),onSubmit:ec,teams:K,accessToken:E,userID:z,userRole:F,premiumUser:V}):(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(o.xv,{className:"font-medium",children:"Key ID"}),(0,a.jsx)(o.xv,{className:"font-mono",children:el.token_id||el.token})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(o.xv,{className:"font-medium",children:"Key Alias"}),(0,a.jsx)(o.xv,{children:el.key_alias||"Not Set"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(o.xv,{className:"font-medium",children:"Secret Key"}),(0,a.jsx)(o.xv,{className:"font-mono",children:el.key_name})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(o.xv,{className:"font-medium",children:"Team ID"}),(0,a.jsx)(o.xv,{children:el.team_id||"Not Set"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(o.xv,{className:"font-medium",children:"Organization"}),(0,a.jsx)(o.xv,{children:el.organization_id||"Not Set"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(o.xv,{className:"font-medium",children:"Created"}),(0,a.jsx)(o.xv,{children:ex(el.created_at)})]}),ei&&(0,a.jsxs)("div",{children:[(0,a.jsx)(o.xv,{className:"font-medium",children:"Last Regenerated"}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(o.xv,{children:ex(ei)}),(0,a.jsx)(o.Ct,{color:"green",size:"xs",children:"Recent"})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(o.xv,{className:"font-medium",children:"Expires"}),(0,a.jsx)(o.xv,{children:el.expires?ex(el.expires):"Never"})]}),(0,a.jsx)(y,{autoRotate:el.auto_rotate,rotationInterval:el.rotation_interval,lastRotationAt:el.last_rotation_at,keyRotationAt:el.key_rotation_at,nextRotationAt:el.next_rotation_at,variant:"inline",className:"pt-4 border-t border-gray-200"}),(0,a.jsxs)("div",{children:[(0,a.jsx)(o.xv,{className:"font-medium",children:"Spend"}),(0,a.jsxs)(o.xv,{children:["$",(0,l.pw)(el.spend,4)," USD"]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(o.xv,{className:"font-medium",children:"Budget"}),(0,a.jsx)(o.xv,{children:null!==el.max_budget?"$".concat((0,l.pw)(el.max_budget,2)):"Unlimited"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(o.xv,{className:"font-medium",children:"Tags"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:Array.isArray(null===(t=el.metadata)||void 0===t?void 0:t.tags)&&el.metadata.tags.length>0?el.metadata.tags.map((e,s)=>(0,a.jsx)("span",{className:"px-2 mr-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):"No tags specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(o.xv,{className:"font-medium",children:"Prompts"}),(0,a.jsx)(o.xv,{children:Array.isArray(null===(v=el.metadata)||void 0===v?void 0:v.prompts)&&el.metadata.prompts.length>0?el.metadata.prompts.map((e,s)=>(0,a.jsx)("span",{className:"px-2 mr-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):"No prompts specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(o.xv,{className:"font-medium",children:"Allowed Pass Through Routes"}),(0,a.jsx)(o.xv,{children:Array.isArray(null===(b=el.metadata)||void 0===b?void 0:b.allowed_passthrough_routes)&&el.metadata.allowed_passthrough_routes.length>0?el.metadata.allowed_passthrough_routes.map((e,s)=>(0,a.jsx)("span",{className:"px-2 mr-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):"No pass through routes specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(o.xv,{className:"font-medium",children:"Disable Global Guardrails"}),(0,a.jsx)(o.xv,{children:(null===(_=el.metadata)||void 0===_?void 0:_.disable_global_guardrails)===!0?(0,a.jsx)(o.Ct,{color:"yellow",children:"Enabled - Global guardrails bypassed"}):(0,a.jsx)(o.Ct,{color:"green",children:"Disabled - Global guardrails active"})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(o.xv,{className:"font-medium",children:"Models"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:el.models&&el.models.length>0?el.models.map((e,s)=>(0,a.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):(0,a.jsx)(o.xv,{children:"No models specified"})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(o.xv,{className:"font-medium",children:"Rate Limits"}),(0,a.jsxs)(o.xv,{children:["TPM: ",null!==el.tpm_limit?el.tpm_limit:"Unlimited"]}),(0,a.jsxs)(o.xv,{children:["RPM: ",null!==el.rpm_limit?el.rpm_limit:"Unlimited"]}),(0,a.jsxs)(o.xv,{children:["Max Parallel Requests:"," ",null!==el.max_parallel_requests?el.max_parallel_requests:"Unlimited"]}),(0,a.jsxs)(o.xv,{children:["Model TPM Limits:"," ",(null===(f=el.metadata)||void 0===f?void 0:f.model_tpm_limit)?JSON.stringify(el.metadata.model_tpm_limit):"Unlimited"]}),(0,a.jsxs)(o.xv,{children:["Model RPM Limits:"," ",(null===(I=el.metadata)||void 0===I?void 0:I.model_rpm_limit)?JSON.stringify(el.metadata.model_rpm_limit):"Unlimited"]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(o.xv,{className:"font-medium",children:"Metadata"}),(0,a.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:k(w(el.metadata))})]}),(0,a.jsx)(A.Z,{objectPermission:el.object_permission,variant:"inline",className:"pt-4 border-t border-gray-200",accessToken:E}),(0,a.jsx)(Z.Z,{loggingConfigs:N(el.metadata),disabledCallbacks:Array.isArray(null===(P=el.metadata)||void 0===P?void 0:P.litellm_disabled_callbacks)?(0,j.PA)(el.metadata.litellm_disabled_callbacks):[],variant:"inline",className:"pt-4 border-t border-gray-200"})]})]})})]})]})]})}},33304:function(e,s,t){t.d(s,{C:function(){return a}});function a(e){return""===e?null:e}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/4292-c551871b8fc9bf85.js b/litellm/proxy/_experimental/out/_next/static/chunks/4292-c551871b8fc9bf85.js new file mode 100644 index 00000000000..2bd58db4123 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/4292-c551871b8fc9bf85.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4292],{84717:function(e,s,a){a.d(s,{Ct:function(){return t.Z},Dx:function(){return x.Z},OK:function(){return n.Z},Zb:function(){return r.Z},nP:function(){return m.Z},rj:function(){return i.Z},td:function(){return o.Z},v0:function(){return d.Z},x4:function(){return c.Z},xv:function(){return u.Z},zx:function(){return l.Z}});var t=a(41649),l=a(78489),r=a(12514),i=a(67101),n=a(12485),d=a(18135),o=a(35242),c=a(29706),m=a(77991),u=a(84264),x=a(96761)},40728:function(e,s,a){a.d(s,{C:function(){return t.Z},x:function(){return l.Z}});var t=a(41649),l=a(84264)},16721:function(e,s,a){a.d(s,{Dx:function(){return d.Z},JX:function(){return l.Z},oi:function(){return n.Z},rj:function(){return r.Z},xv:function(){return i.Z},zx:function(){return t.Z}});var t=a(78489),l=a(49804),r=a(67101),i=a(84264),n=a(49566),d=a(96761)},64504:function(e,s,a){a.d(s,{o:function(){return l.Z},z:function(){return t.Z}});var t=a(78489),l=a(49566)},67479:function(e,s,a){var t=a(57437),l=a(2265),r=a(37592),i=a(19250);s.Z=e=>{let{onChange:s,value:a,className:n,accessToken:d,disabled:o}=e,[c,m]=(0,l.useState)([]),[u,x]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{(async()=>{if(d){x(!0);try{let e=await (0,i.getGuardrailsList)(d);console.log("Guardrails response:",e),e.guardrails&&(console.log("Guardrails data:",e.guardrails),m(e.guardrails))}catch(e){console.error("Error fetching guardrails:",e)}finally{x(!1)}}})()},[d]),(0,t.jsx)("div",{children:(0,t.jsx)(r.default,{mode:"multiple",disabled:o,placeholder:o?"Setting guardrails is a premium feature.":"Select guardrails",onChange:e=>{console.log("Selected guardrails:",e),s(e)},value:a,loading:u,className:n,options:c.map(e=>(console.log("Mapping guardrail:",e),{label:"".concat(e.guardrail_name),value:e.guardrail_name})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"}})})}},27799:function(e,s,a){var t=a(57437);a(2265);var l=a(40728),r=a(82182),i=a(91777),n=a(97434);s.Z=function(e){let{loggingConfigs:s=[],disabledCallbacks:a=[],variant:d="card",className:o=""}=e,c=e=>{var s;return(null===(s=Object.entries(n.Lo).find(s=>{let[a,t]=s;return t===e}))||void 0===s?void 0:s[0])||e},m=e=>{switch(e){case"success":return"green";case"failure":return"red";case"success_and_failure":return"blue";default:return"gray"}},u=e=>{switch(e){case"success":return"Success Only";case"failure":return"Failure Only";case"success_and_failure":return"Success & Failure";default:return e}},x=(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(r.Z,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(l.x,{className:"font-semibold text-gray-900",children:"Logging Integrations"}),(0,t.jsx)(l.C,{color:"blue",size:"xs",children:s.length})]}),s.length>0?(0,t.jsx)("div",{className:"space-y-3",children:s.map((e,s)=>{var a;let i=c(e.callback_name),d=null===(a=n.Dg[i])||void 0===a?void 0:a.logo;return(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-blue-50 border border-blue-200",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[d?(0,t.jsx)("img",{src:d,alt:i,className:"w-5 h-5 object-contain"}):(0,t.jsx)(r.Z,{className:"h-5 w-5 text-gray-400"}),(0,t.jsxs)("div",{children:[(0,t.jsx)(l.x,{className:"font-medium text-blue-800",children:i}),(0,t.jsxs)(l.x,{className:"text-xs text-blue-600",children:[Object.keys(e.callback_vars).length," parameters configured"]})]})]}),(0,t.jsx)(l.C,{color:m(e.callback_type),size:"sm",children:u(e.callback_type)})]},s)})}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(r.Z,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(l.x,{className:"text-gray-500 text-sm",children:"No logging integrations configured"})]})]}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(i.Z,{className:"h-4 w-4 text-red-600"}),(0,t.jsx)(l.x,{className:"font-semibold text-gray-900",children:"Disabled Callbacks"}),(0,t.jsx)(l.C,{color:"red",size:"xs",children:a.length})]}),a.length>0?(0,t.jsx)("div",{className:"space-y-3",children:a.map((e,s)=>{var a;let r=n.RD[e]||e,d=null===(a=n.Dg[r])||void 0===a?void 0:a.logo;return(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-red-50 border border-red-200",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[d?(0,t.jsx)("img",{src:d,alt:r,className:"w-5 h-5 object-contain"}):(0,t.jsx)(i.Z,{className:"h-5 w-5 text-gray-400"}),(0,t.jsxs)("div",{children:[(0,t.jsx)(l.x,{className:"font-medium text-red-800",children:r}),(0,t.jsx)(l.x,{className:"text-xs text-red-600",children:"Disabled for this key"})]})]}),(0,t.jsx)(l.C,{color:"red",size:"sm",children:"Disabled"})]},s)})}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(i.Z,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(l.x,{className:"text-gray-500 text-sm",children:"No callbacks disabled"})]})]})]});return"card"===d?(0,t.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6 ".concat(o),children:[(0,t.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(l.x,{className:"font-semibold text-gray-900",children:"Logging Settings"}),(0,t.jsx)(l.x,{className:"text-xs text-gray-500",children:"Active logging integrations and disabled callbacks for this key"})]})}),x]}):(0,t.jsxs)("div",{className:"".concat(o),children:[(0,t.jsx)(l.x,{className:"font-medium text-gray-900 mb-3",children:"Logging Settings"}),x]})}},60131:function(e,s,a){a.d(s,{Z:function(){return j}});var t=a(57437),l=a(2265),r=a(92280),i=a(40728),n=a(79814),d=a(19250),o=function(e){let{vectorStores:s,accessToken:a}=e,[r,o]=(0,l.useState)([]);(0,l.useEffect)(()=>{(async()=>{if(a&&0!==s.length)try{let e=await (0,d.vectorStoreListCall)(a);e.data&&o(e.data.map(e=>({vector_store_id:e.vector_store_id,vector_store_name:e.vector_store_name})))}catch(e){console.error("Error fetching vector stores:",e)}})()},[a,s.length]);let c=e=>{let s=r.find(s=>s.vector_store_id===e);return s?"".concat(s.vector_store_name||s.vector_store_id," (").concat(s.vector_store_id,")"):e};return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(n.Z,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(i.x,{className:"font-semibold text-gray-900",children:"Vector Stores"}),(0,t.jsx)(i.C,{color:"blue",size:"xs",children:s.length})]}),s.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:s.map((e,s)=>(0,t.jsx)("div",{className:"inline-flex items-center px-3 py-1.5 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-sm font-medium",children:c(e)},s))}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(n.Z,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(i.x,{className:"text-gray-500 text-sm",children:"No vector stores configured"})]})]})},c=a(25327),m=a(86462),u=a(47686),x=a(99981),g=function(e){let{mcpServers:s,mcpAccessGroups:r=[],mcpToolPermissions:n={},accessToken:o}=e,[g,h]=(0,l.useState)([]),[p,j]=(0,l.useState)([]),[v,b]=(0,l.useState)(new Set),y=e=>{b(s=>{let a=new Set(s);return a.has(e)?a.delete(e):a.add(e),a})};(0,l.useEffect)(()=>{(async()=>{if(o&&s.length>0)try{let e=await (0,d.fetchMCPServers)(o);e&&Array.isArray(e)?h(e):e.data&&Array.isArray(e.data)&&h(e.data)}catch(e){console.error("Error fetching MCP servers:",e)}})()},[o,s.length]),(0,l.useEffect)(()=>{(async()=>{if(o&&r.length>0)try{let e=await Promise.resolve().then(a.bind(a,19250)).then(e=>e.fetchMCPAccessGroups(o));j(Array.isArray(e)?e:e.data||[])}catch(e){console.error("Error fetching MCP access groups:",e)}})()},[o,r.length]);let _=e=>{let s=g.find(s=>s.server_id===e);if(s){let a=e.length>7?"".concat(e.slice(0,3),"...").concat(e.slice(-4)):e;return"".concat(s.alias," (").concat(a,")")}return e},f=e=>e,N=[...s.map(e=>({type:"server",value:e})),...r.map(e=>({type:"accessGroup",value:e}))],k=N.length;return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(c.Z,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(i.x,{className:"font-semibold text-gray-900",children:"MCP Servers"}),(0,t.jsx)(i.C,{color:"blue",size:"xs",children:k})]}),k>0?(0,t.jsx)("div",{className:"max-h-[400px] overflow-y-auto space-y-2 pr-1",children:N.map((e,s)=>{let a="server"===e.type?n[e.value]:void 0,l=a&&a.length>0,r=v.has(e.value);return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{onClick:()=>l&&y(e.value),className:"flex items-center gap-3 py-2 px-3 rounded-lg border border-gray-200 transition-all ".concat(l?"cursor-pointer hover:bg-gray-50 hover:border-gray-300":"bg-white"),children:[(0,t.jsx)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:"server"===e.type?(0,t.jsx)(x.Z,{title:"Full ID: ".concat(e.value),placement:"top",children:(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-blue-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:_(e.value)})]})}):(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-green-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:f(e.value)}),(0,t.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-[9px] font-semibold text-green-600 bg-green-50 border border-green-200 rounded uppercase tracking-wide flex-shrink-0",children:"Group"})]})}),l&&(0,t.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0 whitespace-nowrap",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-600",children:a.length}),(0,t.jsx)("span",{className:"text-xs text-gray-500",children:1===a.length?"tool":"tools"}),r?(0,t.jsx)(m.Z,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"}):(0,t.jsx)(u.Z,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"})]})]}),l&&r&&(0,t.jsx)("div",{className:"ml-4 pl-4 border-l-2 border-blue-200 pb-1",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.map((e,s)=>(0,t.jsx)("span",{className:"inline-flex items-center px-2.5 py-1 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-xs font-medium",children:e},s))})})]},s)})}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(c.Z,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(i.x,{className:"text-gray-500 text-sm",children:"No MCP servers or access groups configured"})]})]})},h=a(3497),p=function(e){let{agents:s,agentAccessGroups:a=[],accessToken:r}=e,[n,o]=(0,l.useState)([]);(0,l.useEffect)(()=>{(async()=>{if(r&&s.length>0)try{let e=await (0,d.getAgentsList)(r);e&&e.agents&&Array.isArray(e.agents)&&o(e.agents)}catch(e){console.error("Error fetching agents:",e)}})()},[r,s.length]);let c=e=>{let s=n.find(s=>s.agent_id===e);if(s){let a=e.length>7?"".concat(e.slice(0,3),"...").concat(e.slice(-4)):e;return"".concat(s.agent_name," (").concat(a,")")}return e},m=[...s.map(e=>({type:"agent",value:e})),...a.map(e=>({type:"accessGroup",value:e}))],u=m.length;return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(h.Z,{className:"h-4 w-4 text-purple-600"}),(0,t.jsx)(i.x,{className:"font-semibold text-gray-900",children:"Agents"}),(0,t.jsx)(i.C,{color:"purple",size:"xs",children:u})]}),u>0?(0,t.jsx)("div",{className:"max-h-[400px] overflow-y-auto space-y-2 pr-1",children:m.map((e,s)=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsx)("div",{className:"flex items-center gap-3 py-2 px-3 rounded-lg border border-gray-200 bg-white",children:(0,t.jsx)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:"agent"===e.type?(0,t.jsx)(x.Z,{title:"Full ID: ".concat(e.value),placement:"top",children:(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-purple-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:c(e.value)})]})}):(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-green-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:e.value}),(0,t.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-[9px] font-semibold text-green-600 bg-green-50 border border-green-200 rounded uppercase tracking-wide flex-shrink-0",children:"Group"})]})})})},s))}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(h.Z,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(i.x,{className:"text-gray-500 text-sm",children:"No agents or access groups configured"})]})]})},j=function(e){let{objectPermission:s,variant:a="card",className:l="",accessToken:i}=e,n=(null==s?void 0:s.vector_stores)||[],d=(null==s?void 0:s.mcp_servers)||[],c=(null==s?void 0:s.mcp_access_groups)||[],m=(null==s?void 0:s.mcp_tool_permissions)||{},u=(null==s?void 0:s.agents)||[],x=(null==s?void 0:s.agent_access_groups)||[],h=(0,t.jsxs)("div",{className:"card"===a?"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6":"space-y-4",children:[(0,t.jsx)(o,{vectorStores:n,accessToken:i}),(0,t.jsx)(g,{mcpServers:d,mcpAccessGroups:c,mcpToolPermissions:m,accessToken:i}),(0,t.jsx)(p,{agents:u,agentAccessGroups:x,accessToken:i})]});return"card"===a?(0,t.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6 ".concat(l),children:[(0,t.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(r.x,{className:"font-semibold text-gray-900",children:"Object Permissions"}),(0,t.jsx)(r.x,{className:"text-xs text-gray-500",children:"Access control for Vector Stores and MCP Servers"})]})}),h]}):(0,t.jsxs)("div",{className:"".concat(l),children:[(0,t.jsx)(r.x,{className:"font-medium text-gray-900 mb-3",children:"Object Permissions"}),h]})}},21425:function(e,s,a){var t=a(57437);a(2265);var l=a(54507);s.Z=e=>{let{value:s,onChange:a,disabledCallbacks:r=[],onDisabledCallbacksChange:i}=e;return(0,t.jsx)(l.Z,{value:s,onChange:a,disabledCallbacks:r,onDisabledCallbacksChange:i})}},94292:function(e,s,a){a.d(s,{Z:function(){return es}});var t=a(57437),l=a(59872),r=a(33304),i=a(77331),n=a(23628),d=a(74998),o=a(84717),c=a(10032),m=a(5545),u=a(99981),x=a(30401),g=a(78867),h=a(2265),p=a(20347),j=a(97434),v=a(40728),b=a(58710),y=e=>{let{autoRotate:s=!1,rotationInterval:a,lastRotationAt:l,keyRotationAt:r,nextRotationAt:i,variant:d="card",className:o=""}=e,c=e=>{let s=new Date(e),a=s.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),t=s.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return"".concat(a," at ").concat(t)},m=(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsx)("div",{className:"space-y-3",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(n.Z,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(v.x,{className:"font-semibold text-gray-900",children:"Auto-Rotation"}),(0,t.jsx)(v.C,{color:s?"green":"gray",size:"xs",children:s?"Enabled":"Disabled"}),s&&a&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(v.x,{className:"text-gray-400",children:"•"}),(0,t.jsxs)(v.x,{className:"text-sm text-gray-600",children:["Every ",a]})]})]})}),(s||l||r||i)&&(0,t.jsxs)("div",{className:"space-y-3",children:[l&&(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-200 rounded-md",children:[(0,t.jsx)(b.Z,{className:"w-4 h-4 text-gray-500"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)(v.x,{className:"font-medium text-gray-700",children:"Last Rotation"}),(0,t.jsx)(v.x,{className:"text-sm text-gray-600",children:c(l)})]})]}),(r||i)&&(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-200 rounded-md",children:[(0,t.jsx)(b.Z,{className:"w-4 h-4 text-gray-500"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)(v.x,{className:"font-medium text-gray-700",children:"Next Scheduled Rotation"}),(0,t.jsx)(v.x,{className:"text-sm text-gray-600",children:c(i||r||"")})]})]}),s&&!l&&!r&&!i&&(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-100 rounded-md",children:[(0,t.jsx)(b.Z,{className:"w-4 h-4 text-gray-500"}),(0,t.jsx)(v.x,{className:"text-gray-600",children:"No rotation history available"})]})]}),!s&&!l&&!r&&!i&&(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-100 rounded-md",children:[(0,t.jsx)(n.Z,{className:"w-4 h-4 text-gray-400"}),(0,t.jsx)(v.x,{className:"text-gray-600",children:"Auto-rotation is not enabled for this key"})]})]});return"card"===d?(0,t.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6 ".concat(o),children:[(0,t.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(v.x,{className:"font-semibold text-gray-900",children:"Auto-Rotation"}),(0,t.jsx)(v.x,{className:"text-xs text-gray-500",children:"Automatic key rotation settings and status for this key"})]})}),m]}):(0,t.jsxs)("div",{className:"".concat(o),children:[(0,t.jsx)(v.x,{className:"font-medium text-gray-900 mb-3",children:"Auto-Rotation"}),m]})};let _=["logging"],f=e=>e&&"object"==typeof e?Object.fromEntries(Object.entries(e).filter(e=>{let[s]=e;return!_.includes(s)})):{},N=e=>e&&"object"==typeof e&&Array.isArray(e.logging)?e.logging:[],k=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return JSON.stringify(f(e),null,s)},w=e=>{if(!e||"object"!=typeof e)return e;let{tags:s,...a}=e;return a};var Z=a(27799),S=a(9114),C=a(19250),A=a(60131),I=a(16721),L=a(22116),P=a(19015),M=a(92668),D=a(29233);function T(e){let{selectedToken:s,visible:a,onClose:l,accessToken:r,premiumUser:i,setAccessToken:n,onKeyUpdate:d}=e,[o]=c.Z.useForm(),[m,u]=(0,h.useState)(null),[x,g]=(0,h.useState)(null),[p,j]=(0,h.useState)(null),[v,b]=(0,h.useState)(!1),[y,_]=(0,h.useState)(!1),[f,N]=(0,h.useState)(null);(0,h.useEffect)(()=>{a&&s&&r&&(o.setFieldsValue({key_alias:s.key_alias,max_budget:s.max_budget,tpm_limit:s.tpm_limit,rpm_limit:s.rpm_limit,duration:s.duration||""}),N(r),_(s.key_name===r))},[a,s,o,r]),(0,h.useEffect)(()=>{a||(u(null),b(!1),_(!1),N(null),o.resetFields())},[a,o]);let k=e=>{if(!e)return null;try{let s;let a=new Date;if(e.endsWith("s"))s=(0,M.I)(a,{seconds:parseInt(e)});else if(e.endsWith("h"))s=(0,M.I)(a,{hours:parseInt(e)});else if(e.endsWith("d"))s=(0,M.I)(a,{days:parseInt(e)});else throw Error("Invalid duration format");return s.toLocaleString()}catch(e){return null}};(0,h.useEffect)(()=>{(null==x?void 0:x.duration)?j(k(x.duration)):j(null)},[null==x?void 0:x.duration]);let w=async()=>{if(s&&f){b(!0);try{let e=await o.validateFields(),a=await (0,C.regenerateKeyCall)(f,s.token||s.token_id,e);u(a.key),S.Z.success("Virtual Key regenerated successfully"),console.log("Full regenerate response:",a);let t={token:a.token||a.key_id||s.token,key_name:a.key,max_budget:e.max_budget,tpm_limit:e.tpm_limit,rpm_limit:e.rpm_limit,expires:e.duration?k(e.duration):s.expires,...a};console.log("Updated key data with new token:",t),y&&(N(a.key),n&&n(a.key)),d&&d(t),b(!1)}catch(e){console.error("Error regenerating key:",e),S.Z.fromBackend(e),b(!1)}}},Z=()=>{u(null),b(!1),_(!1),N(null),o.resetFields(),l()};return(0,t.jsx)(L.Z,{title:"Regenerate Virtual Key",open:a,onCancel:Z,footer:m?[(0,t.jsx)(I.zx,{onClick:Z,children:"Close"},"close")]:[(0,t.jsx)(I.zx,{onClick:Z,className:"mr-2",children:"Cancel"},"cancel"),(0,t.jsx)(I.zx,{onClick:w,disabled:v,children:v?"Regenerating...":"Regenerate"},"regenerate")],children:m?(0,t.jsxs)(I.rj,{numItems:1,className:"gap-2 w-full",children:[(0,t.jsx)(I.Dx,{children:"Regenerated Key"}),(0,t.jsx)(I.JX,{numColSpan:1,children:(0,t.jsxs)("p",{children:["Please replace your old key with the new key generated. For security reasons,"," ",(0,t.jsx)("b",{children:"you will not be able to view it again"})," through your LiteLLM account. If you lose this secret key, you will need to generate a new one."]})}),(0,t.jsxs)(I.JX,{numColSpan:1,children:[(0,t.jsx)(I.xv,{className:"mt-3",children:"Key Alias:"}),(0,t.jsx)("div",{className:"bg-gray-100 p-2 rounded mb-2",children:(0,t.jsx)("pre",{className:"break-words whitespace-normal",children:(null==s?void 0:s.key_alias)||"No alias set"})}),(0,t.jsx)(I.xv,{className:"mt-3",children:"New Virtual Key:"}),(0,t.jsx)("div",{className:"bg-gray-100 p-2 rounded mb-2",children:(0,t.jsx)("pre",{className:"break-words whitespace-normal",children:m})}),(0,t.jsx)(D.CopyToClipboard,{text:m,onCopy:()=>S.Z.success("Virtual Key copied to clipboard"),children:(0,t.jsx)(I.zx,{className:"mt-3",children:"Copy Virtual Key"})})]})]}):(0,t.jsxs)(c.Z,{form:o,layout:"vertical",onValuesChange:e=>{"duration"in e&&g(s=>({...s,duration:e.duration}))},children:[(0,t.jsx)(c.Z.Item,{name:"key_alias",label:"Key Alias",children:(0,t.jsx)(I.oi,{disabled:!0})}),(0,t.jsx)(c.Z.Item,{name:"max_budget",label:"Max Budget (USD)",children:(0,t.jsx)(P.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,t.jsx)(c.Z.Item,{name:"tpm_limit",label:"TPM Limit",children:(0,t.jsx)(P.Z,{style:{width:"100%"}})}),(0,t.jsx)(c.Z.Item,{name:"rpm_limit",label:"RPM Limit",children:(0,t.jsx)(P.Z,{style:{width:"100%"}})}),(0,t.jsx)(c.Z.Item,{name:"duration",label:"Expire Key (eg: 30s, 30h, 30d)",className:"mt-8",children:(0,t.jsx)(I.oi,{placeholder:""})}),(0,t.jsxs)("div",{className:"mt-2 text-sm text-gray-500",children:["Current expiry: ",(null==s?void 0:s.expires)?new Date(s.expires).toLocaleString():"Never"]}),p&&(0,t.jsxs)("div",{className:"mt-2 text-sm text-green-600",children:["New expiry: ",p]})]})})}var E=a(85968),R=a(67479),F=a(64504),z=a(37592),V=a(4260),K=a(63709),O=a(62099),U=a(95096),G=a(65895),B=a(95920),W=a(68473),q=a(82586),J=a(30874),$=a(24199),Q=a(21425),X=a(97415),Y=a(15424);let H=e=>e&&0!==e.length?e.includes("llm_api_routes")?"llm_api":e.includes("management_routes")?"management":e.includes("info_routes")?"read_only":"default":"default";function ee(e){var s,a,l,r,i,n,d,o,m,x,g,p,v,b;let{keyData:y,onCancel:_,onSubmit:f,teams:Z,accessToken:A,userID:I,userRole:L,premiumUser:P=!1}=e,[M]=c.Z.useForm(),[D,T]=(0,h.useState)([]),[E,ee]=(0,h.useState)([]),[es,ea]=(0,h.useState)({}),et=null==Z?void 0:Z.find(e=>e.team_id===y.team_id),[el,er]=(0,h.useState)([]),[ei,en]=(0,h.useState)([]),[ed,eo]=(0,h.useState)(!1),[ec,em]=(0,h.useState)(Array.isArray(null===(s=y.metadata)||void 0===s?void 0:s.litellm_disabled_callbacks)?(0,j.PA)(y.metadata.litellm_disabled_callbacks):[]),[eu,ex]=(0,h.useState)(y.auto_rotate||!1),[eg,eh]=(0,h.useState)(y.rotation_interval||""),[ep,ej]=(0,h.useState)(!1);(0,h.useEffect)(()=>{let e=async()=>{if(I&&L&&A)try{if(null===y.team_id){let e=(await (0,C.modelAvailableCall)(A,I,L)).data.map(e=>e.id);er(e)}else if(null==et?void 0:et.team_id){let e=await (0,J.wk)(I,L,A,et.team_id);er(Array.from(new Set([...et.models,...e])))}}catch(e){console.error("Error fetching models:",e)}};(async()=>{if(A)try{let e=await (0,C.getPromptsList)(A);ee(e.prompts.map(e=>e.prompt_id))}catch(e){console.error("Failed to fetch prompts:",e)}})(),e()},[I,L,A,et,y.team_id]),(0,h.useEffect)(()=>{M.setFieldValue("disabled_callbacks",ec)},[M,ec]);let ev=e=>e&&({"24h":"daily","7d":"weekly","30d":"monthly"})[e]||null,eb={...y,token:y.token||y.token_id,budget_duration:ev(y.budget_duration),metadata:k(w(y.metadata)),guardrails:null===(a=y.metadata)||void 0===a?void 0:a.guardrails,disable_global_guardrails:(null===(l=y.metadata)||void 0===l?void 0:l.disable_global_guardrails)||!1,prompts:null===(r=y.metadata)||void 0===r?void 0:r.prompts,tags:null===(i=y.metadata)||void 0===i?void 0:i.tags,vector_stores:(null===(n=y.object_permission)||void 0===n?void 0:n.vector_stores)||[],mcp_servers_and_groups:{servers:(null===(d=y.object_permission)||void 0===d?void 0:d.mcp_servers)||[],accessGroups:(null===(o=y.object_permission)||void 0===o?void 0:o.mcp_access_groups)||[]},mcp_tool_permissions:(null===(m=y.object_permission)||void 0===m?void 0:m.mcp_tool_permissions)||{},agents_and_groups:{agents:(null===(x=y.object_permission)||void 0===x?void 0:x.agents)||[],accessGroups:(null===(g=y.object_permission)||void 0===g?void 0:g.agent_access_groups)||[]},logging_settings:N(y.metadata),disabled_callbacks:Array.isArray(null===(p=y.metadata)||void 0===p?void 0:p.litellm_disabled_callbacks)?(0,j.PA)(y.metadata.litellm_disabled_callbacks):[],auto_rotate:y.auto_rotate||!1,...y.rotation_interval&&{rotation_interval:y.rotation_interval},allowed_routes:y.allowed_routes};(0,h.useEffect)(()=>{var e,s,a,t,l,r,i,n,d;M.setFieldsValue({...y,token:y.token||y.token_id,budget_duration:ev(y.budget_duration),metadata:k(w(y.metadata)),guardrails:null===(e=y.metadata)||void 0===e?void 0:e.guardrails,disable_global_guardrails:(null===(s=y.metadata)||void 0===s?void 0:s.disable_global_guardrails)||!1,prompts:null===(a=y.metadata)||void 0===a?void 0:a.prompts,tags:null===(t=y.metadata)||void 0===t?void 0:t.tags,vector_stores:(null===(l=y.object_permission)||void 0===l?void 0:l.vector_stores)||[],mcp_servers_and_groups:{servers:(null===(r=y.object_permission)||void 0===r?void 0:r.mcp_servers)||[],accessGroups:(null===(i=y.object_permission)||void 0===i?void 0:i.mcp_access_groups)||[]},mcp_tool_permissions:(null===(n=y.object_permission)||void 0===n?void 0:n.mcp_tool_permissions)||{},logging_settings:N(y.metadata),disabled_callbacks:Array.isArray(null===(d=y.metadata)||void 0===d?void 0:d.litellm_disabled_callbacks)?(0,j.PA)(y.metadata.litellm_disabled_callbacks):[],auto_rotate:y.auto_rotate||!1,...y.rotation_interval&&{rotation_interval:y.rotation_interval},allowed_routes:y.allowed_routes})},[y,M]),(0,h.useEffect)(()=>{M.setFieldValue("auto_rotate",eu)},[eu,M]),(0,h.useEffect)(()=>{eg&&M.setFieldValue("rotation_interval",eg)},[eg,M]),(0,h.useEffect)(()=>{(async()=>{if(A)try{let e=await (0,C.tagListCall)(A);ea(e)}catch(e){S.Z.fromBackend("Error fetching tags: "+e)}})()},[A]),console.log("premiumUser:",P);let ey=async e=>{try{ej(!0),await f(e)}finally{ej(!1)}};return(0,t.jsxs)(c.Z,{form:M,onFinish:ey,initialValues:eb,layout:"vertical",children:[(0,t.jsx)(c.Z.Item,{label:"Key Alias",name:"key_alias",children:(0,t.jsx)(F.o,{})}),(0,t.jsx)(c.Z.Item,{label:"Models",name:"models",children:(0,t.jsx)(c.Z.Item,{noStyle:!0,shouldUpdate:(e,s)=>e.allowed_routes!==s.allowed_routes||e.models!==s.models,children:e=>{let{getFieldValue:s,setFieldValue:a}=e,l=s("allowed_routes")||[],r=l.includes("management_routes")||l.includes("info_routes"),i=s("models")||[];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(z.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},disabled:r,value:r?[]:i,onChange:e=>a("models",e),children:[el.length>0&&(0,t.jsx)(z.default.Option,{value:"all-team-models",children:"All Team Models"}),el.map(e=>(0,t.jsx)(z.default.Option,{value:e,children:e},e))]}),r&&(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Models field is disabled for this key type"})]})}})}),(0,t.jsx)(c.Z.Item,{label:"Key Type",children:(0,t.jsx)(c.Z.Item,{noStyle:!0,shouldUpdate:(e,s)=>e.allowed_routes!==s.allowed_routes,children:e=>{let{getFieldValue:s,setFieldValue:a}=e,l=H(s("allowed_routes"));return(0,t.jsxs)(z.default,{placeholder:"Select key type",style:{width:"100%"},optionLabelProp:"label",value:l,onChange:e=>{switch(e){case"default":a("allowed_routes",[]);break;case"llm_api":a("allowed_routes",["llm_api_routes"]);break;case"management":a("allowed_routes",["management_routes"]),a("models",[])}},children:[(0,t.jsx)(z.default.Option,{value:"default",label:"Default",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"Default"}),(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call LLM API + Management routes"})]})}),(0,t.jsx)(z.default.Option,{value:"llm_api",label:"LLM API",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"LLM API"}),(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call only LLM API routes (chat/completions, embeddings, etc.)"})]})}),(0,t.jsx)(z.default.Option,{value:"management",label:"Management",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"Management"}),(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call only management routes (user/team/key management)"})]})})]})}})}),(0,t.jsx)(c.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,t.jsx)($.Z,{step:.01,style:{width:"100%"},placeholder:"Enter a numerical value"})}),(0,t.jsx)(c.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,t.jsxs)(z.default,{placeholder:"n/a",children:[(0,t.jsx)(z.default.Option,{value:"daily",children:"Daily"}),(0,t.jsx)(z.default.Option,{value:"weekly",children:"Weekly"}),(0,t.jsx)(z.default.Option,{value:"monthly",children:"Monthly"})]})}),(0,t.jsx)(c.Z.Item,{label:"TPM Limit",name:"tpm_limit",children:(0,t.jsx)($.Z,{min:0})}),(0,t.jsx)(G.Z,{type:"tpm",name:"tpm_limit_type",showDetailedDescriptions:!1}),(0,t.jsx)(c.Z.Item,{label:"RPM Limit",name:"rpm_limit",children:(0,t.jsx)($.Z,{min:0})}),(0,t.jsx)(G.Z,{type:"rpm",name:"rpm_limit_type",showDetailedDescriptions:!1}),(0,t.jsx)(c.Z.Item,{label:"Max Parallel Requests",name:"max_parallel_requests",children:(0,t.jsx)($.Z,{min:0})}),(0,t.jsx)(c.Z.Item,{label:"Model TPM Limit",name:"model_tpm_limit",children:(0,t.jsx)(V.default.TextArea,{rows:4,placeholder:'{"gpt-4": 100, "claude-v1": 200}'})}),(0,t.jsx)(c.Z.Item,{label:"Model RPM Limit",name:"model_rpm_limit",children:(0,t.jsx)(V.default.TextArea,{rows:4,placeholder:'{"gpt-4": 100, "claude-v1": 200}'})}),(0,t.jsx)(c.Z.Item,{label:"Guardrails",name:"guardrails",children:A&&(0,t.jsx)(R.Z,{onChange:e=>{M.setFieldValue("guardrails",e)},accessToken:A,disabled:!P})}),(0,t.jsx)(c.Z.Item,{label:(0,t.jsxs)("span",{children:["Disable Global Guardrails"," ",(0,t.jsx)(u.Z,{title:"When enabled, this key will bypass any guardrails configured to run on every request (global guardrails)",children:(0,t.jsx)(Y.Z,{style:{marginLeft:"4px"}})})]}),name:"disable_global_guardrails",valuePropName:"checked",children:(0,t.jsx)(K.Z,{disabled:!P,checkedChildren:"Yes",unCheckedChildren:"No"})}),(0,t.jsx)(c.Z.Item,{label:"Tags",name:"tags",children:(0,t.jsx)(z.default,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter tags",options:Object.values(es).map(e=>({value:e.name,label:e.name,title:e.description||e.name}))})}),(0,t.jsx)(c.Z.Item,{label:"Prompts",name:"prompts",children:(0,t.jsx)(u.Z,{title:P?"":"Setting prompts by key is a premium feature",placement:"top",children:(0,t.jsx)(z.default,{mode:"tags",style:{width:"100%"},disabled:!P,placeholder:P?Array.isArray(null===(v=y.metadata)||void 0===v?void 0:v.prompts)&&y.metadata.prompts.length>0?"Current: ".concat(y.metadata.prompts.join(", ")):"Select or enter prompts":"Premium feature - Upgrade to set prompts by key",options:E.map(e=>({value:e,label:e}))})})}),(0,t.jsx)(c.Z.Item,{label:"Allowed Pass Through Routes",name:"allowed_passthrough_routes",children:(0,t.jsx)(u.Z,{title:P?"":"Setting allowed pass through routes by key is a premium feature",placement:"top",children:(0,t.jsx)(U.Z,{onChange:e=>M.setFieldValue("allowed_passthrough_routes",e),value:M.getFieldValue("allowed_passthrough_routes"),accessToken:A||"",placeholder:P?Array.isArray(null===(b=y.metadata)||void 0===b?void 0:b.allowed_passthrough_routes)&&y.metadata.allowed_passthrough_routes.length>0?"Current: ".concat(y.metadata.allowed_passthrough_routes.join(", ")):"Select or enter allowed pass through routes":"Premium feature - Upgrade to set allowed pass through routes by key",disabled:!P})})}),(0,t.jsx)(c.Z.Item,{label:"Vector Stores",name:"vector_stores",children:(0,t.jsx)(X.Z,{onChange:e=>M.setFieldValue("vector_stores",e),value:M.getFieldValue("vector_stores"),accessToken:A||"",placeholder:"Select vector stores"})}),(0,t.jsx)(c.Z.Item,{label:"MCP Servers / Access Groups",name:"mcp_servers_and_groups",children:(0,t.jsx)(B.Z,{onChange:e=>M.setFieldValue("mcp_servers_and_groups",e),value:M.getFieldValue("mcp_servers_and_groups"),accessToken:A||"",placeholder:"Select MCP servers or access groups (optional)"})}),(0,t.jsx)(c.Z.Item,{name:"mcp_tool_permissions",initialValue:{},hidden:!0,children:(0,t.jsx)(V.default,{type:"hidden"})}),(0,t.jsx)(c.Z.Item,{noStyle:!0,shouldUpdate:(e,s)=>e.mcp_servers_and_groups!==s.mcp_servers_and_groups||e.mcp_tool_permissions!==s.mcp_tool_permissions,children:()=>{var e;return(0,t.jsx)("div",{className:"mb-6",children:(0,t.jsx)(W.Z,{accessToken:A||"",selectedServers:(null===(e=M.getFieldValue("mcp_servers_and_groups"))||void 0===e?void 0:e.servers)||[],toolPermissions:M.getFieldValue("mcp_tool_permissions")||{},onChange:e=>M.setFieldsValue({mcp_tool_permissions:e})})})}}),(0,t.jsx)(c.Z.Item,{label:"Agents / Access Groups",name:"agents_and_groups",children:(0,t.jsx)(q.Z,{onChange:e=>M.setFieldValue("agents_and_groups",e),value:M.getFieldValue("agents_and_groups"),accessToken:A||"",placeholder:"Select agents or access groups (optional)"})}),(0,t.jsx)(c.Z.Item,{label:"Team ID",name:"team_id",children:(0,t.jsx)(z.default,{placeholder:"Select team",style:{width:"100%"},children:null==Z?void 0:Z.map(e=>(0,t.jsx)(z.default.Option,{value:e.team_id,children:"".concat(e.team_alias," (").concat(e.team_id,")")},e.team_id))})}),(0,t.jsx)(c.Z.Item,{label:"Logging Settings",name:"logging_settings",children:(0,t.jsx)(Q.Z,{value:M.getFieldValue("logging_settings"),onChange:e=>M.setFieldValue("logging_settings",e),disabledCallbacks:ec,onDisabledCallbacksChange:e=>{em((0,j.PA)(e)),M.setFieldValue("disabled_callbacks",e)}})}),(0,t.jsx)(c.Z.Item,{label:"Metadata",name:"metadata",children:(0,t.jsx)(V.default.TextArea,{rows:10})}),(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(O.Z,{form:M,autoRotationEnabled:eu,onAutoRotationChange:ex,rotationInterval:eg,onRotationIntervalChange:eh}),(0,t.jsx)(c.Z.Item,{name:"duration",hidden:!0,initialValue:"",children:(0,t.jsx)(V.default,{})})]}),(0,t.jsx)(c.Z.Item,{name:"token",hidden:!0,children:(0,t.jsx)(V.default,{})}),(0,t.jsx)(c.Z.Item,{name:"allowed_routes",hidden:!0,children:(0,t.jsx)(V.default,{})}),(0,t.jsx)(c.Z.Item,{name:"disabled_callbacks",hidden:!0,children:(0,t.jsx)(V.default,{})}),(0,t.jsx)(c.Z.Item,{name:"auto_rotate",hidden:!0,children:(0,t.jsx)(V.default,{})}),(0,t.jsx)(c.Z.Item,{name:"rotation_interval",hidden:!0,children:(0,t.jsx)(V.default,{})}),(0,t.jsx)("div",{className:"sticky z-10 bg-white p-4 border-t border-gray-200 bottom-[-1.5rem] inset-x-[-1.5rem]",children:(0,t.jsxs)("div",{className:"flex justify-end items-center gap-2",children:[(0,t.jsx)(F.z,{variant:"secondary",onClick:_,disabled:ep,children:"Cancel"}),(0,t.jsx)(F.z,{type:"submit",loading:ep,children:"Save Changes"})]})})]})}function es(e){var s,a,v,b,_,f,I,L;let{keyId:P,onClose:M,keyData:D,accessToken:R,userID:F,userRole:z,teams:V,onKeyDataUpdate:K,onDelete:O,premiumUser:U,setAccessToken:G,backButtonText:B="Back to Keys"}=e,[W,q]=(0,h.useState)(!1),[J]=c.Z.useForm(),[$,Q]=(0,h.useState)(!1),[X,Y]=(0,h.useState)(""),[H,es]=(0,h.useState)(!1),[ea,et]=(0,h.useState)({}),[el,er]=(0,h.useState)(D),[ei,en]=(0,h.useState)(null),[ed,eo]=(0,h.useState)(!1);if((0,h.useEffect)(()=>{D&&er(D)},[D]),(0,h.useEffect)(()=>{if(ed){let e=setTimeout(()=>{eo(!1)},5e3);return()=>clearTimeout(e)}},[ed]),!el)return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsx)(o.zx,{icon:i.Z,variant:"light",onClick:M,className:"mb-4",children:B}),(0,t.jsx)(o.xv,{children:"Key not found"})]});let ec=async e=>{try{var s,a,t,l;if(!R)return;let i=e.token;if(e.key=i,U||(delete e.guardrails,delete e.prompts),e.max_budget=(0,r.C)(e.max_budget),void 0!==e.vector_stores&&(e.object_permission={...el.object_permission,vector_stores:e.vector_stores||[]},delete e.vector_stores),void 0!==e.mcp_servers_and_groups){let{servers:s,accessGroups:a}=e.mcp_servers_and_groups||{servers:[],accessGroups:[]};e.object_permission={...el.object_permission,mcp_servers:s||[],mcp_access_groups:a||[]},delete e.mcp_servers_and_groups}if(void 0!==e.mcp_tool_permissions){let s=e.mcp_tool_permissions||{};Object.keys(s).length>0&&(e.object_permission={...e.object_permission,mcp_tool_permissions:s}),delete e.mcp_tool_permissions}if(void 0!==e.agents_and_groups){let{agents:s,accessGroups:a}=e.agents_and_groups||{agents:[],accessGroups:[]};e.object_permission={...e.object_permission,agents:s||[],agent_access_groups:a||[]},delete e.agents_and_groups}if(e.max_budget=(0,r.C)(e.max_budget),e.tpm_limit=(0,r.C)(e.tpm_limit),e.rpm_limit=(0,r.C)(e.rpm_limit),e.max_parallel_requests=(0,r.C)(e.max_parallel_requests),e.metadata&&"string"==typeof e.metadata)try{let t=JSON.parse(e.metadata);"tags"in t&&delete t.tags,e.metadata={...t,...Array.isArray(e.tags)&&e.tags.length>0?{tags:e.tags}:{},...(null===(s=e.guardrails)||void 0===s?void 0:s.length)>0?{guardrails:e.guardrails}:{},...e.logging_settings?{logging:e.logging_settings}:{},...(null===(a=e.disabled_callbacks)||void 0===a?void 0:a.length)>0?{litellm_disabled_callbacks:(0,j.Z3)(e.disabled_callbacks)}:{}}}catch(e){console.error("Error parsing metadata JSON:",e),S.Z.error("Invalid metadata JSON");return}else{let{tags:s,...a}=e.metadata||{};e.metadata={...a,...Array.isArray(e.tags)&&e.tags.length>0?{tags:e.tags}:{},...(null===(t=e.guardrails)||void 0===t?void 0:t.length)>0?{guardrails:e.guardrails}:{},...e.logging_settings?{logging:e.logging_settings}:{},...(null===(l=e.disabled_callbacks)||void 0===l?void 0:l.length)>0?{litellm_disabled_callbacks:(0,j.Z3)(e.disabled_callbacks)}:{}}}"tags"in e&&delete e.tags,delete e.logging_settings,e.budget_duration&&(e.budget_duration=({daily:"24h",weekly:"7d",monthly:"30d"})[e.budget_duration]);let n=await (0,C.keyUpdateCall)(R,e);er(e=>e?{...e,...n}:void 0),K&&K(n),S.Z.success("Key updated successfully"),q(!1)}catch(e){S.Z.fromBackend((0,E.O)(e)),console.error("Error updating key:",e)}},em=async()=>{try{if(!R)return;await (0,C.keyDeleteCall)(R,el.token||el.token_id),S.Z.success("Key deleted successfully"),O&&O(),M()}catch(e){console.error("Error deleting the key:",e),S.Z.fromBackend(e)}Y("")},eu=async(e,s)=>{await (0,l.vQ)(e)&&(et(e=>({...e,[s]:!0})),setTimeout(()=>{et(e=>({...e,[s]:!1}))},2e3))},ex=e=>{let s=new Date(e),a=s.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),t=s.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return"".concat(a," at ").concat(t)};return(0,t.jsxs)("div",{className:"w-full h-screen p-4",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(o.zx,{icon:i.Z,variant:"light",onClick:M,className:"mb-4",children:B}),(0,t.jsx)(o.Dx,{children:el.key_alias||"Virtual Key"}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer mb-2 space-y-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"text-xs text-gray-400 uppercase tracking-wide mt-2",children:"Key ID"}),(0,t.jsx)(o.xv,{className:"text-gray-500 font-mono text-sm",children:el.token_id||el.token})]}),(0,t.jsx)(m.ZP,{type:"text",size:"small",icon:ea["key-id"]?(0,t.jsx)(x.Z,{size:12}):(0,t.jsx)(g.Z,{size:12}),onClick:()=>eu(el.token_id||el.token,"key-id"),className:"ml-2 transition-all duration-200".concat(ea["key-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,t.jsx)(o.xv,{className:"text-sm text-gray-500",children:el.updated_at&&el.updated_at!==el.created_at?"Updated: ".concat(ex(el.updated_at)):"Created: ".concat(ex(el.created_at))}),ed&&(0,t.jsx)(o.Ct,{color:"green",size:"xs",className:"animate-pulse",children:"Recently Regenerated"}),ei&&(0,t.jsx)(o.Ct,{color:"blue",size:"xs",children:"Regenerated"})]})]}),z&&p.LQ.includes(z)&&(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(u.Z,{title:U?"":"This is a LiteLLM Enterprise feature, and requires a valid key to use.",children:(0,t.jsx)("span",{className:"inline-block",children:(0,t.jsx)(o.zx,{icon:n.Z,variant:"secondary",onClick:()=>es(!0),className:"flex items-center",disabled:!U,children:"Regenerate Key"})})}),(0,t.jsx)(o.zx,{icon:d.Z,variant:"secondary",onClick:()=>Q(!0),className:"flex items-center text-red-500 border-red-500 hover:text-red-700",children:"Delete Key"})]})]}),(0,t.jsx)(T,{selectedToken:el,visible:H,onClose:()=>es(!1),accessToken:R,premiumUser:U,setAccessToken:G,onKeyUpdate:e=>{er(s=>{if(s)return{...s,...e,created_at:new Date().toLocaleString()}}),en(new Date),eo(!0),K&&K({...e,created_at:new Date().toLocaleString()})}}),$&&(()=>{let e=(null==el?void 0:el.key_alias)||(null==el?void 0:el.token_id)||"Virtual Key",s=X===e;return(0,t.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow-xl w-full max-w-2xl min-h-[380px] py-6 overflow-hidden transform transition-all flex flex-col justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200",children:[(0,t.jsx)("h3",{className:"text-lg font-semibold text-gray-900",children:"Delete Key"}),(0,t.jsx)("button",{onClick:()=>{Q(!1),Y("")},className:"text-gray-400 hover:text-gray-500 focus:outline-none",children:(0,t.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,t.jsxs)("div",{className:"px-6 py-4",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3 p-4 bg-red-50 border border-red-100 rounded-md mb-5",children:[(0,t.jsx)("div",{className:"text-red-500 mt-0.5",children:(0,t.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.082 16.5c-.77.833.192 2.5 1.732 2.5z"})})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-base font-medium text-red-600",children:"Warning: You are about to delete this Virtual Key."}),(0,t.jsx)("p",{className:"text-base text-red-600 mt-2",children:"This action is irreversible and will immediately revoke access for any applications using this key."})]})]}),(0,t.jsx)("p",{className:"text-base text-gray-600 mb-5",children:"Are you sure you want to delete this Virtual Key?"}),(0,t.jsxs)("div",{className:"mb-5",children:[(0,t.jsxs)("label",{className:"block text-base font-medium text-gray-700 mb-2",children:["Type ",(0,t.jsx)("span",{className:"underline",children:e})," to confirm deletion:"]}),(0,t.jsx)("input",{type:"text",value:X,onChange:e=>Y(e.target.value),placeholder:"Enter key name exactly",className:"w-full px-4 py-3 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-base",autoFocus:!0})]})]})]}),(0,t.jsxs)("div",{className:"px-6 py-4 bg-gray-50 flex justify-end gap-4",children:[(0,t.jsx)("button",{onClick:()=>{Q(!1),Y("")},className:"px-5 py-3 bg-white border border-gray-300 rounded-md text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:"Cancel"}),(0,t.jsx)("button",{onClick:em,disabled:!s,className:"px-5 py-3 rounded-md text-base font-medium text-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 ".concat(s?"bg-red-600 hover:bg-red-700":"bg-red-300 cursor-not-allowed"),children:"Delete Key"})]})]})})})(),(0,t.jsxs)(o.v0,{children:[(0,t.jsxs)(o.td,{className:"mb-4",children:[(0,t.jsx)(o.OK,{children:"Overview"}),(0,t.jsx)(o.OK,{children:"Settings"})]}),(0,t.jsxs)(o.nP,{children:[(0,t.jsx)(o.x4,{children:(0,t.jsxs)(o.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,t.jsxs)(o.Zb,{children:[(0,t.jsx)(o.xv,{children:"Spend"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(o.Dx,{children:["$",(0,l.pw)(el.spend,4)]}),(0,t.jsxs)(o.xv,{children:["of"," ",null!==el.max_budget?"$".concat((0,l.pw)(el.max_budget)):"Unlimited"]})]})]}),(0,t.jsxs)(o.Zb,{children:[(0,t.jsx)(o.xv,{children:"Rate Limits"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(o.xv,{children:["TPM: ",null!==el.tpm_limit?el.tpm_limit:"Unlimited"]}),(0,t.jsxs)(o.xv,{children:["RPM: ",null!==el.rpm_limit?el.rpm_limit:"Unlimited"]})]})]}),(0,t.jsxs)(o.Zb,{children:[(0,t.jsx)(o.xv,{children:"Models"}),(0,t.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:el.models&&el.models.length>0?el.models.map((e,s)=>(0,t.jsx)(o.Ct,{color:"red",children:e},s)):(0,t.jsx)(o.xv,{children:"No models specified"})})]}),(0,t.jsx)(o.Zb,{children:(0,t.jsx)(A.Z,{objectPermission:el.object_permission,variant:"inline",accessToken:R})}),(0,t.jsx)(Z.Z,{loggingConfigs:N(el.metadata),disabledCallbacks:Array.isArray(null===(s=el.metadata)||void 0===s?void 0:s.litellm_disabled_callbacks)?(0,j.PA)(el.metadata.litellm_disabled_callbacks):[],variant:"card"}),(0,t.jsx)(y,{autoRotate:el.auto_rotate,rotationInterval:el.rotation_interval,lastRotationAt:el.last_rotation_at,keyRotationAt:el.key_rotation_at,nextRotationAt:el.next_rotation_at,variant:"card"})]})}),(0,t.jsx)(o.x4,{children:(0,t.jsxs)(o.Zb,{className:"overflow-y-auto max-h-[65vh]",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(o.Dx,{children:"Key Settings"}),!W&&z&&p.LQ.includes(z)&&(0,t.jsx)(o.zx,{onClick:()=>q(!0),children:"Edit Settings"})]}),W?(0,t.jsx)(ee,{keyData:el,onCancel:()=>q(!1),onSubmit:ec,teams:V,accessToken:R,userID:F,userRole:z,premiumUser:U}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Key ID"}),(0,t.jsx)(o.xv,{className:"font-mono",children:el.token_id||el.token})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Key Alias"}),(0,t.jsx)(o.xv,{children:el.key_alias||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Secret Key"}),(0,t.jsx)(o.xv,{className:"font-mono",children:el.key_name})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Team ID"}),(0,t.jsx)(o.xv,{children:el.team_id||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Organization"}),(0,t.jsx)(o.xv,{children:el.organization_id||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Created"}),(0,t.jsx)(o.xv,{children:ex(el.created_at)})]}),ei&&(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Last Regenerated"}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(o.xv,{children:ex(ei)}),(0,t.jsx)(o.Ct,{color:"green",size:"xs",children:"Recent"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Expires"}),(0,t.jsx)(o.xv,{children:el.expires?ex(el.expires):"Never"})]}),(0,t.jsx)(y,{autoRotate:el.auto_rotate,rotationInterval:el.rotation_interval,lastRotationAt:el.last_rotation_at,keyRotationAt:el.key_rotation_at,nextRotationAt:el.next_rotation_at,variant:"inline",className:"pt-4 border-t border-gray-200"}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Spend"}),(0,t.jsxs)(o.xv,{children:["$",(0,l.pw)(el.spend,4)," USD"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Budget"}),(0,t.jsx)(o.xv,{children:null!==el.max_budget?"$".concat((0,l.pw)(el.max_budget,2)):"Unlimited"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Tags"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:Array.isArray(null===(a=el.metadata)||void 0===a?void 0:a.tags)&&el.metadata.tags.length>0?el.metadata.tags.map((e,s)=>(0,t.jsx)("span",{className:"px-2 mr-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):"No tags specified"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Prompts"}),(0,t.jsx)(o.xv,{children:Array.isArray(null===(v=el.metadata)||void 0===v?void 0:v.prompts)&&el.metadata.prompts.length>0?el.metadata.prompts.map((e,s)=>(0,t.jsx)("span",{className:"px-2 mr-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):"No prompts specified"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Allowed Pass Through Routes"}),(0,t.jsx)(o.xv,{children:Array.isArray(null===(b=el.metadata)||void 0===b?void 0:b.allowed_passthrough_routes)&&el.metadata.allowed_passthrough_routes.length>0?el.metadata.allowed_passthrough_routes.map((e,s)=>(0,t.jsx)("span",{className:"px-2 mr-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):"No pass through routes specified"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Disable Global Guardrails"}),(0,t.jsx)(o.xv,{children:(null===(_=el.metadata)||void 0===_?void 0:_.disable_global_guardrails)===!0?(0,t.jsx)(o.Ct,{color:"yellow",children:"Enabled - Global guardrails bypassed"}):(0,t.jsx)(o.Ct,{color:"green",children:"Disabled - Global guardrails active"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Models"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:el.models&&el.models.length>0?el.models.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):(0,t.jsx)(o.xv,{children:"No models specified"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Rate Limits"}),(0,t.jsxs)(o.xv,{children:["TPM: ",null!==el.tpm_limit?el.tpm_limit:"Unlimited"]}),(0,t.jsxs)(o.xv,{children:["RPM: ",null!==el.rpm_limit?el.rpm_limit:"Unlimited"]}),(0,t.jsxs)(o.xv,{children:["Max Parallel Requests:"," ",null!==el.max_parallel_requests?el.max_parallel_requests:"Unlimited"]}),(0,t.jsxs)(o.xv,{children:["Model TPM Limits:"," ",(null===(f=el.metadata)||void 0===f?void 0:f.model_tpm_limit)?JSON.stringify(el.metadata.model_tpm_limit):"Unlimited"]}),(0,t.jsxs)(o.xv,{children:["Model RPM Limits:"," ",(null===(I=el.metadata)||void 0===I?void 0:I.model_rpm_limit)?JSON.stringify(el.metadata.model_rpm_limit):"Unlimited"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.xv,{className:"font-medium",children:"Metadata"}),(0,t.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:k(w(el.metadata))})]}),(0,t.jsx)(A.Z,{objectPermission:el.object_permission,variant:"inline",className:"pt-4 border-t border-gray-200",accessToken:R}),(0,t.jsx)(Z.Z,{loggingConfigs:N(el.metadata),disabledCallbacks:Array.isArray(null===(L=el.metadata)||void 0===L?void 0:L.litellm_disabled_callbacks)?(0,j.PA)(el.metadata.litellm_disabled_callbacks):[],variant:"inline",className:"pt-4 border-t border-gray-200"})]})]})})]})]})]})}},33304:function(e,s,a){a.d(s,{C:function(){return t}});function t(e){return""===e?null:e}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/4388-eb8fa49a76501802.js b/litellm/proxy/_experimental/out/_next/static/chunks/4388-eb8fa49a76501802.js deleted file mode 100644 index b22c5b56336..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/4388-eb8fa49a76501802.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4388],{12660:function(e,t,a){a.d(t,{Z:function(){return l}});var r=a(1119),n=a(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M917.7 148.8l-42.4-42.4c-1.6-1.6-3.6-2.3-5.7-2.3s-4.1.8-5.7 2.3l-76.1 76.1a199.27 199.27 0 00-112.1-34.3c-51.2 0-102.4 19.5-141.5 58.6L432.3 308.7a8.03 8.03 0 000 11.3L704 591.7c1.6 1.6 3.6 2.3 5.7 2.3 2 0 4.1-.8 5.7-2.3l101.9-101.9c68.9-69 77-175.7 24.3-253.5l76.1-76.1c3.1-3.2 3.1-8.3 0-11.4zM769.1 441.7l-59.4 59.4-186.8-186.8 59.4-59.4c24.9-24.9 58.1-38.7 93.4-38.7 35.3 0 68.4 13.7 93.4 38.7 24.9 24.9 38.7 58.1 38.7 93.4 0 35.3-13.8 68.4-38.7 93.4zm-190.2 105a8.03 8.03 0 00-11.3 0L501 613.3 410.7 523l66.7-66.7c3.1-3.1 3.1-8.2 0-11.3L441 408.6a8.03 8.03 0 00-11.3 0L363 475.3l-43-43a7.85 7.85 0 00-5.7-2.3c-2 0-4.1.8-5.7 2.3L206.8 534.2c-68.9 69-77 175.7-24.3 253.5l-76.1 76.1a8.03 8.03 0 000 11.3l42.4 42.4c1.6 1.6 3.6 2.3 5.7 2.3s4.1-.8 5.7-2.3l76.1-76.1c33.7 22.9 72.9 34.3 112.1 34.3 51.2 0 102.4-19.5 141.5-58.6l101.9-101.9c3.1-3.1 3.1-8.2 0-11.3l-43-43 66.7-66.7c3.1-3.1 3.1-8.2 0-11.3l-36.6-36.2zM441.7 769.1a131.32 131.32 0 01-93.4 38.7c-35.3 0-68.4-13.7-93.4-38.7a131.32 131.32 0 01-38.7-93.4c0-35.3 13.7-68.4 38.7-93.4l59.4-59.4 186.8 186.8-59.4 59.4z"}}]},name:"api",theme:"outlined"},o=a(55015),l=n.forwardRef(function(e,t){return n.createElement(o.Z,(0,r.Z)({},e,{ref:t,icon:c}))})},88009:function(e,t,a){a.d(t,{Z:function(){return l}});var r=a(1119),n=a(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M464 144H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H212V212h200v200zm452-268H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H612V212h200v200zM464 544H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H212V612h200v200zm452-268H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H612V612h200v200z"}}]},name:"appstore",theme:"outlined"},o=a(55015),l=n.forwardRef(function(e,t){return n.createElement(o.Z,(0,r.Z)({},e,{ref:t,icon:c}))})},37527:function(e,t,a){a.d(t,{Z:function(){return l}});var r=a(1119),n=a(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M894 462c30.9 0 43.8-39.7 18.7-58L530.8 126.2a31.81 31.81 0 00-37.6 0L111.3 404c-25.1 18.2-12.2 58 18.8 58H192v374h-72c-4.4 0-8 3.6-8 8v52c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-52c0-4.4-3.6-8-8-8h-72V462h62zM512 196.7l271.1 197.2H240.9L512 196.7zM264 462h117v374H264V462zm189 0h117v374H453V462zm307 374H642V462h118v374z"}}]},name:"bank",theme:"outlined"},o=a(55015),l=n.forwardRef(function(e,t){return n.createElement(o.Z,(0,r.Z)({},e,{ref:t,icon:c}))})},9775:function(e,t,a){a.d(t,{Z:function(){return l}});var r=a(1119),n=a(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M888 792H200V168c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v688c0 4.4 3.6 8 8 8h752c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-600-80h56c4.4 0 8-3.6 8-8V560c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v144c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V384c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v320c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V462c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v242c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V304c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v400c0 4.4 3.6 8 8 8z"}}]},name:"bar-chart",theme:"outlined"},o=a(55015),l=n.forwardRef(function(e,t){return n.createElement(o.Z,(0,r.Z)({},e,{ref:t,icon:c}))})},68208:function(e,t,a){a.d(t,{Z:function(){return l}});var r=a(1119),n=a(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M856 376H648V168c0-8.8-7.2-16-16-16H168c-8.8 0-16 7.2-16 16v464c0 8.8 7.2 16 16 16h208v208c0 8.8 7.2 16 16 16h464c8.8 0 16-7.2 16-16V392c0-8.8-7.2-16-16-16zm-480 16v188H220V220h360v156H392c-8.8 0-16 7.2-16 16zm204 52v136H444V444h136zm224 360H444V648h188c8.8 0 16-7.2 16-16V444h156v360z"}}]},name:"block",theme:"outlined"},o=a(55015),l=n.forwardRef(function(e,t){return n.createElement(o.Z,(0,r.Z)({},e,{ref:t,icon:c}))})},44625:function(e,t,a){a.d(t,{Z:function(){return l}});var r=a(1119),n=a(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-600 72h560v208H232V136zm560 480H232V408h560v208zm0 272H232V680h560v208zM304 240a40 40 0 1080 0 40 40 0 10-80 0zm0 272a40 40 0 1080 0 40 40 0 10-80 0zm0 272a40 40 0 1080 0 40 40 0 10-80 0z"}}]},name:"database",theme:"outlined"},o=a(55015),l=n.forwardRef(function(e,t){return n.createElement(o.Z,(0,r.Z)({},e,{ref:t,icon:c}))})},41169:function(e,t,a){a.d(t,{Z:function(){return l}});var r=a(1119),n=a(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 472a40 40 0 1080 0 40 40 0 10-80 0zm367 352.9L696.3 352V178H768v-68H256v68h71.7v174L145 824.9c-2.8 7.4-4.3 15.2-4.3 23.1 0 35.3 28.7 64 64 64h614.6c7.9 0 15.7-1.5 23.1-4.3 33-12.7 49.4-49.8 36.6-82.8zM395.7 364.7V180h232.6v184.7L719.2 600c-20.7-5.3-42.1-8-63.9-8-61.2 0-119.2 21.5-165.3 60a188.78 188.78 0 01-121.3 43.9c-32.7 0-64.1-8.3-91.8-23.7l118.8-307.5zM210.5 844l41.7-107.8c35.7 18.1 75.4 27.8 116.6 27.8 61.2 0 119.2-21.5 165.3-60 33.9-28.2 76.3-43.9 121.3-43.9 35 0 68.4 9.5 97.6 27.1L813.5 844h-603z"}}]},name:"experiment",theme:"outlined"},o=a(55015),l=n.forwardRef(function(e,t){return n.createElement(o.Z,(0,r.Z)({},e,{ref:t,icon:c}))})},38434:function(e,t,a){a.d(t,{Z:function(){return l}});var r=a(1119),n=a(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z"}}]},name:"file-text",theme:"outlined"},o=a(55015),l=n.forwardRef(function(e,t){return n.createElement(o.Z,(0,r.Z)({},e,{ref:t,icon:c}))})},92403:function(e,t,a){a.d(t,{Z:function(){return l}});var r=a(1119),n=a(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M608 112c-167.9 0-304 136.1-304 304 0 70.3 23.9 135 63.9 186.5l-41.1 41.1-62.3-62.3a8.15 8.15 0 00-11.4 0l-39.8 39.8a8.15 8.15 0 000 11.4l62.3 62.3-44.9 44.9-62.3-62.3a8.15 8.15 0 00-11.4 0l-39.8 39.8a8.15 8.15 0 000 11.4l62.3 62.3-65.3 65.3a8.03 8.03 0 000 11.3l42.3 42.3c3.1 3.1 8.2 3.1 11.3 0l253.6-253.6A304.06 304.06 0 00608 720c167.9 0 304-136.1 304-304S775.9 112 608 112zm161.2 465.2C726.2 620.3 668.9 644 608 644c-60.9 0-118.2-23.7-161.2-66.8-43.1-43-66.8-100.3-66.8-161.2 0-60.9 23.7-118.2 66.8-161.2 43-43.1 100.3-66.8 161.2-66.8 60.9 0 118.2 23.7 161.2 66.8 43.1 43 66.8 100.3 66.8 161.2 0 60.9-23.7 118.2-66.8 161.2z"}}]},name:"key",theme:"outlined"},o=a(55015),l=n.forwardRef(function(e,t){return n.createElement(o.Z,(0,r.Z)({},e,{ref:t,icon:c}))})},48231:function(e,t,a){a.d(t,{Z:function(){return l}});var r=a(1119),n=a(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M888 792H200V168c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v688c0 4.4 3.6 8 8 8h752c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM305.8 637.7c3.1 3.1 8.1 3.1 11.3 0l138.3-137.6L583 628.5c3.1 3.1 8.2 3.1 11.3 0l275.4-275.3c3.1-3.1 3.1-8.2 0-11.3l-39.6-39.6a8.03 8.03 0 00-11.3 0l-230 229.9L461.4 404a8.03 8.03 0 00-11.3 0L266.3 586.7a8.03 8.03 0 000 11.3l39.5 39.7z"}}]},name:"line-chart",theme:"outlined"},o=a(55015),l=n.forwardRef(function(e,t){return n.createElement(o.Z,(0,r.Z)({},e,{ref:t,icon:c}))})},28595:function(e,t,a){a.d(t,{Z:function(){return l}});var r=a(1119),n=a(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M719.4 499.1l-296.1-215A15.9 15.9 0 00398 297v430c0 13.1 14.8 20.5 25.3 12.9l296.1-215a15.9 15.9 0 000-25.8zm-257.6 134V390.9L628.5 512 461.8 633.1z"}}]},name:"play-circle",theme:"outlined"},o=a(55015),l=n.forwardRef(function(e,t){return n.createElement(o.Z,(0,r.Z)({},e,{ref:t,icon:c}))})},55322:function(e,t,a){a.d(t,{Z:function(){return l}});var r=a(1119),n=a(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 009.3-35.2l-.9-2.6a443.74 443.74 0 00-79.7-137.9l-1.8-2.1a32.12 32.12 0 00-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 00-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 00-25.8 25.7l-15.8 85.4a351.86 351.86 0 00-99 57.4l-81.9-29.1a32 32 0 00-35.1 9.5l-1.8 2.1a446.02 446.02 0 00-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 00-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0035.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0025.8 25.7l2.7.5a449.4 449.4 0 00159 0l2.7-.5a32.05 32.05 0 0025.8-25.7l15.7-85a350 350 0 0099.7-57.6l81.3 28.9a32 32 0 0035.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 01-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 01-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 01512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 01400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 01624 502c0 29.9-11.7 58-32.8 79.2z"}}]},name:"setting",theme:"outlined"},o=a(55015),l=n.forwardRef(function(e,t){return n.createElement(o.Z,(0,r.Z)({},e,{ref:t,icon:c}))})},71891:function(e,t,a){a.d(t,{Z:function(){return l}});var r=a(1119),n=a(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M483.2 790.3L861.4 412c1.7-1.7 2.5-4 2.3-6.3l-25.5-301.4c-.7-7.8-6.8-13.9-14.6-14.6L522.2 64.3c-2.3-.2-4.7.6-6.3 2.3L137.7 444.8a8.03 8.03 0 000 11.3l334.2 334.2c3.1 3.2 8.2 3.2 11.3 0zm62.6-651.7l224.6 19 19 224.6L477.5 694 233.9 450.5l311.9-311.9zm60.16 186.23a48 48 0 1067.88-67.89 48 48 0 10-67.88 67.89zM889.7 539.8l-39.6-39.5a8.03 8.03 0 00-11.3 0l-362 361.3-237.6-237a8.03 8.03 0 00-11.3 0l-39.6 39.5a8.03 8.03 0 000 11.3l243.2 242.8 39.6 39.5c3.1 3.1 8.2 3.1 11.3 0l407.3-406.6c3.1-3.1 3.1-8.2 0-11.3z"}}]},name:"tags",theme:"outlined"},o=a(55015),l=n.forwardRef(function(e,t){return n.createElement(o.Z,(0,r.Z)({},e,{ref:t,icon:c}))})},41361:function(e,t,a){a.d(t,{Z:function(){return l}});var r=a(1119),n=a(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M824.2 699.9a301.55 301.55 0 00-86.4-60.4C783.1 602.8 812 546.8 812 484c0-110.8-92.4-201.7-203.2-200-109.1 1.7-197 90.6-197 200 0 62.8 29 118.8 74.2 155.5a300.95 300.95 0 00-86.4 60.4C345 754.6 314 826.8 312 903.8a8 8 0 008 8.2h56c4.3 0 7.9-3.4 8-7.7 1.9-58 25.4-112.3 66.7-153.5A226.62 226.62 0 01612 684c60.9 0 118.2 23.7 161.3 66.8C814.5 792 838 846.3 840 904.3c.1 4.3 3.7 7.7 8 7.7h56a8 8 0 008-8.2c-2-77-33-149.2-87.8-203.9zM612 612c-34.2 0-66.4-13.3-90.5-37.5a126.86 126.86 0 01-37.5-91.8c.3-32.8 13.4-64.5 36.3-88 24-24.6 56.1-38.3 90.4-38.7 33.9-.3 66.8 12.9 91 36.6 24.8 24.3 38.4 56.8 38.4 91.4 0 34.2-13.3 66.3-37.5 90.5A127.3 127.3 0 01612 612zM361.5 510.4c-.9-8.7-1.4-17.5-1.4-26.4 0-15.9 1.5-31.4 4.3-46.5.7-3.6-1.2-7.3-4.5-8.8-13.6-6.1-26.1-14.5-36.9-25.1a127.54 127.54 0 01-38.7-95.4c.9-32.1 13.8-62.6 36.3-85.6 24.7-25.3 57.9-39.1 93.2-38.7 31.9.3 62.7 12.6 86 34.4 7.9 7.4 14.7 15.6 20.4 24.4 2 3.1 5.9 4.4 9.3 3.2 17.6-6.1 36.2-10.4 55.3-12.4 5.6-.6 8.8-6.6 6.3-11.6-32.5-64.3-98.9-108.7-175.7-109.9-110.9-1.7-203.3 89.2-203.3 199.9 0 62.8 28.9 118.8 74.2 155.5-31.8 14.7-61.1 35-86.5 60.4-54.8 54.7-85.8 126.9-87.8 204a8 8 0 008 8.2h56.1c4.3 0 7.9-3.4 8-7.7 1.9-58 25.4-112.3 66.7-153.5 29.4-29.4 65.4-49.8 104.7-59.7 3.9-1 6.5-4.7 6-8.7z"}}]},name:"team",theme:"outlined"},o=a(55015),l=n.forwardRef(function(e,t){return n.createElement(o.Z,(0,r.Z)({},e,{ref:t,icon:c}))})},58630:function(e,t,a){a.d(t,{Z:function(){return l}});var r=a(1119),n=a(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M876.6 239.5c-.5-.9-1.2-1.8-2-2.5-5-5-13.1-5-18.1 0L684.2 409.3l-67.9-67.9L788.7 169c.8-.8 1.4-1.6 2-2.5 3.6-6.1 1.6-13.9-4.5-17.5-98.2-58-226.8-44.7-311.3 39.7-67 67-89.2 162-66.5 247.4l-293 293c-3 3-2.8 7.9.3 11l169.7 169.7c3.1 3.1 8.1 3.3 11 .3l292.9-292.9c85.5 22.8 180.5.7 247.6-66.4 84.4-84.5 97.7-213.1 39.7-311.3zM786 499.8c-58.1 58.1-145.3 69.3-214.6 33.6l-8.8 8.8-.1-.1-274 274.1-79.2-79.2 230.1-230.1s0 .1.1.1l52.8-52.8c-35.7-69.3-24.5-156.5 33.6-214.6a184.2 184.2 0 01144-53.5L537 318.9a32.05 32.05 0 000 45.3l124.5 124.5a32.05 32.05 0 0045.3 0l132.8-132.8c3.7 51.8-14.4 104.8-53.6 143.9z"}}]},name:"tool",theme:"outlined"},o=a(55015),l=n.forwardRef(function(e,t){return n.createElement(o.Z,(0,r.Z)({},e,{ref:t,icon:c}))})},41649:function(e,t,a){a.d(t,{Z:function(){return h}});var r=a(5853),n=a(2265),c=a(47187),o=a(7084),l=a(26898),i=a(13241),s=a(1153);let f={xs:{paddingX:"px-2",paddingY:"py-0.5",fontSize:"text-xs"},sm:{paddingX:"px-2.5",paddingY:"py-0.5",fontSize:"text-sm"},md:{paddingX:"px-3",paddingY:"py-0.5",fontSize:"text-md"},lg:{paddingX:"px-3.5",paddingY:"py-0.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-1",fontSize:"text-xl"}},d={xs:{height:"h-4",width:"w-4"},sm:{height:"h-4",width:"w-4"},md:{height:"h-4",width:"w-4"},lg:{height:"h-5",width:"w-5"},xl:{height:"h-6",width:"w-6"}},u=(0,s.fn)("Badge"),h=n.forwardRef((e,t)=>{let{color:a,icon:h,size:m=o.u8.SM,tooltip:g,className:p,children:v}=e,w=(0,r._T)(e,["color","icon","size","tooltip","className","children"]),z=h||null,{tooltipProps:Z,getReferenceProps:y}=(0,c.l)();return n.createElement("span",Object.assign({ref:(0,s.lq)([t,Z.refs.setReference]),className:(0,i.q)(u("root"),"w-max shrink-0 inline-flex justify-center items-center cursor-default rounded-tremor-small ring-1 ring-inset",a?(0,i.q)((0,s.bM)(a,l.K.background).bgColor,(0,s.bM)(a,l.K.iconText).textColor,(0,s.bM)(a,l.K.iconRing).ringColor,"bg-opacity-10 ring-opacity-20","dark:bg-opacity-5 dark:ring-opacity-60"):(0,i.q)("bg-tremor-brand-faint text-tremor-brand-emphasis ring-tremor-brand/20","dark:bg-dark-tremor-brand-muted/50 dark:text-dark-tremor-brand dark:ring-dark-tremor-subtle/20"),f[m].paddingX,f[m].paddingY,f[m].fontSize,p)},y,w),n.createElement(c.Z,Object.assign({text:g},Z)),z?n.createElement(z,{className:(0,i.q)(u("icon"),"shrink-0 -ml-1 mr-1.5",d[m].height,d[m].width)}):null,n.createElement("span",{className:(0,i.q)(u("text"),"whitespace-nowrap")},v))});h.displayName="Badge"},13817:function(e,t,a){a.d(t,{default:function(){return y}});var r=a(83145),n=a(2265),c=a(36760),o=a.n(c),l=a(18694),i=a(71744),s=a(80856),f=a(45287),d=a(32186),u=a(25437),h=function(e,t){var a={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(a[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,r=Object.getOwnPropertySymbols(e);nt.indexOf(r[n])&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(a[r[n]]=e[r[n]]);return a};function m(e){let{suffixCls:t,tagName:a,displayName:r}=e;return e=>n.forwardRef((r,c)=>n.createElement(e,Object.assign({ref:c,suffixCls:t,tagName:a},r)))}let g=n.forwardRef((e,t)=>{let{prefixCls:a,suffixCls:r,className:c,tagName:l}=e,s=h(e,["prefixCls","suffixCls","className","tagName"]),{getPrefixCls:f}=n.useContext(i.E_),d=f("layout",a),[m,g,p]=(0,u.ZP)(d),v=r?"".concat(d,"-").concat(r):d;return m(n.createElement(l,Object.assign({className:o()(a||v,c,g,p),ref:t},s)))}),p=n.forwardRef((e,t)=>{let{direction:a}=n.useContext(i.E_),[c,m]=n.useState([]),{prefixCls:g,className:p,rootClassName:v,children:w,hasSider:z,tagName:Z,style:y}=e,b=h(e,["prefixCls","className","rootClassName","children","hasSider","tagName","style"]),x=(0,l.Z)(b,["suffixCls"]),{getPrefixCls:k,className:M,style:H}=(0,i.dj)("layout"),C=k("layout",g),L="boolean"==typeof z?z:!!c.length||(0,f.Z)(w).some(e=>e.type===d.Z),[V,E,N]=(0,u.ZP)(C),R=o()(C,{["".concat(C,"-has-sider")]:L,["".concat(C,"-rtl")]:"rtl"===a},M,p,v,E,N),S=n.useMemo(()=>({siderHook:{addSider:e=>{m(t=>[].concat((0,r.Z)(t),[e]))},removeSider:e=>{m(t=>t.filter(t=>t!==e))}}}),[]);return V(n.createElement(s.V.Provider,{value:S},n.createElement(Z,Object.assign({ref:t,className:R,style:Object.assign(Object.assign({},H),y)},x),w)))}),v=m({tagName:"div",displayName:"Layout"})(p),w=m({suffixCls:"header",tagName:"header",displayName:"Header"})(g),z=m({suffixCls:"footer",tagName:"footer",displayName:"Footer"})(g),Z=m({suffixCls:"content",tagName:"main",displayName:"Content"})(g);v.Header=w,v.Footer=z,v.Content=Z,v.Sider=d.Z,v._InternalSiderContext=d.D;var y=v},79205:function(e,t,a){a.d(t,{Z:function(){return d}});var r=a(2265);let n=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),c=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,a)=>a?a.toUpperCase():t.toLowerCase()),o=e=>{let t=c(e);return t.charAt(0).toUpperCase()+t.slice(1)},l=function(){for(var e=arguments.length,t=Array(e),a=0;a!!e&&""!==e.trim()&&a.indexOf(e)===t).join(" ").trim()},i=e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let f=(0,r.forwardRef)((e,t)=>{let{color:a="currentColor",size:n=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:f="",children:d,iconNode:u,...h}=e;return(0,r.createElement)("svg",{ref:t,...s,width:n,height:n,stroke:a,strokeWidth:o?24*Number(c)/Number(n):c,className:l("lucide",f),...!d&&!i(h)&&{"aria-hidden":"true"},...h},[...u.map(e=>{let[t,a]=e;return(0,r.createElement)(t,a)}),...Array.isArray(d)?d:[d]])}),d=(e,t)=>{let a=(0,r.forwardRef)((a,c)=>{let{className:i,...s}=a;return(0,r.createElement)(f,{ref:c,iconNode:t,className:l("lucide-".concat(n(o(e))),"lucide-".concat(e),i),...s})});return a.displayName=o(e),a}},40875:function(e,t,a){a.d(t,{Z:function(){return r}});let r=(0,a(79205).Z)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},22135:function(e,t,a){a.d(t,{Z:function(){return r}});let r=(0,a(79205).Z)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])},51817:function(e,t,a){a.d(t,{Z:function(){return r}});let r=(0,a(79205).Z)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},21047:function(e,t,a){a.d(t,{Z:function(){return r}});let r=(0,a(79205).Z)("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]])},70525:function(e,t,a){a.d(t,{Z:function(){return r}});let r=(0,a(79205).Z)("trending-up",[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]])},76865:function(e,t,a){a.d(t,{Z:function(){return r}});let r=(0,a(79205).Z)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},49663:function(e,t,a){a.d(t,{Z:function(){return r}});let r=(0,a(79205).Z)("user-check",[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]])},95805:function(e,t,a){a.d(t,{Z:function(){return r}});let r=(0,a(79205).Z)("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]])},14474:function(e,t,a){a.d(t,{o:function(){return n}});class r extends Error{}function n(e,t){let a;if("string"!=typeof e)throw new r("Invalid token specified: must be a string");t||(t={});let n=!0===t.header?0:1,c=e.split(".")[n];if("string"!=typeof c)throw new r(`Invalid token specified: missing part #${n+1}`);try{a=function(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw Error("base64 string is not of the correct length")}try{var a;return a=t,decodeURIComponent(atob(a).replace(/(.)/g,(e,t)=>{let a=t.charCodeAt(0).toString(16).toUpperCase();return a.length<2&&(a="0"+a),"%"+a}))}catch(e){return atob(t)}}(c)}catch(e){throw new r(`Invalid token specified: invalid base64 for part #${n+1} (${e.message})`)}try{return JSON.parse(a)}catch(e){throw new r(`Invalid token specified: invalid json for part #${n+1} (${e.message})`)}}r.prototype.name="InvalidTokenError"}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/4623-3d995c58e378474f.js b/litellm/proxy/_experimental/out/_next/static/chunks/4623-3d995c58e378474f.js new file mode 100644 index 00000000000..c350f3e10e1 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/4623-3d995c58e378474f.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4623],{34310:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});var n=r(1119),i=r(2265),s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM472 744a40 40 0 1080 0 40 40 0 10-80 0zm16-104h48c4.4 0 8-3.6 8-8V448c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v184c0 4.4 3.6 8 8 8z"}}]},name:"file-exclamation",theme:"outlined"},o=r(55015),a=i.forwardRef(function(e,t){return i.createElement(o.Z,(0,n.Z)({},e,{ref:t,icon:s}))})},38434:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});var n=r(1119),i=r(2265),s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z"}}]},name:"file-text",theme:"outlined"},o=r(55015),a=i.forwardRef(function(e,t){return i.createElement(o.Z,(0,n.Z)({},e,{ref:t,icon:s}))})},3632:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});var n=r(1119),i=r(2265),s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"},o=r(55015),a=i.forwardRef(function(e,t){return i.createElement(o.Z,(0,n.Z)({},e,{ref:t,icon:s}))})},35291:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});var n=r(1119),i=r(2265),s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M464 720a48 48 0 1096 0 48 48 0 10-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z"}}]},name:"warning",theme:"outlined"},o=r(55015),a=i.forwardRef(function(e,t){return i.createElement(o.Z,(0,n.Z)({},e,{ref:t,icon:s}))})},79205:function(e,t,r){"use strict";r.d(t,{Z:function(){return h}});var n=r(2265);let i=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase()),o=e=>{let t=s(e);return t.charAt(0).toUpperCase()+t.slice(1)},a=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim()},u=e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};var c={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let l=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:i=24,strokeWidth:s=2,absoluteStrokeWidth:o,className:l="",children:h,iconNode:f,...d}=e;return(0,n.createElement)("svg",{ref:t,...c,width:i,height:i,stroke:r,strokeWidth:o?24*Number(s)/Number(i):s,className:a("lucide",l),...!h&&!u(d)&&{"aria-hidden":"true"},...d},[...f.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(h)?h:[h]])}),h=(e,t)=>{let r=(0,n.forwardRef)((r,s)=>{let{className:u,...c}=r;return(0,n.createElement)(l,{ref:s,iconNode:t,className:a("lucide-".concat(i(o(e))),"lucide-".concat(e),u),...c})});return r.displayName=o(e),r}},30401:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},78867:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},15452:function(e,t){var r,n,i;n=[],void 0!==(i="function"==typeof(r=function e(){var t,r="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==r?r:{},n=!r.document&&!!r.postMessage,i=r.IS_PAPA_WORKER||!1,s={},o=0,a={};function u(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(e){var t=v(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new d(t),(this._handle.streamer=this)._config=t}).call(this,e),this.parseChunk=function(e,t){var n=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0=this._config.preview,i)r.postMessage({results:s,workerId:a.WORKER_ID,finished:n});else if(k(this._config.chunk)&&!t){if(this._config.chunk(s,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=s=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(s.data),this._completeResults.errors=this._completeResults.errors.concat(s.errors),this._completeResults.meta=s.meta),this._completed||!n||!k(this._config.complete)||s&&s.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),n||s&&s.meta.paused||this._nextChunk(),s}this._halted=!0},this._sendError=function(e){k(this._config.error)?this._config.error(e):i&&this._config.error&&r.postMessage({workerId:a.WORKER_ID,error:e,finished:!1})}}function c(e){var t;(e=e||{}).chunkSize||(e.chunkSize=a.RemoteChunkSize),u.call(this,e),this._nextChunk=n?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),n||(t.onload=b(this._chunkLoaded,this),t.onerror=b(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!n),this._config.downloadRequestHeaders){var e,r,i=this._config.downloadRequestHeaders;for(r in i)t.setRequestHeader(r,i[r])}this._config.chunkSize&&(e=this._start+this._config.chunkSize-1,t.setRequestHeader("Range","bytes="+this._start+"-"+e));try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}n&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){let e;4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize||t.responseText.length,this._finished=!this._config.chunkSize||this._start>=(null!==(e=(e=t).getResponseHeader("Content-Range"))?parseInt(e.substring(e.lastIndexOf("/")+1)):-1),this.parseChunk(t.responseText)))},this._chunkError=function(e){e=t.statusText||e,this._sendError(Error(e))}}function l(e){(e=e||{}).chunkSize||(e.chunkSize=a.LocalChunkSize),u.call(this,e);var t,r,n="undefined"!=typeof FileReader;this.stream=function(e){this._input=e,r=e.slice||e.webkitSlice||e.mozSlice,n?((t=new FileReader).onload=b(this._chunkLoaded,this),t.onerror=b(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function h(e){var t;u.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){var e,r;if(!this._finished)return t=(e=this._config.chunkSize)?(r=t.substring(0,e),t.substring(e)):(r=t,""),this._finished=!t,this.parseChunk(r)}}function f(e){u.call(this,e=e||{});var t=[],r=!0,n=!1;this.pause=function(){u.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){u.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){n&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):r=!0},this._streamData=b(function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),r&&(r=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}},this),this._streamError=b(function(e){this._streamCleanUp(),this._sendError(e)},this),this._streamEnd=b(function(){this._streamCleanUp(),n=!0,this._streamData("")},this),this._streamCleanUp=b(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function d(e){var t,r,n,i,s=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,o=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,u=this,c=0,l=0,h=!1,f=!1,d=[],m={data:[],errors:[],meta:{}};function _(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function y(){if(m&&n&&(w("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+a.DefaultDelimiter+"'"),n=!1),e.skipEmptyLines&&(m.data=m.data.filter(function(e){return!_(e)})),b()){if(m){if(Array.isArray(m.data[0])){for(var t,r=0;b()&&r=d.length?"__parsed_extra":d[i]:a,c=u=e.transform?e.transform(u,a):u,(e.dynamicTypingFunction&&void 0===e.dynamicTyping[r]&&(e.dynamicTyping[r]=e.dynamicTypingFunction(r)),!0===(e.dynamicTyping[r]||e.dynamicTyping))?"true"===c||"TRUE"===c||"false"!==c&&"FALSE"!==c&&((e=>{if(s.test(e)&&-9007199254740992<(e=parseFloat(e))&&e<9007199254740992)return 1})(c)?parseFloat(c):o.test(c)?new Date(c):""===c?null:c):c);"__parsed_extra"===a?(n[a]=n[a]||[],n[a].push(u)):n[a]=u}return e.header&&(i>d.length?w("FieldMismatch","TooManyFields","Too many fields: expected "+d.length+" fields but parsed "+i,l+r):ie.preview?r.abort():(m.data=m.data[0],i(m,u))))}),this.parse=function(i,s,o){var u=e.quoteChar||'"',u=(e.newline||(e.newline=this.guessLineEndings(i,u)),n=!1,e.delimiter?k(e.delimiter)&&(e.delimiter=e.delimiter(i),m.meta.delimiter=e.delimiter):((u=((t,r,n,i,s)=>{var o,u,c,l;s=s||[","," ","|",";",a.RECORD_SEP,a.UNIT_SEP];for(var h=0;h=r.length/2?"\r\n":"\r"}}function p(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function g(e){var t=(e=e||{}).delimiter,r=e.newline,n=e.comments,i=e.step,s=e.preview,o=e.fastMode,u=null,c=!1,l=null==e.quoteChar?'"':e.quoteChar,h=l;if(void 0!==e.escapeChar&&(h=e.escapeChar),("string"!=typeof t||-1=s)return F(!0);break}O.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:E.length,index:f}),T++}}else if(n&&0===C.length&&a.substring(f,f+b)===n){if(-1===L)return F();f=L+v,L=a.indexOf(r,f),j=a.indexOf(t,f)}else if(-1!==j&&(j=s)return F(!0)}return M();function D(e){E.push(e),R=f}function z(e){return -1!==e&&(e=a.substring(T+1,e))&&""===e.trim()?e.length:0}function M(e){return m||(void 0===e&&(e=a.substring(f)),C.push(e),f=_,D(C),w&&Z()),F()}function P(e){f=e,D(C),C=[],L=a.indexOf(r,f)}function F(n){if(e.header&&!g&&E.length&&!c){var i=E[0],s=Object.create(null),o=new Set(i);let t=!1;for(let r=0;r{if("object"==typeof t){if("string"!=typeof t.delimiter||a.BAD_DELIMITERS.filter(function(e){return -1!==t.delimiter.indexOf(e)}).length||(i=t.delimiter),("boolean"==typeof t.quotes||"function"==typeof t.quotes||Array.isArray(t.quotes))&&(r=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(c=t.skipEmptyLines),"string"==typeof t.newline&&(s=t.newline),"string"==typeof t.quoteChar&&(o=t.quoteChar),"boolean"==typeof t.header&&(n=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw Error("Option columns is empty");l=t.columns}void 0!==t.escapeChar&&(u=t.escapeChar+o),t.escapeFormulae instanceof RegExp?h=t.escapeFormulae:"boolean"==typeof t.escapeFormulae&&t.escapeFormulae&&(h=/^[=+\-@\t\r].*$/)}})(),RegExp(p(o),"g"));if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return d(null,e,c);if("object"==typeof e[0])return d(l||Object.keys(e[0]),e,c)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||l),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),d(e.fields||[],e.data||[],c);throw Error("Unable to serialize unrecognized input");function d(e,t,r){var o="",a=("string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t)),Array.isArray(e)&&0{for(var r=0;r=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(e,o),n=i.default.Children.only(t);return i.default.cloneElement(n,c(c({},r),{},{onClick:this.onClick}))}}],function(e,t){for(var r=0;r{var e,t,a,i,c,o;let d=(0,r.useRouter)(),u="undefined"!=typeof document?(0,n.e)("token"):null;(0,s.useEffect)(()=>{u||d.replace("/sso/key/generate")},[u,d]);let m=(0,s.useMemo)(()=>{if(!u)return null;try{return(0,l.o)(u)}catch(e){return(0,n.b)(),d.replace("/sso/key/generate"),null}},[u,d]);return{token:u,accessToken:null!==(e=null==m?void 0:m.key)&&void 0!==e?e:null,userId:null!==(t=null==m?void 0:m.user_id)&&void 0!==t?t:null,userEmail:null!==(a=null==m?void 0:m.user_email)&&void 0!==a?a:null,userRole:function(e){if(!e)return"Undefined Role";switch(e.toLowerCase()){case"app_owner":case"demo_app_owner":return"App Owner";case"app_admin":case"proxy_admin":return"Admin";case"proxy_admin_viewer":return"Admin Viewer";case"org_admin":return"Org Admin";case"internal_user":return"Internal User";case"internal_user_viewer":case"internal_viewer":return"Internal Viewer";case"app_user":return"App User";default:return"Unknown Role"}}(null!==(i=null==m?void 0:m.user_role)&&void 0!==i?i:null),premiumUser:null!==(c=null==m?void 0:m.premium_user)&&void 0!==c?c:null,disabledPersonalKeyCreation:null!==(o=null==m?void 0:m.disabled_non_admin_personal_key_creation)&&void 0!==o?o:null,showSSOBanner:(null==m?void 0:m.login_method)==="username_password"}}},82586:function(e,t,a){var s=a(57437),r=a(2265),l=a(37592),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:c,placeholder:o="Select agents",disabled:d=!1}=e,[u,m]=(0,r.useState)([]),[p,g]=(0,r.useState)([]),[x,h]=(0,r.useState)(!1);(0,r.useEffect)(()=>{(async()=>{if(c){h(!0);try{let e=await (0,n.getAgentsList)(c),t=(null==e?void 0:e.agents)||[];m(t);let a=new Set;t.forEach(e=>{let t=e.agent_access_groups;t&&Array.isArray(t)&&t.forEach(e=>a.add(e))}),g(Array.from(a))}catch(e){console.error("Error fetching agents:",e)}finally{h(!1)}}})()},[c]);let f=[...p.map(e=>({label:e,value:"group:".concat(e),isAccessGroup:!0,searchText:"".concat(e," Access Group")})),...u.map(e=>({label:"".concat(e.agent_name||e.agent_id),value:e.agent_id,isAccessGroup:!1,searchText:"".concat(e.agent_name||e.agent_id," ").concat(e.agent_id," Agent")}))],v=[...(null==a?void 0:a.agents)||[],...((null==a?void 0:a.accessGroups)||[]).map(e=>"group:".concat(e))];return(0,s.jsx)("div",{children:(0,s.jsx)(l.default,{mode:"multiple",placeholder:o,onChange:e=>{t({agents:e.filter(e=>!e.startsWith("group:")),accessGroups:e.filter(e=>e.startsWith("group:")).map(e=>e.replace("group:",""))})},value:v,loading:x,className:i,showSearch:!0,style:{width:"100%"},disabled:d,filterOption:(e,t)=>{var a;return((null===(a=f.find(e=>e.value===(null==t?void 0:t.value)))||void 0===a?void 0:a.searchText)||"").toLowerCase().includes(e.toLowerCase())},children:f.map(e=>(0,s.jsx)(l.default.Option,{value:e.value,label:e.label,children:(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,s.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:e.isAccessGroup?"#52c41a":"#722ed1",flexShrink:0}}),(0,s.jsx)("span",{style:{flex:1},children:e.label}),(0,s.jsx)("span",{style:{color:e.isAccessGroup?"#52c41a":"#722ed1",fontSize:"12px",fontWeight:500,opacity:.8},children:e.isAccessGroup?"Access Group":"Agent"})]})},e.value))})})}},97434:function(e,t,a){a.d(t,{Dg:function(){return l},Lo:function(){return n},PA:function(){return o},RD:function(){return i},Z3:function(){return c}});let s="../ui/assets/logos/",r=[{id:"arize",displayName:"Arize",logo:"".concat(s,"arize.png"),supports_key_team_logging:!0,dynamic_params:{arize_api_key:"password",arize_space_id:"password"},description:"Arize Logging Integration"},{id:"braintrust",displayName:"Braintrust",logo:"".concat(s,"braintrust.png"),supports_key_team_logging:!1,dynamic_params:{braintrust_api_key:"password",braintrust_project_name:"text"},description:"Braintrust Logging Integration"},{id:"custom_callback_api",displayName:"Custom Callback API",logo:"".concat(s,"custom.svg"),supports_key_team_logging:!0,dynamic_params:{custom_callback_api_url:"text",custom_callback_api_headers:"text"},description:"Custom Callback API Logging Integration"},{id:"datadog",displayName:"Datadog",logo:"".concat(s,"datadog.png"),supports_key_team_logging:!1,dynamic_params:{dd_api_key:"password",dd_site:"text"},description:"Datadog Logging Integration"},{id:"lago",displayName:"Lago",logo:"".concat(s,"lago.svg"),supports_key_team_logging:!1,dynamic_params:{lago_api_url:"text",lago_api_key:"password"},description:"Lago Billing Logging Integration"},{id:"langfuse",displayName:"Langfuse",logo:"".concat(s,"langfuse.png"),supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v2 Logging Integration"},{id:"langfuse_otel",displayName:"Langfuse OTEL",logo:"".concat(s,"langfuse.png"),supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v3 OTEL Logging Integration"},{id:"langsmith",displayName:"LangSmith",logo:"".concat(s,"langsmith.png"),supports_key_team_logging:!0,dynamic_params:{langsmith_api_key:"password",langsmith_project:"text",langsmith_base_url:"text",langsmith_sampling_rate:"number"},description:"Langsmith Logging Integration"},{id:"openmeter",displayName:"OpenMeter",logo:"".concat(s,"openmeter.png"),supports_key_team_logging:!1,dynamic_params:{openmeter_api_key:"password",openmeter_base_url:"text"},description:"OpenMeter Logging Integration"},{id:"otel",displayName:"Open Telemetry",logo:"".concat(s,"otel.png"),supports_key_team_logging:!1,dynamic_params:{otel_endpoint:"text",otel_headers:"text"},description:"OpenTelemetry Logging Integration"},{id:"s3",displayName:"S3",logo:"".concat(s,"aws.svg"),supports_key_team_logging:!1,dynamic_params:{s3_bucket_name:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"S3 Bucket (AWS) Logging Integration"},{id:"SQS",displayName:"SQS",logo:"".concat(s,"aws.svg"),supports_key_team_logging:!1,dynamic_params:{sqs_queue_url:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"SQS Queue (AWS) Logging Integration"}],l=r.reduce((e,t)=>(e[t.displayName]=t,e),{}),n=r.reduce((e,t)=>(e[t.displayName]=t.id,e),{}),i=r.reduce((e,t)=>(e[t.id]=t.displayName,e),{}),c=e=>e.map(e=>n[e]||e),o=e=>e.map(e=>i[e]||e)},95096:function(e,t,a){var s=a(57437),r=a(2265),l=a(37592),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:c,placeholder:o="Select pass through routes",disabled:d=!1,teamId:u}=e,[m,p]=(0,r.useState)([]),[g,x]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(c){x(!0);try{let e=await (0,n.getPassThroughEndpointsCall)(c,u);if(e.endpoints){let t=e.endpoints.map(e=>e.path);p(t)}}catch(e){console.error("Error fetching pass through routes:",e)}finally{x(!1)}}})()},[c,u]),(0,s.jsx)(l.default,{mode:"tags",placeholder:o,onChange:t,value:a,loading:g,className:i,options:m.map(e=>({label:e,value:e})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:d})}},46468:function(e,t,a){a.d(t,{K2:function(){return r},Ob:function(){return n},W0:function(){return l}});var s=a(19250);let r=async(e,t,a)=>{try{if(null===e||null===t)return;if(null!==a){let r=(await (0,s.modelAvailableCall)(a,e,t,!0,null,!0)).data.map(e=>e.id),l=[],n=[];return r.forEach(e=>{e.endsWith("/*")?l.push(e):n.push(e)}),[...l,...n]}}catch(e){console.error("Error fetching user models:",e)}},l=e=>{if(e.endsWith("/*")){let t=e.replace("/*","");return"All ".concat(t," models")}return e},n=(e,t)=>{let a=[],s=[];return console.log("teamModels",e),console.log("allModels",t),e.forEach(e=>{if(e.endsWith("/*")){let r=e.replace("/*",""),l=t.filter(e=>e.startsWith(r+"/"));s.push(...l),a.push(e)}else s.push(e)}),[...a,...s].filter((e,t,a)=>a.indexOf(e)===t)}},95920:function(e,t,a){var s=a(57437),r=a(2265),l=a(37592),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:c,placeholder:o="Select MCP servers",disabled:d=!1}=e,[u,m]=(0,r.useState)([]),[p,g]=(0,r.useState)([]),[x,h]=(0,r.useState)(!1);(0,r.useEffect)(()=>{(async()=>{if(c){h(!0);try{let[e,t]=await Promise.all([(0,n.fetchMCPServers)(c),(0,n.fetchMCPAccessGroups)(c)]),a=Array.isArray(e)?e:e.data||[],s=Array.isArray(t)?t:t.data||[];m(a),g(s)}catch(e){console.error("Error fetching MCP servers or access groups:",e)}finally{h(!1)}}})()},[c]);let f=[...p.map(e=>({label:e,value:e,isAccessGroup:!0,searchText:"".concat(e," Access Group")})),...u.map(e=>({label:"".concat(e.server_name||e.server_id," (").concat(e.server_id,")"),value:e.server_id,isAccessGroup:!1,searchText:"".concat(e.server_name||e.server_id," ").concat(e.server_id," MCP Server")}))],v=[...(null==a?void 0:a.servers)||[],...(null==a?void 0:a.accessGroups)||[]];return(0,s.jsx)("div",{children:(0,s.jsx)(l.default,{mode:"multiple",placeholder:o,onChange:e=>{t({servers:e.filter(e=>!p.includes(e)),accessGroups:e.filter(e=>p.includes(e))})},value:v,loading:x,className:i,showSearch:!0,style:{width:"100%"},disabled:d,filterOption:(e,t)=>{var a;return((null===(a=f.find(e=>e.value===(null==t?void 0:t.value)))||void 0===a?void 0:a.searchText)||"").toLowerCase().includes(e.toLowerCase())},children:f.map(e=>(0,s.jsx)(l.default.Option,{value:e.value,label:e.label,children:(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,s.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:e.isAccessGroup?"#52c41a":"#1890ff",flexShrink:0}}),(0,s.jsx)("span",{style:{flex:1},children:e.label}),(0,s.jsx)("span",{style:{color:e.isAccessGroup?"#52c41a":"#1890ff",fontSize:"12px",fontWeight:500,opacity:.8},children:e.isAccessGroup?"Access Group":"MCP Server"})]})},e.value))})})}},68473:function(e,t,a){var s=a(57437),r=a(2265),l=a(19250),n=a(92280),i=a(10353),c=a(61994),o=a(32489);t.Z=e=>{let{accessToken:t,selectedServers:a,toolPermissions:d,onChange:u,disabled:m=!1}=e,[p,g]=(0,r.useState)([]),[x,h]=(0,r.useState)({}),[f,v]=(0,r.useState)({}),[_,y]=(0,r.useState)({});(0,r.useEffect)(()=>{(async()=>{if(0===a.length){g([]);return}try{let e=await (0,l.fetchMCPServers)(t),s=(Array.isArray(e)?e:e.data||[]).filter(e=>a.includes(e.server_id));g(s)}catch(e){console.error("Error fetching MCP servers:",e),g([])}})()},[a,t]);let b=async e=>{v(t=>({...t,[e]:!0})),y(t=>({...t,[e]:""}));try{let a=await (0,l.listMCPTools)(t,e);a.error?(y(t=>({...t,[e]:a.message||"Failed to fetch tools"})),h(t=>({...t,[e]:[]}))):h(t=>({...t,[e]:a.tools||[]}))}catch(t){console.error("Error fetching tools for server ".concat(e,":"),t),y(t=>({...t,[e]:"Failed to fetch tools"})),h(t=>({...t,[e]:[]}))}finally{v(t=>({...t,[e]:!1}))}};(0,r.useEffect)(()=>{p.forEach(e=>{x[e.server_id]||f[e.server_id]||b(e.server_id)})},[p]);let j=(e,t)=>{let a=d[e]||[],s=a.includes(t)?a.filter(e=>e!==t):[...a,t];u({...d,[e]:s})},N=e=>{let t=x[e]||[];u({...d,[e]:t.map(e=>e.name)})},w=e=>{u({...d,[e]:[]})};return 0===a.length?null:(0,s.jsx)("div",{className:"space-y-4",children:p.map(e=>{let t=e.server_name||e.alias||e.server_id,a=x[e.server_id]||[],r=d[e.server_id]||[],l=f[e.server_id],u=_[e.server_id];return(0,s.jsxs)("div",{className:"border rounded-lg bg-gray-50",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between p-4 border-b bg-white rounded-t-lg",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(n.x,{className:"font-semibold text-gray-900",children:t}),e.description&&(0,s.jsx)(n.x,{className:"text-sm text-gray-500",children:e.description})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("button",{className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>N(e.server_id),disabled:m||l,children:"Select All"}),(0,s.jsx)("button",{className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>w(e.server_id),disabled:m||l,children:"Deselect All"}),(0,s.jsx)("button",{className:"text-gray-400 hover:text-gray-600",onClick:()=>{},children:(0,s.jsx)(o.Z,{className:"w-4 h-4"})})]})]}),(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)(n.x,{className:"text-sm font-medium text-gray-700 mb-3",children:"Available Tools"}),l&&(0,s.jsxs)("div",{className:"flex items-center justify-center py-8",children:[(0,s.jsx)(i.Z,{size:"large"}),(0,s.jsx)(n.x,{className:"ml-3 text-gray-500",children:"Loading tools..."})]}),u&&!l&&(0,s.jsxs)("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg text-center",children:[(0,s.jsx)(n.x,{className:"text-red-600 font-medium",children:"Unable to load tools"}),(0,s.jsx)(n.x,{className:"text-sm text-red-500 mt-1",children:u})]}),!l&&!u&&a.length>0&&(0,s.jsx)("div",{className:"space-y-2",children:a.map(t=>{let a=r.includes(t.name);return(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)(c.Z,{checked:a,onChange:()=>j(e.server_id,t.name),disabled:m}),(0,s.jsx)("div",{className:"flex-1 min-w-0",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(n.x,{className:"font-medium text-gray-900",children:t.name}),(0,s.jsxs)(n.x,{className:"text-sm text-gray-500",children:["- ",t.description||"No description"]})]})})]},t.name)})}),!l&&!u&&0===a.length&&(0,s.jsx)("div",{className:"text-center py-6",children:(0,s.jsx)(n.x,{className:"text-gray-500",children:"No tools available"})})]})]},e.server_id)})})}},10703:function(e,t,a){a.d(t,{p:function(){return r}});var s=a(19250);let r=async e=>{try{let t=await (0,s.modelHubCall)(e);if(console.log("model_info:",t),(null==t?void 0:t.data.length)>0){let e=t.data.map(e=>({model_group:e.model_group,mode:null==e?void 0:e.mode}));return e.sort((e,t)=>e.model_group.localeCompare(t.model_group)),e}return[]}catch(e){throw console.error("Error fetching model info:",e),e}}},24199:function(e,t,a){a.d(t,{Z:function(){return l}});var s=a(57437);a(2265);var r=a(30150),l=e=>{let{step:t=.01,style:a={width:"100%"},placeholder:l="Enter a numerical value",min:n,max:i,onChange:c,...o}=e;return(0,s.jsx)(r.Z,{onWheel:e=>e.currentTarget.blur(),step:t,style:a,placeholder:l,min:n,max:i,onChange:c,...o})}},54507:function(e,t,a){a.d(t,{Z:function(){return v}});var s=a(57437);a(2265);var r=a(37592),l=a(99981),n=a(23496),i=a(15424),c=a(78489),o=a(12514),d=a(49566),u=a(91777),m=a(82182),p=a(22452),g=a(74998),x=a(97434),h=a(24199);let{Option:f}=r.default;var v=e=>{let{value:t=[],onChange:a,disabledCallbacks:v=[],onDisabledCallbacksChange:_}=e,y=Object.entries(x.Dg).filter(e=>{let[t,a]=e;return a.supports_key_team_logging}).map(e=>{let[t,a]=e;return t}),b=Object.keys(x.Dg),j=e=>{null==a||a(e)},N=e=>{j(t.filter((t,a)=>a!==e))},w=(e,a,s)=>{let r=[...t];if("callback_name"===a){let t=x.Lo[s]||s;r[e]={...r[e],[a]:t,callback_vars:{}}}else r[e]={...r[e],[a]:s};j(r)},k=(e,a,s)=>{let r=[...t];r[e]={...r[e],callback_vars:{...r[e].callback_vars,[a]:s}},j(r)},C=(e,t)=>{var a,r;if(!e.callback_name)return null;let n=null===(a=Object.entries(x.Lo).find(t=>{let[a,s]=t;return s===e.callback_name}))||void 0===a?void 0:a[0];if(!n)return null;let c=(null===(r=x.Dg[n])||void 0===r?void 0:r.dynamic_params)||{};return 0===Object.keys(c).length?null:(0,s.jsxs)("div",{className:"mt-6 pt-4 border-t border-gray-100",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2 mb-4",children:[(0,s.jsx)("div",{className:"w-3 h-3 bg-blue-100 rounded-full flex items-center justify-center",children:(0,s.jsx)("div",{className:"w-1.5 h-1.5 bg-blue-500 rounded-full"})}),(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Integration Parameters"})]}),(0,s.jsx)("div",{className:"grid grid-cols-1 gap-4",children:Object.entries(c).map(a=>{let[r,n]=a;return(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("label",{className:"text-sm font-medium text-gray-700 capitalize flex items-center space-x-1",children:[(0,s.jsx)("span",{children:r.replace(/_/g," ")}),(0,s.jsx)(l.Z,{title:"Environment variable reference recommended: os.environ/".concat(r.toUpperCase()),children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help text-xs"})}),"password"===n&&(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Sensitive"}),"number"===n&&(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Number"})]}),"number"===n&&(0,s.jsx)("span",{className:"text-xs text-gray-500",children:"Value must be between 0 and 1"}),"number"===n?(0,s.jsx)(h.Z,{step:.01,width:400,placeholder:"os.environ/".concat(r.toUpperCase()),value:e.callback_vars[r]||"",onChange:e=>k(t,r,e.target.value)}):(0,s.jsx)(d.Z,{type:"password"===n?"password":"text",placeholder:"os.environ/".concat(r.toUpperCase()),value:e.callback_vars[r]||"",onChange:e=>k(t,r,e.target.value)})]},r)})})]})};return(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(u.Z,{className:"w-5 h-5 text-red-500"}),(0,s.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Disabled Callbacks"}),(0,s.jsx)(l.Z,{title:"Select callbacks to disable for this key. Disabled callbacks will not receive any logging data.",children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help"})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Disabled Callbacks"}),(0,s.jsx)(r.default,{mode:"multiple",placeholder:"Select callbacks to disable",value:v,onChange:e=>{let t=(0,x.Z3)(e);null==_||_(t)},style:{width:"100%"},optionLabelProp:"label",children:b.map(e=>{var t,a;let r=null===(t=x.Dg[e])||void 0===t?void 0:t.logo,n=null===(a=x.Dg[e])||void 0===a?void 0:a.description;return(0,s.jsx)(f,{value:e,label:e,children:(0,s.jsx)(l.Z,{title:n,placement:"right",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[r&&(0,s.jsx)("img",{src:r,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let a=t.target,s=a.parentElement;if(s){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),s.replaceChild(t,a)}}}),(0,s.jsx)("span",{children:e})]})})},e)})}),(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"Select callbacks that should be disabled for this key. These callbacks will not receive any logging data."})]})]}),(0,s.jsx)(n.Z,{}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(m.Z,{className:"w-5 h-5 text-blue-500"}),(0,s.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Logging Integrations"}),(0,s.jsx)(l.Z,{title:"Configure callback logging integrations for this team.",children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help"})})]}),(0,s.jsx)(c.Z,{variant:"secondary",onClick:()=>{j([...t,{callback_name:"",callback_type:"success",callback_vars:{}}])},icon:p.Z,size:"sm",className:"hover:border-blue-400 hover:text-blue-500",type:"button",children:"Add Integration"})]}),(0,s.jsx)("div",{className:"space-y-4",children:t.map((e,t)=>{var a,n;let i=e.callback_name?null===(a=Object.entries(x.Lo).find(t=>{let[a,s]=t;return s===e.callback_name}))||void 0===a?void 0:a[0]:void 0,d=i?null===(n=x.Dg[i])||void 0===n?void 0:n.logo:null;return(0,s.jsxs)(o.Z,{className:"border border-gray-200 shadow-sm hover:shadow-md transition-shadow duration-200",decoration:"top",decorationColor:"blue",children:[(0,s.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[d&&(0,s.jsx)("img",{src:d,alt:i,className:"w-5 h-5 object-contain"}),(0,s.jsxs)("span",{className:"text-sm font-medium",children:[i||"New Integration"," Configuration"]})]}),(0,s.jsx)(c.Z,{variant:"light",onClick:()=>N(t),icon:g.Z,size:"xs",color:"red",className:"hover:bg-red-50",type:"button",children:"Remove"})]}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Integration Type"}),(0,s.jsx)(r.default,{value:i,placeholder:"Select integration",onChange:e=>w(t,"callback_name",e),className:"w-full",optionLabelProp:"label",children:y.map(e=>{var t,a;let r=null===(t=x.Dg[e])||void 0===t?void 0:t.logo,n=null===(a=x.Dg[e])||void 0===a?void 0:a.description;return(0,s.jsx)(f,{value:e,label:e,children:(0,s.jsx)(l.Z,{title:n,placement:"right",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[r&&(0,s.jsx)("img",{src:r,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let a=t.target,s=a.parentElement;if(s){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),s.replaceChild(t,a)}}}),(0,s.jsx)("span",{children:e})]})})},e)})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Event Type"}),(0,s.jsxs)(r.default,{value:e.callback_type,onChange:e=>w(t,"callback_type",e),className:"w-full",children:[(0,s.jsx)(f,{value:"success",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,s.jsx)("span",{children:"Success Only"})]})}),(0,s.jsx)(f,{value:"failure",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-red-500 rounded-full"}),(0,s.jsx)("span",{children:"Failure Only"})]})}),(0,s.jsx)(f,{value:"success_and_failure",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,s.jsx)("span",{children:"Success & Failure"})]})})]})]})]}),C(e,t)]})]},t)})}),0===t.length&&(0,s.jsxs)("div",{className:"text-center py-12 text-gray-500 border-2 border-dashed border-gray-200 rounded-lg bg-gray-50/50",children:[(0,s.jsx)(m.Z,{className:"w-12 h-12 text-gray-300 mb-3 mx-auto"}),(0,s.jsx)("div",{className:"text-base font-medium mb-1",children:"No logging integrations configured"}),(0,s.jsx)("div",{className:"text-sm text-gray-400",children:'Click "Add Integration" to configure logging for this team'})]})]})}},97415:function(e,t,a){var s=a(57437),r=a(2265),l=a(37592),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:c,placeholder:o="Select vector stores",disabled:d=!1}=e,[u,m]=(0,r.useState)([]),[p,g]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(c){g(!0);try{let e=await (0,n.vectorStoreListCall)(c);e.data&&m(e.data)}catch(e){console.error("Error fetching vector stores:",e)}finally{g(!1)}}})()},[c]),(0,s.jsx)("div",{children:(0,s.jsx)(l.default,{mode:"multiple",placeholder:o,onChange:t,value:a,loading:p,className:i,options:u.map(e=>({label:"".concat(e.vector_store_name||e.vector_store_id," (").concat(e.vector_store_id,")"),value:e.vector_store_id,title:e.vector_store_description||e.vector_store_id})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:d})})}},59872:function(e,t,a){a.d(t,{nl:function(){return r},pw:function(){return l},vQ:function(){return n}});var s=a(9114);function r(e,t){let a=structuredClone(e);for(let[e,s]of Object.entries(t))e in a&&(a[e]=s);return a}let l=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(null==e||!Number.isFinite(e))return"-";let s={minimumFractionDigits:t,maximumFractionDigits:t};if(!a)return e.toLocaleString("en-US",s);let r=Math.abs(e),l=r,n="";return r>=1e6?(l=r/1e6,n="M"):r>=1e3&&(l=r/1e3,n="K"),"".concat(e<0?"-":"").concat(l.toLocaleString("en-US",s)).concat(n)},n=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Copied to clipboard";if(!e)return!1;if(!navigator||!navigator.clipboard||!navigator.clipboard.writeText)return i(e,t);try{return await navigator.clipboard.writeText(e),s.Z.success(t),!0}catch(a){return console.error("Clipboard API failed: ",a),i(e,t)}},i=(e,t)=>{try{let a=document.createElement("textarea");a.value=e,a.style.position="fixed",a.style.left="-999999px",a.style.top="-999999px",a.setAttribute("readonly",""),document.body.appendChild(a),a.focus(),a.select();let r=document.execCommand("copy");if(document.body.removeChild(a),r)return s.Z.success(t),!0;throw Error("execCommand failed")}catch(e){return s.Z.fromBackend("Failed to copy to clipboard"),console.error("Failed to copy: ",e),!1}}},20347:function(e,t,a){a.d(t,{LQ:function(){return l},P4:function(){return i},ZL:function(){return s},lo:function(){return r},tY:function(){return n}});let s=["Admin","Admin Viewer","proxy_admin","proxy_admin_viewer","org_admin"],r=["Internal User","Internal Viewer"],l=["Internal User","Admin","proxy_admin"],n=e=>s.includes(e),i=e=>"proxy_admin"===e||"Admin"===e}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/475-3985fee235e827f8.js b/litellm/proxy/_experimental/out/_next/static/chunks/475-3985fee235e827f8.js deleted file mode 100644 index 7eb58ce2ed9..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/475-3985fee235e827f8.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[475],{7084:function(e,r,t){t.d(r,{fr:function(){return n},m:function(){return i},u8:function(){return l},wu:function(){return o},zS:function(){return a}});let o={Increase:"increase",ModerateIncrease:"moderateIncrease",Decrease:"decrease",ModerateDecrease:"moderateDecrease",Unchanged:"unchanged"},n={Slate:"slate",Gray:"gray",Zinc:"zinc",Neutral:"neutral",Stone:"stone",Red:"red",Orange:"orange",Amber:"amber",Yellow:"yellow",Lime:"lime",Green:"green",Emerald:"emerald",Teal:"teal",Cyan:"cyan",Sky:"sky",Blue:"blue",Indigo:"indigo",Violet:"violet",Purple:"purple",Fuchsia:"fuchsia",Pink:"pink",Rose:"rose"},l={XS:"xs",SM:"sm",MD:"md",LG:"lg",XL:"xl"},a={Left:"left",Right:"right"},i={Top:"top",Bottom:"bottom"}},26898:function(e,r,t){t.d(r,{K:function(){return n},s:function(){return l}});var o=t(7084);let n={canvasBackground:50,lightBackground:100,background:500,darkBackground:600,darkestBackground:800,lightBorder:200,border:500,darkBorder:700,lightRing:200,ring:300,iconRing:500,lightText:400,text:500,iconText:600,darkText:700,darkestText:900,icon:500},l=[o.fr.Blue,o.fr.Cyan,o.fr.Sky,o.fr.Indigo,o.fr.Violet,o.fr.Purple,o.fr.Fuchsia,o.fr.Slate,o.fr.Gray,o.fr.Zinc,o.fr.Neutral,o.fr.Stone,o.fr.Red,o.fr.Orange,o.fr.Amber,o.fr.Yellow,o.fr.Lime,o.fr.Green,o.fr.Emerald,o.fr.Teal,o.fr.Pink,o.fr.Rose]},13241:function(e,r,t){t.d(r,{q:function(){return er}});let o=e=>{let r=i(e),{conflictingClassGroups:t,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:e=>{let t=e.split("-");return""===t[0]&&1!==t.length&&t.shift(),n(t,r)||a(e)},getConflictingClassGroupIds:(e,r)=>{let n=t[e]||[];return r&&o[e]?[...n,...o[e]]:n}}},n=(e,r)=>{var t;if(0===e.length)return r.classGroupId;let o=e[0],l=r.nextPart.get(o),a=l?n(e.slice(1),l):void 0;if(a)return a;if(0===r.validators.length)return;let i=e.join("-");return null===(t=r.validators.find(e=>{let{validator:r}=e;return r(i)}))||void 0===t?void 0:t.classGroupId},l=/^\[(.+)\]$/,a=e=>{if(l.test(e)){let r=l.exec(e)[1],t=null==r?void 0:r.substring(0,r.indexOf(":"));if(t)return"arbitrary.."+t}},i=e=>{let{theme:r,prefix:t}=e,o={nextPart:new Map,validators:[]};return u(Object.entries(e.classGroups),t).forEach(e=>{let[t,n]=e;c(n,o,t,r)}),o},c=(e,r,t,o)=>{e.forEach(e=>{if("string"==typeof e){(""===e?r:s(r,e)).classGroupId=t;return}if("function"==typeof e){if(d(e)){c(e(o),r,t,o);return}r.validators.push({validator:e,classGroupId:t});return}Object.entries(e).forEach(e=>{let[n,l]=e;c(l,s(r,n),t,o)})})},s=(e,r)=>{let t=e;return r.split("-").forEach(e=>{t.nextPart.has(e)||t.nextPart.set(e,{nextPart:new Map,validators:[]}),t=t.nextPart.get(e)}),t},d=e=>e.isThemeGetter,u=(e,r)=>r?e.map(e=>{let[t,o]=e;return[t,o.map(e=>"string"==typeof e?r+e:"object"==typeof e?Object.fromEntries(Object.entries(e).map(e=>{let[t,o]=e;return[r+t,o]})):e)]}):e,p=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let r=0,t=new Map,o=new Map,n=(n,l)=>{t.set(n,l),++r>e&&(r=0,o=t,t=new Map)};return{get(e){let r=t.get(e);return void 0!==r?r:void 0!==(r=o.get(e))?(n(e,r),r):void 0},set(e,r){t.has(e)?t.set(e,r):n(e,r)}}},f=e=>{let{separator:r,experimentalParseClassName:t}=e,o=1===r.length,n=r[0],l=r.length,a=e=>{let t;let a=[],i=0,c=0;for(let s=0;sc?t-c:void 0}};return t?e=>t({className:e,parseClassName:a}):a},b=e=>{if(e.length<=1)return e;let r=[],t=[];return e.forEach(e=>{"["===e[0]?(r.push(...t.sort(),e),t=[]):t.push(e)}),r.push(...t.sort()),r},g=e=>({cache:p(e.cacheSize),parseClassName:f(e),...o(e)}),m=/\s+/,h=(e,r)=>{let{parseClassName:t,getClassGroupId:o,getConflictingClassGroupIds:n}=r,l=[],a=e.trim().split(m),i="";for(let e=a.length-1;e>=0;e-=1){let r=a[e],{modifiers:c,hasImportantModifier:s,baseClassName:d,maybePostfixModifierPosition:u}=t(r),p=!!u,f=o(p?d.substring(0,u):d);if(!f){if(!p||!(f=o(d))){i=r+(i.length>0?" "+i:i);continue}p=!1}let g=b(c).join(":"),m=s?g+"!":g,h=m+f;if(l.includes(h))continue;l.push(h);let y=n(f,p);for(let e=0;e0?" "+i:i)}return i};function y(){let e,r,t=0,o="";for(;t{let r;if("string"==typeof e)return e;let t="";for(let o=0;o1?n-1:0),a=1;ar(e),e()))).cache.get,o=r.cache.set,i=c,c(n)};function c(e){let n=t(e);if(n)return n;let l=h(e,r);return o(e,l),l}return function(){return i(y.apply(null,arguments))}}let w=e=>{let r=r=>r[e]||[];return r.isThemeGetter=!0,r},k=/^\[(?:([a-z-]+):)?(.+)\]$/i,z=/^\d+\/\d+$/,C=new Set(["px","full","screen"]),S=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,j=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,O=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,P=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Z=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,I=e=>E(e)||C.has(e)||z.test(e),B=e=>F(e,"length",U),E=e=>!!e&&!Number.isNaN(Number(e)),G=e=>F(e,"number",E),M=e=>!!e&&Number.isInteger(Number(e)),T=e=>e.endsWith("%")&&E(e.slice(0,-1)),N=e=>k.test(e),A=e=>S.test(e),R=new Set(["length","size","percentage"]),D=e=>F(e,R,V),$=e=>F(e,"position",V),_=new Set(["image","url"]),L=e=>F(e,_,Y),q=e=>F(e,"",X),W=()=>!0,F=(e,r,t)=>{let o=k.exec(e);return!!o&&(o[1]?"string"==typeof r?o[1]===r:r.has(o[1]):t(o[2]))},U=e=>j.test(e)&&!O.test(e),V=()=>!1,X=e=>P.test(e),Y=e=>Z.test(e),K=()=>{let e=w("colors"),r=w("spacing"),t=w("blur"),o=w("brightness"),n=w("borderColor"),l=w("borderRadius"),a=w("borderSpacing"),i=w("borderWidth"),c=w("contrast"),s=w("grayscale"),d=w("hueRotate"),u=w("invert"),p=w("gap"),f=w("gradientColorStops"),b=w("gradientColorStopPositions"),g=w("inset"),m=w("margin"),h=w("opacity"),y=w("padding"),v=w("saturate"),x=w("scale"),k=w("sepia"),z=w("skew"),C=w("space"),S=w("translate"),j=()=>["auto","contain","none"],O=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto",N,r],Z=()=>[N,r],R=()=>["",I,B],_=()=>["auto",E,N],F=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],U=()=>["solid","dashed","dotted","double","none"],V=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],X=()=>["start","end","center","between","around","evenly","stretch"],Y=()=>["","0",N],K=()=>["auto","avoid","all","avoid-page","page","left","right","column"],H=()=>[E,N];return{cacheSize:500,separator:":",theme:{colors:[W],spacing:[I,B],blur:["none","",A,N],brightness:H(),borderColor:[e],borderRadius:["none","","full",A,N],borderSpacing:Z(),borderWidth:R(),contrast:H(),grayscale:Y(),hueRotate:H(),invert:Y(),gap:Z(),gradientColorStops:[e],gradientColorStopPositions:[T,B],inset:P(),margin:P(),opacity:H(),padding:Z(),saturate:H(),scale:H(),sepia:Y(),skew:H(),space:Z(),translate:Z()},classGroups:{aspect:[{aspect:["auto","square","video",N]}],container:["container"],columns:[{columns:[A]}],"break-after":[{"break-after":K()}],"break-before":[{"break-before":K()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...F(),N]}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",M,N]}],basis:[{basis:P()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",N]}],grow:[{grow:Y()}],shrink:[{shrink:Y()}],order:[{order:["first","last","none",M,N]}],"grid-cols":[{"grid-cols":[W]}],"col-start-end":[{col:["auto",{span:["full",M,N]},N]}],"col-start":[{"col-start":_()}],"col-end":[{"col-end":_()}],"grid-rows":[{"grid-rows":[W]}],"row-start-end":[{row:["auto",{span:[M,N]},N]}],"row-start":[{"row-start":_()}],"row-end":[{"row-end":_()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",N]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",N]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:["normal",...X()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...X(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...X(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[y]}],px:[{px:[y]}],py:[{py:[y]}],ps:[{ps:[y]}],pe:[{pe:[y]}],pt:[{pt:[y]}],pr:[{pr:[y]}],pb:[{pb:[y]}],pl:[{pl:[y]}],m:[{m:[m]}],mx:[{mx:[m]}],my:[{my:[m]}],ms:[{ms:[m]}],me:[{me:[m]}],mt:[{mt:[m]}],mr:[{mr:[m]}],mb:[{mb:[m]}],ml:[{ml:[m]}],"space-x":[{"space-x":[C]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[C]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",N,r]}],"min-w":[{"min-w":[N,r,"min","max","fit"]}],"max-w":[{"max-w":[N,r,"none","full","min","max","fit","prose",{screen:[A]},A]}],h:[{h:[N,r,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[N,r,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[N,r,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[N,r,"auto","min","max","fit"]}],"font-size":[{text:["base",A,B]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",G]}],"font-family":[{font:[W]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",N]}],"line-clamp":[{"line-clamp":["none",E,G]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",I,N]}],"list-image":[{"list-image":["none",N]}],"list-style-type":[{list:["none","disc","decimal",N]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[h]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[h]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...U(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",I,B]}],"underline-offset":[{"underline-offset":["auto",I,N]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:Z()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",N]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",N]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[h]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...F(),$]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",D]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},L]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[b]}],"gradient-via-pos":[{via:[b]}],"gradient-to-pos":[{to:[b]}],"gradient-from":[{from:[f]}],"gradient-via":[{via:[f]}],"gradient-to":[{to:[f]}],rounded:[{rounded:[l]}],"rounded-s":[{"rounded-s":[l]}],"rounded-e":[{"rounded-e":[l]}],"rounded-t":[{"rounded-t":[l]}],"rounded-r":[{"rounded-r":[l]}],"rounded-b":[{"rounded-b":[l]}],"rounded-l":[{"rounded-l":[l]}],"rounded-ss":[{"rounded-ss":[l]}],"rounded-se":[{"rounded-se":[l]}],"rounded-ee":[{"rounded-ee":[l]}],"rounded-es":[{"rounded-es":[l]}],"rounded-tl":[{"rounded-tl":[l]}],"rounded-tr":[{"rounded-tr":[l]}],"rounded-br":[{"rounded-br":[l]}],"rounded-bl":[{"rounded-bl":[l]}],"border-w":[{border:[i]}],"border-w-x":[{"border-x":[i]}],"border-w-y":[{"border-y":[i]}],"border-w-s":[{"border-s":[i]}],"border-w-e":[{"border-e":[i]}],"border-w-t":[{"border-t":[i]}],"border-w-r":[{"border-r":[i]}],"border-w-b":[{"border-b":[i]}],"border-w-l":[{"border-l":[i]}],"border-opacity":[{"border-opacity":[h]}],"border-style":[{border:[...U(),"hidden"]}],"divide-x":[{"divide-x":[i]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[i]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[h]}],"divide-style":[{divide:U()}],"border-color":[{border:[n]}],"border-color-x":[{"border-x":[n]}],"border-color-y":[{"border-y":[n]}],"border-color-s":[{"border-s":[n]}],"border-color-e":[{"border-e":[n]}],"border-color-t":[{"border-t":[n]}],"border-color-r":[{"border-r":[n]}],"border-color-b":[{"border-b":[n]}],"border-color-l":[{"border-l":[n]}],"divide-color":[{divide:[n]}],"outline-style":[{outline:["",...U()]}],"outline-offset":[{"outline-offset":[I,N]}],"outline-w":[{outline:[I,B]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:R()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[h]}],"ring-offset-w":[{"ring-offset":[I,B]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",A,q]}],"shadow-color":[{shadow:[W]}],opacity:[{opacity:[h]}],"mix-blend":[{"mix-blend":[...V(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":V()}],filter:[{filter:["","none"]}],blur:[{blur:[t]}],brightness:[{brightness:[o]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",A,N]}],grayscale:[{grayscale:[s]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[u]}],saturate:[{saturate:[v]}],sepia:[{sepia:[k]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[t]}],"backdrop-brightness":[{"backdrop-brightness":[o]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[s]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[u]}],"backdrop-opacity":[{"backdrop-opacity":[h]}],"backdrop-saturate":[{"backdrop-saturate":[v]}],"backdrop-sepia":[{"backdrop-sepia":[k]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",N]}],duration:[{duration:H()}],ease:[{ease:["linear","in","out","in-out",N]}],delay:[{delay:H()}],animate:[{animate:["none","spin","ping","pulse","bounce",N]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[x]}],"scale-x":[{"scale-x":[x]}],"scale-y":[{"scale-y":[x]}],rotate:[{rotate:[M,N]}],"translate-x":[{"translate-x":[S]}],"translate-y":[{"translate-y":[S]}],"skew-x":[{"skew-x":[z]}],"skew-y":[{"skew-y":[z]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",N]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",N]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":Z()}],"scroll-mx":[{"scroll-mx":Z()}],"scroll-my":[{"scroll-my":Z()}],"scroll-ms":[{"scroll-ms":Z()}],"scroll-me":[{"scroll-me":Z()}],"scroll-mt":[{"scroll-mt":Z()}],"scroll-mr":[{"scroll-mr":Z()}],"scroll-mb":[{"scroll-mb":Z()}],"scroll-ml":[{"scroll-ml":Z()}],"scroll-p":[{"scroll-p":Z()}],"scroll-px":[{"scroll-px":Z()}],"scroll-py":[{"scroll-py":Z()}],"scroll-ps":[{"scroll-ps":Z()}],"scroll-pe":[{"scroll-pe":Z()}],"scroll-pt":[{"scroll-pt":Z()}],"scroll-pr":[{"scroll-pr":Z()}],"scroll-pb":[{"scroll-pb":Z()}],"scroll-pl":[{"scroll-pl":Z()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",N]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[I,B,G]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},H=(e,r)=>{let{cacheSize:t,prefix:o,separator:n,experimentalParseClassName:l,extend:a={},override:i={}}=r;for(let r in J(e,"cacheSize",t),J(e,"prefix",o),J(e,"separator",n),J(e,"experimentalParseClassName",l),i)Q(e[r],i[r]);for(let r in a)ee(e[r],a[r]);return e},J=(e,r,t)=>{void 0!==t&&(e[r]=t)},Q=(e,r)=>{if(r)for(let t in r)J(e,t,r[t])},ee=(e,r)=>{if(r)for(let t in r){let o=r[t];void 0!==o&&(e[t]=(e[t]||[]).concat(o))}},er=function(e){for(var r=arguments.length,t=Array(r>1?r-1:0),o=1;oH(K(),e),...t)}({extend:{classGroups:{shadow:[{shadow:[{tremor:["input","card","dropdown"],"dark-tremor":["input","card","dropdown"]}]}],rounded:[{rounded:[{tremor:["small","default","full"],"dark-tremor":["small","default","full"]}]}],"font-size":[{text:[{tremor:["default","title","metric"],"dark-tremor":["default","title","metric"]}]}]}}})},1153:function(e,r,t){t.d(r,{Cj:function(){return i},bM:function(){return p},NZ:function(){return s},fn:function(){return u},Fo:function(){return a},lq:function(){return d},vP:function(){return c}});var o=t(7084);let n=["slate","gray","zinc","neutral","stone","red","orange","amber","yellow","lime","green","emerald","teal","cyan","sky","blue","indigo","violet","purple","fuchsia","pink","rose"],l=e=>n.includes(e),a=(e,r)=>{if(r||e===o.wu.Unchanged)return e;switch(e){case o.wu.Increase:return o.wu.Decrease;case o.wu.ModerateIncrease:return o.wu.ModerateDecrease;case o.wu.Decrease:return o.wu.Increase;case o.wu.ModerateDecrease:return o.wu.ModerateIncrease}return""},i=e=>e.toString(),c=e=>e.reduce((e,r)=>e+r,0),s=(e,r)=>{for(let t=0;t{e.forEach(e=>{"function"==typeof e?e(r):null!=e&&(e.current=r)})}}function u(e){return r=>"tremor-".concat(e,"-").concat(r)}function p(e,r){let t=l(e);if("white"===e||"black"===e||"transparent"===e||!r||!t){let r=e.includes("#")||e.includes("--")||e.includes("rgb")?"[".concat(e,"]"):e;return{bgColor:"bg-".concat(r," dark:bg-").concat(r),hoverBgColor:"hover:bg-".concat(r," dark:hover:bg-").concat(r),selectBgColor:"data-[selected]:bg-".concat(r," dark:data-[selected]:bg-").concat(r),textColor:"text-".concat(r," dark:text-").concat(r),selectTextColor:"data-[selected]:text-".concat(r," dark:data-[selected]:text-").concat(r),hoverTextColor:"hover:text-".concat(r," dark:hover:text-").concat(r),borderColor:"border-".concat(r," dark:border-").concat(r),selectBorderColor:"data-[selected]:border-".concat(r," dark:data-[selected]:border-").concat(r),hoverBorderColor:"hover:border-".concat(r," dark:hover:border-").concat(r),ringColor:"ring-".concat(r," dark:ring-").concat(r),strokeColor:"stroke-".concat(r," dark:stroke-").concat(r),fillColor:"fill-".concat(r," dark:fill-").concat(r)}}return{bgColor:"bg-".concat(e,"-").concat(r," dark:bg-").concat(e,"-").concat(r),selectBgColor:"data-[selected]:bg-".concat(e,"-").concat(r," dark:data-[selected]:bg-").concat(e,"-").concat(r),hoverBgColor:"hover:bg-".concat(e,"-").concat(r," dark:hover:bg-").concat(e,"-").concat(r),textColor:"text-".concat(e,"-").concat(r," dark:text-").concat(e,"-").concat(r),selectTextColor:"data-[selected]:text-".concat(e,"-").concat(r," dark:data-[selected]:text-").concat(e,"-").concat(r),hoverTextColor:"hover:text-".concat(e,"-").concat(r," dark:hover:text-").concat(e,"-").concat(r),borderColor:"border-".concat(e,"-").concat(r," dark:border-").concat(e,"-").concat(r),selectBorderColor:"data-[selected]:border-".concat(e,"-").concat(r," dark:data-[selected]:border-").concat(e,"-").concat(r),hoverBorderColor:"hover:border-".concat(e,"-").concat(r," dark:hover:border-").concat(e,"-").concat(r),ringColor:"ring-".concat(e,"-").concat(r," dark:ring-").concat(e,"-").concat(r),strokeColor:"stroke-".concat(e,"-").concat(r," dark:stroke-").concat(e,"-").concat(r),fillColor:"fill-".concat(e,"-").concat(r," dark:fill-").concat(e,"-").concat(r)}}},96240:function(e,r,t){t.d(r,{Z:function(){return o}});function o(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,o=Array(r);tr.indexOf(o)&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,o=Object.getOwnPropertySymbols(e);nr.indexOf(o[n])&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(t[o[n]]=e[o[n]]);return t}t.d(r,{_T:function(){return o}}),"function"==typeof SuppressedError&&SuppressedError}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/4865-c1c0885a93c327fa.js b/litellm/proxy/_experimental/out/_next/static/chunks/4865-c1c0885a93c327fa.js new file mode 100644 index 00000000000..e44ccb50a77 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/4865-c1c0885a93c327fa.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4865],{47187:function(e,t,n){n.d(t,{Z:function(){return J},l:function(){return H}});var r=n(2265),o=n.t(r,2),i=n(54887),u=n(94046),l=n(51050),c="undefined"!=typeof document?r.useLayoutEffect:r.useEffect;function f(e,t){let n,r,o;if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if((n=e.length)!=t.length)return!1;for(r=n;0!=r--;)if(!f(e[r],t[r]))return!1;return!0}if((n=(o=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!Object.prototype.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!=r--;){let n=o[r];if(("_owner"!==n||!e.$$typeof)&&!f(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function s(e){let t=r.useRef(e);return c(()=>{t.current=e}),t}var a="undefined"!=typeof document?r.useLayoutEffect:r.useEffect;let d=!1,p=0,m=()=>"floating-ui-"+p++,h=o["useId".toString()]||function(){let[e,t]=r.useState(()=>d?m():void 0);return a(()=>{null==e&&t(m())},[]),r.useEffect(()=>{d||(d=!0)},[]),e},g=r.createContext(null),v=r.createContext(null),y=()=>{var e;return(null==(e=r.useContext(g))?void 0:e.id)||null},w=()=>r.useContext(v);function x(e){return(null==e?void 0:e.ownerDocument)||document}function b(e){return x(e).defaultView||window}function R(e){return!!e&&e instanceof b(e).Element}function E(e){return!!e&&e instanceof b(e).HTMLElement}function k(e,t){let n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function L(e){let t=(0,r.useRef)(e);return a(()=>{t.current=e}),t}let T="data-floating-ui-safe-polygon";function C(e,t,n){return n&&!k(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}let P=function(e,t){let{enabled:n=!0,delay:o=0,handleClose:i=null,mouseOnly:u=!1,restMs:l=0,move:c=!0}=void 0===t?{}:t,{open:f,onOpenChange:s,dataRef:d,events:p,elements:{domReference:m,floating:h},refs:g}=e,v=w(),b=y(),E=L(i),P=L(o),F=r.useRef(),S=r.useRef(),D=r.useRef(),M=r.useRef(),A=r.useRef(!0),O=r.useRef(!1),K=r.useRef(()=>{}),B=r.useCallback(()=>{var e;let t=null==(e=d.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t},[d]);r.useEffect(()=>{if(n)return p.on("dismiss",e),()=>{p.off("dismiss",e)};function e(){clearTimeout(S.current),clearTimeout(M.current),A.current=!0}},[n,p]),r.useEffect(()=>{if(!n||!E.current||!f)return;function e(){B()&&s(!1)}let t=x(h).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}},[h,f,s,n,E,d,B]);let V=r.useCallback(function(e){void 0===e&&(e=!0);let t=C(P.current,"close",F.current);t&&!D.current?(clearTimeout(S.current),S.current=setTimeout(()=>s(!1),t)):e&&(clearTimeout(S.current),s(!1))},[P,s]),W=r.useCallback(()=>{K.current(),D.current=void 0},[]),N=r.useCallback(()=>{if(O.current){let e=x(g.floating.current).body;e.style.pointerEvents="",e.removeAttribute(T),O.current=!1}},[g]);return r.useEffect(()=>{if(n&&R(m))return f&&m.addEventListener("mouseleave",i),null==h||h.addEventListener("mouseleave",i),c&&m.addEventListener("mousemove",r,{once:!0}),m.addEventListener("mouseenter",r),m.addEventListener("mouseleave",o),()=>{f&&m.removeEventListener("mouseleave",i),null==h||h.removeEventListener("mouseleave",i),c&&m.removeEventListener("mousemove",r),m.removeEventListener("mouseenter",r),m.removeEventListener("mouseleave",o)};function t(){return!!d.current.openEvent&&["click","mousedown"].includes(d.current.openEvent.type)}function r(e){if(clearTimeout(S.current),A.current=!1,u&&!k(F.current)||l>0&&0===C(P.current,"open"))return;d.current.openEvent=e;let t=C(P.current,"open",F.current);t?S.current=setTimeout(()=>{s(!0)},t):s(!0)}function o(n){if(t())return;K.current();let r=x(h);if(clearTimeout(M.current),E.current){f||clearTimeout(S.current),D.current=E.current({...e,tree:v,x:n.clientX,y:n.clientY,onClose(){N(),W(),V()}});let t=D.current;r.addEventListener("mousemove",t),K.current=()=>{r.removeEventListener("mousemove",t)};return}V()}function i(n){t()||null==E.current||E.current({...e,tree:v,x:n.clientX,y:n.clientY,onClose(){N(),W(),V()}})(n)}},[m,h,n,e,u,l,c,V,W,N,s,f,v,P,E,d]),a(()=>{var e,t,r;if(n&&f&&null!=(e=E.current)&&e.__options.blockPointerEvents&&B()){let e=x(h).body;if(e.setAttribute(T,""),e.style.pointerEvents="none",O.current=!0,R(m)&&h){let e=null==v?void 0:null==(t=v.nodesRef.current.find(e=>e.id===b))?void 0:null==(r=t.context)?void 0:r.elements.floating;return e&&(e.style.pointerEvents=""),m.style.pointerEvents="auto",h.style.pointerEvents="auto",()=>{m.style.pointerEvents="",h.style.pointerEvents=""}}}},[n,f,b,h,m,v,E,d,B]),a(()=>{f||(F.current=void 0,W(),N())},[f,W,N]),r.useEffect(()=>()=>{W(),clearTimeout(S.current),clearTimeout(M.current),N()},[n,W,N]),r.useMemo(()=>{if(!n)return{};function e(e){F.current=e.pointerType}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove(){f||0===l||(clearTimeout(M.current),M.current=setTimeout(()=>{A.current||s(!0)},l))}},floating:{onMouseEnter(){clearTimeout(S.current)},onMouseLeave(){p.emit("dismiss",{type:"mouseLeave",data:{returnFocus:!1}}),V(!1)}}}},[p,n,l,f,s,V])};function F(e,t){if(!e||!t)return!1;let n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&function(e){if("undefined"==typeof ShadowRoot)return!1;let t=b(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}(n)){let n=t;do{if(n&&e===n)return!0;n=n.parentNode||n.host}while(n)}return!1}function S(e,t){let n=e.filter(e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)})||[],r=n;for(;r.length;)r=e.filter(e=>{var t;return null==(t=r)?void 0:t.some(t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)})})||[],n=n.concat(r);return n}let D=o["useInsertionEffect".toString()]||(e=>e());function M(e){let t=r.useRef(()=>{});return D(()=>{t.current=e}),r.useCallback(function(){for(var e=arguments.length,n=Array(e),r=0;r!1),P="function"==typeof m?C:m,F=r.useRef(!1),{escapeKeyBubbles:D,outsidePressBubbles:V}=B(k);return r.useEffect(()=>{if(!n||!d)return;function e(e){if("Escape"===e.key){let e=L?S(L.nodesRef.current,l):[];if(e.length>0){let t=!0;if(e.forEach(e=>{var n;if(null!=(n=e.context)&&n.open&&!e.context.dataRef.current.__escapeKeyBubbles){t=!1;return}}),!t)return}i.emit("dismiss",{type:"escapeKey",data:{returnFocus:{preventScroll:!1}}}),o(!1)}}function t(e){var t;let n=F.current;if(F.current=!1,n||"function"==typeof P&&!P(e))return;let r="composedPath"in e?e.composedPath()[0]:e.target;if(E(r)&&s){let t=s.ownerDocument.defaultView||window,n=r.scrollWidth>r.clientWidth,o=r.scrollHeight>r.clientHeight,i=o&&e.offsetX>r.clientWidth;if(o&&"rtl"===t.getComputedStyle(r).direction&&(i=e.offsetX<=r.offsetWidth-r.clientWidth),i||n&&e.offsetY>r.clientHeight)return}let u=L&&S(L.nodesRef.current,l).some(t=>{var n;return A(e,null==(n=t.context)?void 0:n.elements.floating)});if(A(e,s)||A(e,f)||u)return;let c=L?S(L.nodesRef.current,l):[];if(c.length>0){let e=!0;if(c.forEach(t=>{var n;if(null!=(n=t.context)&&n.open&&!t.context.dataRef.current.__outsidePressBubbles){e=!1;return}}),!e)return}i.emit("dismiss",{type:"outsidePress",data:{returnFocus:T?{preventScroll:!0}:function(e){if(0===e.mozInputSource&&e.isTrusted)return!0;let t=/Android/i;return(t.test(function(){let e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}())||t.test(function(){let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(e=>{let{brand:t,version:n}=e;return t+"/"+n}).join(" "):navigator.userAgent}()))&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType}(e)||0===(t=e).width&&0===t.height||1===t.width&&1===t.height&&0===t.pressure&&0===t.detail&&"mouse"!==t.pointerType||t.width<1&&t.height<1&&0===t.pressure&&0===t.detail}}),o(!1)}function r(){o(!1)}a.current.__escapeKeyBubbles=D,a.current.__outsidePressBubbles=V;let m=x(s);p&&m.addEventListener("keydown",e),P&&m.addEventListener(h,t);let g=[];return b&&(R(f)&&(g=(0,u.Kx)(f)),R(s)&&(g=g.concat((0,u.Kx)(s))),!R(c)&&c&&c.contextElement&&(g=g.concat((0,u.Kx)(c.contextElement)))),(g=g.filter(e=>{var t;return e!==(null==(t=m.defaultView)?void 0:t.visualViewport)})).forEach(e=>{e.addEventListener("scroll",r,{passive:!0})}),()=>{p&&m.removeEventListener("keydown",e),P&&m.removeEventListener(h,t),g.forEach(e=>{e.removeEventListener("scroll",r)})}},[a,s,f,c,p,P,h,i,L,l,n,o,b,d,D,V,T]),r.useEffect(()=>{F.current=!1},[P,h]),r.useMemo(()=>d?{reference:{[O[v]]:()=>{g&&(i.emit("dismiss",{type:"referencePress",data:{returnFocus:!1}}),o(!1))}},floating:{[K[h]]:()=>{F.current=!0}}}:{},[d,i,g,h,v,o])},W=function(e,t){let{open:n,onOpenChange:o,dataRef:i,events:u,refs:l,elements:{floating:c,domReference:f}}=e,{enabled:s=!0,keyboardOnly:a=!0}=void 0===t?{}:t,d=r.useRef(""),p=r.useRef(!1),m=r.useRef();return r.useEffect(()=>{if(!s)return;let e=x(c).defaultView||window;function t(){!n&&E(f)&&f===function(e){let t=e.activeElement;for(;(null==(n=t)?void 0:null==(r=n.shadowRoot)?void 0:r.activeElement)!=null;){var n,r;t=t.shadowRoot.activeElement}return t}(x(f))&&(p.current=!0)}return e.addEventListener("blur",t),()=>{e.removeEventListener("blur",t)}},[c,f,n,s]),r.useEffect(()=>{if(s)return u.on("dismiss",e),()=>{u.off("dismiss",e)};function e(e){("referencePress"===e.type||"escapeKey"===e.type)&&(p.current=!0)}},[u,s]),r.useEffect(()=>()=>{clearTimeout(m.current)},[]),r.useMemo(()=>s?{reference:{onPointerDown(e){let{pointerType:t}=e;d.current=t,p.current=!!(t&&a)},onMouseLeave(){p.current=!1},onFocus(e){var t;p.current||"focus"===e.type&&(null==(t=i.current.openEvent)?void 0:t.type)==="mousedown"&&i.current.openEvent&&A(i.current.openEvent,f)||(i.current.openEvent=e.nativeEvent,o(!0))},onBlur(e){p.current=!1;let t=e.relatedTarget,n=R(t)&&t.hasAttribute("data-floating-ui-focus-guard")&&"outside"===t.getAttribute("data-type");m.current=setTimeout(()=>{F(l.floating.current,t)||F(f,t)||n||o(!1)})}}}:{},[s,a,f,l,i,o])},N=function(e,t){let{open:n}=e,{enabled:o=!0,role:i="dialog"}=void 0===t?{}:t,u=h(),l=h();return r.useMemo(()=>{let e={id:u,role:i};return o?"tooltip"===i?{reference:{"aria-describedby":n?u:void 0},floating:e}:{reference:{"aria-expanded":n?"true":"false","aria-haspopup":"alertdialog"===i?"dialog":i,"aria-controls":n?u:void 0,..."listbox"===i&&{role:"combobox"},..."menu"===i&&{id:l}},floating:{...e,..."menu"===i&&{"aria-labelledby":l}}}:{}},[o,i,n,u,l])};function z(e,t,n){let r=new Map;return{..."floating"===n&&{tabIndex:-1},...e,...t.map(e=>e?e[n]:null).concat(e).reduce((e,t)=>(t&&Object.entries(t).forEach(t=>{let[n,o]=t;if(0===n.indexOf("on")){if(r.has(n)||r.set(n,[]),"function"==typeof o){var i;null==(i=r.get(n))||i.push(o),e[n]=function(){for(var e,t=arguments.length,o=Array(t),i=0;ie(...o))}}}else e[n]=o}),e),{})}}let j=function(e){void 0===e&&(e=[]);let t=e,n=r.useCallback(t=>z(t,e,"reference"),t),o=r.useCallback(t=>z(t,e,"floating"),t),i=r.useCallback(t=>z(t,e,"item"),e.map(e=>null==e?void 0:e.item));return r.useMemo(()=>({getReferenceProps:n,getFloatingProps:o,getItemProps:i}),[n,o,i])};var _=n(13241);let H=e=>{let[t,n]=(0,r.useState)(!1),[o,u]=(0,r.useState)(),{x:d,y:p,refs:m,strategy:h,context:g}=function(e){void 0===e&&(e={});let{open:t=!1,onOpenChange:n,nodeId:o}=e,u=function(e){void 0===e&&(e={});let{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:u,whileElementsMounted:a,open:d}=e,[p,m]=r.useState({x:null,y:null,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,g]=r.useState(o);f(h,o)||g(o);let v=r.useRef(null),y=r.useRef(null),w=r.useRef(p),x=s(a),b=s(u),[R,E]=r.useState(null),[k,L]=r.useState(null),T=r.useCallback(e=>{v.current!==e&&(v.current=e,E(e))},[]),C=r.useCallback(e=>{y.current!==e&&(y.current=e,L(e))},[]),P=r.useCallback(()=>{if(!v.current||!y.current)return;let e={placement:t,strategy:n,middleware:h};b.current&&(e.platform=b.current),(0,l.oo)(v.current,y.current,e).then(e=>{let t={...e,isPositioned:!0};F.current&&!f(w.current,t)&&(w.current=t,i.flushSync(()=>{m(t)}))})},[h,t,n,b]);c(()=>{!1===d&&w.current.isPositioned&&(w.current.isPositioned=!1,m(e=>({...e,isPositioned:!1})))},[d]);let F=r.useRef(!1);c(()=>(F.current=!0,()=>{F.current=!1}),[]),c(()=>{if(R&&k){if(x.current)return x.current(R,k,P);P()}},[R,k,P,x]);let S=r.useMemo(()=>({reference:v,floating:y,setReference:T,setFloating:C}),[T,C]),D=r.useMemo(()=>({reference:R,floating:k}),[R,k]);return r.useMemo(()=>({...p,update:P,refs:S,elements:D,reference:T,floating:C}),[p,P,S,D,T,C])}(e),d=w(),p=r.useRef(null),m=r.useRef({}),h=r.useState(()=>(function(){let e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach(e=>e(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){e.set(t,(e.get(t)||[]).filter(e=>e!==n))}}})())[0],[g,v]=r.useState(null),y=r.useCallback(e=>{let t=R(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;u.refs.setReference(t)},[u.refs]),x=r.useCallback(e=>{(R(e)||null===e)&&(p.current=e,v(e)),(R(u.refs.reference.current)||null===u.refs.reference.current||null!==e&&!R(e))&&u.refs.setReference(e)},[u.refs]),b=r.useMemo(()=>({...u.refs,setReference:x,setPositionReference:y,domReference:p}),[u.refs,x,y]),E=r.useMemo(()=>({...u.elements,domReference:g}),[u.elements,g]),k=M(n),L=r.useMemo(()=>({...u,refs:b,elements:E,dataRef:m,nodeId:o,events:h,open:t,onOpenChange:k}),[u,o,h,t,k,b,E]);return a(()=>{let e=null==d?void 0:d.nodesRef.current.find(e=>e.id===o);e&&(e.context=L)}),r.useMemo(()=>({...u,context:L,refs:b,reference:x,positionReference:y}),[u,b,L,x,y])}({open:t,onOpenChange:t=>{t&&e?u(setTimeout(()=>{n(t)},e)):(clearTimeout(o),n(t))},placement:"top",whileElementsMounted:l.Me,middleware:[(0,l.cv)(5),(0,l.RR)({fallbackAxisSideDirection:"start"}),(0,l.uY)()]}),v=P(g,{move:!1}),{getReferenceProps:y,getFloatingProps:x}=j([v,W(g),V(g),N(g,{role:"tooltip"})]);return{tooltipProps:{open:t,x:d,y:p,refs:m,strategy:h,getFloatingProps:x},getReferenceProps:y}},J=e=>{let{text:t,open:n,x:o,y:i,refs:u,strategy:l,getFloatingProps:c}=e;return n&&t?r.createElement("div",Object.assign({className:(0,_.q)("max-w-xs text-sm z-20 rounded-tremor-default opacity-100 px-2.5 py-1","text-white bg-tremor-background-emphasis","dark:text-tremor-content-emphasis dark:bg-white"),ref:u.setFloating,style:{position:l,top:null!=i?i:0,left:null!=o?o:0}},c()),t):null};J.displayName="Tooltip"},26898:function(e,t,n){n.d(t,{K:function(){return o},s:function(){return i}});var r=n(7084);let o={canvasBackground:50,lightBackground:100,background:500,darkBackground:600,darkestBackground:800,lightBorder:200,border:500,darkBorder:700,lightRing:200,ring:300,iconRing:500,lightText:400,text:500,iconText:600,darkText:700,darkestText:900,icon:500},i=[r.fr.Blue,r.fr.Cyan,r.fr.Sky,r.fr.Indigo,r.fr.Violet,r.fr.Purple,r.fr.Fuchsia,r.fr.Slate,r.fr.Gray,r.fr.Zinc,r.fr.Neutral,r.fr.Stone,r.fr.Red,r.fr.Orange,r.fr.Amber,r.fr.Yellow,r.fr.Lime,r.fr.Green,r.fr.Emerald,r.fr.Teal,r.fr.Pink,r.fr.Rose]},51050:function(e,t,n){n.d(t,{Me:function(){return T},oo:function(){return M},US:function(){return C},RR:function(){return S},cv:function(){return P},uY:function(){return F},dp:function(){return D}});var r=n(72695);function o(e,t,n){let o,{reference:i,floating:u}=e,l=(0,r.Qq)(t),c=(0,r.Wh)(t),f=(0,r.I4)(c),s=(0,r.k3)(t),a="y"===l,d=i.x+i.width/2-u.width/2,p=i.y+i.height/2-u.height/2,m=i[f]/2-u[f]/2;switch(s){case"top":o={x:d,y:i.y-u.height};break;case"bottom":o={x:d,y:i.y+i.height};break;case"right":o={x:i.x+i.width,y:p};break;case"left":o={x:i.x-u.width,y:p};break;default:o={x:i.x,y:i.y}}switch((0,r.hp)(t)){case"start":o[c]-=m*(n&&a?-1:1);break;case"end":o[c]+=m*(n&&a?-1:1)}return o}let i=async(e,t,n)=>{let{placement:r="bottom",strategy:i="absolute",middleware:u=[],platform:l}=n,c=u.filter(Boolean),f=await (null==l.isRTL?void 0:l.isRTL(t)),s=await l.getElementRects({reference:e,floating:t,strategy:i}),{x:a,y:d}=o(s,r,f),p=r,m={},h=0;for(let n=0;n(0,f.kK)(e)&&"body"!==(0,f.wk)(e)),o=null,i="fixed"===(0,f.Dx)(e).position,u=i?(0,f.Ow)(e):e;for(;(0,f.kK)(u)&&!(0,f.Py)(u);){let t=(0,f.Dx)(u),n=(0,f.hT)(u);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&!!o&&y.has(o.position)||(0,f.ao)(u)&&!n&&function e(t,n){let r=(0,f.Ow)(t);return!(r===n||!(0,f.kK)(r)||(0,f.Py)(r))&&("fixed"===(0,f.Dx)(r).position||e(r,n))}(e,u))?r=r.filter(e=>e!==u):o=t,u=(0,f.Ow)(u)}return t.set(e,r),r}(t,this._c):[].concat(n),o],l=u[0],c=u.reduce((e,n)=>{let o=w(t,n,i);return e.top=(0,r.Fp)(o.top,e.top),e.right=(0,r.VV)(o.right,e.right),e.bottom=(0,r.VV)(o.bottom,e.bottom),e.left=(0,r.Fp)(o.left,e.left),e},w(t,l,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},getOffsetParent:R,getElementRects:E,getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){let{width:t,height:n}=s(e);return{width:t,height:n}},getScale:d,isElement:f.kK,isRTL:function(e){return"rtl"===(0,f.Dx)(e).direction}};function L(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function T(e,t,n,o){let i;void 0===o&&(o={});let{ancestorScroll:u=!0,ancestorResize:l=!0,elementResize:c="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:d=!1}=o,p=a(e),m=u||l?[...p?(0,f.Kx)(p):[],...(0,f.Kx)(t)]:[];m.forEach(e=>{u&&e.addEventListener("scroll",n,{passive:!0}),l&&e.addEventListener("resize",n)});let g=p&&s?function(e,t){let n,o=null,i=(0,f.tF)(e);function u(){var e;clearTimeout(n),null==(e=o)||e.disconnect(),o=null}return!function l(c,f){void 0===c&&(c=!1),void 0===f&&(f=1),u();let s=e.getBoundingClientRect(),{left:a,top:d,width:p,height:m}=s;if(c||t(),!p||!m)return;let h=(0,r.GW)(d),g=(0,r.GW)(i.clientWidth-(a+p)),v={rootMargin:-h+"px "+-g+"px "+-(0,r.GW)(i.clientHeight-(d+m))+"px "+-(0,r.GW)(a)+"px",threshold:(0,r.Fp)(0,(0,r.VV)(1,f))||1},y=!0;function w(t){let r=t[0].intersectionRatio;if(r!==f){if(!y)return l();r?l(!1,r):n=setTimeout(()=>{l(!1,1e-7)},1e3)}1!==r||L(s,e.getBoundingClientRect())||l(),y=!1}try{o=new IntersectionObserver(w,{...v,root:i.ownerDocument})}catch(e){o=new IntersectionObserver(w,v)}o.observe(e)}(!0),u}(p,n):null,v=-1,y=null;c&&(y=new ResizeObserver(e=>{let[r]=e;r&&r.target===p&&y&&(y.unobserve(t),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var e;null==(e=y)||e.observe(t)})),n()}),p&&!d&&y.observe(p),y.observe(t));let w=d?h(e):null;return d&&function t(){let r=h(e);w&&!L(w,r)&&n(),w=r,i=requestAnimationFrame(t)}(),n(),()=>{var e;m.forEach(e=>{u&&e.removeEventListener("scroll",n),l&&e.removeEventListener("resize",n)}),null==g||g(),null==(e=y)||e.disconnect(),y=null,d&&cancelAnimationFrame(i)}}let C=u,P=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;let{x:o,y:i,placement:u,middlewareData:l}=t,f=await c(t,e);return u===(null==(n=l.offset)?void 0:n.placement)&&null!=(r=l.arrow)&&r.alignmentOffset?{}:{x:o+f.x,y:i+f.y,data:{...f,placement:u}}}}},F=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){let{x:n,y:o,placement:i}=t,{mainAxis:l=!0,crossAxis:c=!1,limiter:f={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...s}=(0,r.ku)(e,t),a={x:n,y:o},d=await u(t,s),p=(0,r.Qq)((0,r.k3)(i)),m=(0,r.Rn)(p),h=a[m],g=a[p];if(l){let e="y"===m?"top":"left",t="y"===m?"bottom":"right",n=h+d[e],o=h-d[t];h=(0,r.uZ)(n,h,o)}if(c){let e="y"===p?"top":"left",t="y"===p?"bottom":"right",n=g+d[e],o=g-d[t];g=(0,r.uZ)(n,g,o)}let v=f.fn({...t,[m]:h,[p]:g});return{...v,data:{x:v.x-n,y:v.y-o,enabled:{[m]:l,[p]:c}}}}}},S=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,o,i,l,c;let{placement:f,middlewareData:s,rects:a,initialPlacement:d,platform:p,elements:m}=t,{mainAxis:h=!0,crossAxis:g=!0,fallbackPlacements:v,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:x=!0,...b}=(0,r.ku)(e,t);if(null!=(n=s.arrow)&&n.alignmentOffset)return{};let R=(0,r.k3)(f),E=(0,r.Qq)(d),k=(0,r.k3)(d)===d,L=await (null==p.isRTL?void 0:p.isRTL(m.floating)),T=v||(k||!x?[(0,r.pw)(d)]:(0,r.gy)(d)),C="none"!==w;!v&&C&&T.push(...(0,r.KX)(d,x,w,L));let P=[d,...T],F=await u(t,b),S=[],D=(null==(o=s.flip)?void 0:o.overflows)||[];if(h&&S.push(F[R]),g){let e=(0,r.i8)(f,a,L);S.push(F[e[0]],F[e[1]])}if(D=[...D,{placement:f,overflows:S}],!S.every(e=>e<=0)){let e=((null==(i=s.flip)?void 0:i.index)||0)+1,t=P[e];if(t&&(!("alignment"===g&&E!==(0,r.Qq)(t))||D.every(e=>(0,r.Qq)(e.placement)!==E||e.overflows[0]>0)))return{data:{index:e,overflows:D},reset:{placement:t}};let n=null==(l=D.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:l.placement;if(!n)switch(y){case"bestFit":{let e=null==(c=D.filter(e=>{if(C){let t=(0,r.Qq)(e.placement);return t===E||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:c[0];e&&(n=e);break}case"initialPlacement":n=d}if(f!==n)return{reset:{placement:n}}}return{}}}},D=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,o;let i,l;let{placement:c,rects:f,platform:s,elements:a}=t,{apply:d=()=>{},...p}=(0,r.ku)(e,t),m=await u(t,p),h=(0,r.k3)(c),g=(0,r.hp)(c),v="y"===(0,r.Qq)(c),{width:y,height:w}=f.floating;"top"===h||"bottom"===h?(i=h,l=g===(await (null==s.isRTL?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(l=h,i="end"===g?"top":"bottom");let x=w-m.top-m.bottom,b=y-m.left-m.right,R=(0,r.VV)(w-m[i],x),E=(0,r.VV)(y-m[l],b),k=!t.middlewareData.shift,L=R,T=E;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(T=b),null!=(o=t.middlewareData.shift)&&o.enabled.y&&(L=x),k&&!g){let e=(0,r.Fp)(m.left,0),t=(0,r.Fp)(m.right,0),n=(0,r.Fp)(m.top,0),o=(0,r.Fp)(m.bottom,0);v?T=y-2*(0!==e||0!==t?e+t:(0,r.Fp)(m.left,m.right)):L=w-2*(0!==n||0!==o?n+o:(0,r.Fp)(m.top,m.bottom))}await d({...t,availableWidth:T,availableHeight:L});let C=await s.getDimensions(a.floating);return y!==C.width||w!==C.height?{reset:{rects:!0}}:{}}}},M=(e,t,n)=>{let r=new Map,o={platform:k,...n},u={...o.platform,_c:r};return i(e,t,{...o,platform:u})}},94046:function(e,t,n){function r(){return"undefined"!=typeof window}function o(e){return l(e)?(e.nodeName||"").toLowerCase():"#document"}function i(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function u(e){var t;return null==(t=(l(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function l(e){return!!r()&&(e instanceof Node||e instanceof i(e).Node)}function c(e){return!!r()&&(e instanceof Element||e instanceof i(e).Element)}function f(e){return!!r()&&(e instanceof HTMLElement||e instanceof i(e).HTMLElement)}function s(e){return!!r()&&"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof i(e).ShadowRoot)}n.d(t,{Dx:function(){return L},Jj:function(){return i},Kx:function(){return function e(t,n,r){var o;void 0===n&&(n=[]),void 0===r&&(r=!0);let u=function e(t){let n=C(t);return k(n)?t.ownerDocument?t.ownerDocument.body:t.body:f(n)&&d(n)?n:e(n)}(t),l=u===(null==(o=t.ownerDocument)?void 0:o.body),c=i(u);if(l){let t=P(c);return n.concat(c,c.visualViewport||[],d(u)?u:[],t&&r?e(t):[])}return n.concat(u,e(u,[],r))}},Lw:function(){return T},Ow:function(){return C},Pf:function(){return R},Py:function(){return k},Re:function(){return f},Ze:function(){return m},ao:function(){return d},gQ:function(){return b},hT:function(){return x},kK:function(){return c},tF:function(){return u},tR:function(){return g},wK:function(){return P},wk:function(){return o}});let a=new Set(["inline","contents"]);function d(e){let{overflow:t,overflowX:n,overflowY:r,display:o}=L(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!a.has(o)}let p=new Set(["table","td","th"]);function m(e){return p.has(o(e))}let h=[":popover-open",":modal"];function g(e){return h.some(t=>{try{return e.matches(t)}catch(e){return!1}})}let v=["transform","translate","scale","rotate","perspective"],y=["transform","translate","scale","rotate","perspective","filter"],w=["paint","layout","strict","content"];function x(e){let t=R(),n=c(e)?L(e):e;return v.some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||y.some(e=>(n.willChange||"").includes(e))||w.some(e=>(n.contain||"").includes(e))}function b(e){let t=C(e);for(;f(t)&&!k(t);){if(x(t))return t;if(g(t))break;t=C(t)}return null}function R(){return"undefined"!=typeof CSS&&!!CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")}let E=new Set(["html","body","#document"]);function k(e){return E.has(o(e))}function L(e){return i(e).getComputedStyle(e)}function T(e){return c(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function C(e){if("html"===o(e))return e;let t=e.assignedSlot||e.parentNode||s(e)&&e.host||u(e);return s(t)?t.host:t}function P(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}},72695:function(e,t,n){n.d(t,{Fp:function(){return o},GW:function(){return u},I4:function(){return h},JB:function(){return F},KX:function(){return T},NM:function(){return i},Qq:function(){return v},Rn:function(){return m},VV:function(){return r},Wh:function(){return y},gy:function(){return x},hp:function(){return p},i8:function(){return w},k3:function(){return d},ku:function(){return a},pw:function(){return C},uZ:function(){return s},yd:function(){return P},ze:function(){return l}});let r=Math.min,o=Math.max,i=Math.round,u=Math.floor,l=e=>({x:e,y:e}),c={left:"right",right:"left",bottom:"top",top:"bottom"},f={start:"end",end:"start"};function s(e,t,n){return o(e,r(t,n))}function a(e,t){return"function"==typeof e?e(t):e}function d(e){return e.split("-")[0]}function p(e){return e.split("-")[1]}function m(e){return"x"===e?"y":"x"}function h(e){return"y"===e?"height":"width"}let g=new Set(["top","bottom"]);function v(e){return g.has(d(e))?"y":"x"}function y(e){return m(v(e))}function w(e,t,n){void 0===n&&(n=!1);let r=p(e),o=y(e),i=h(o),u="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(u=C(u)),[u,C(u)]}function x(e){let t=C(e);return[b(e),t,b(t)]}function b(e){return e.replace(/start|end/g,e=>f[e])}let R=["left","right"],E=["right","left"],k=["top","bottom"],L=["bottom","top"];function T(e,t,n,r){let o=p(e),i=function(e,t,n){switch(e){case"top":case"bottom":if(n)return t?E:R;return t?R:E;case"left":case"right":return t?k:L;default:return[]}}(d(e),"start"===n,r);return o&&(i=i.map(e=>e+"-"+o),t&&(i=i.concat(i.map(b)))),i}function C(e){return e.replace(/left|right|bottom|top/g,e=>c[e])}function P(e){return"number"!=typeof e?{top:0,right:0,bottom:0,left:0,...e}:{top:e,right:e,bottom:e,left:e}}function F(e){let{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/5096-d9222b69b30b3d56.js b/litellm/proxy/_experimental/out/_next/static/chunks/5096-d9222b69b30b3d56.js deleted file mode 100644 index 5ccce756f56..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/5096-d9222b69b30b3d56.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5096,1623],{30150:function(e,t,r){r.d(t,{Z:function(){return h}});var n=r(5853),s=r(2265);let a=e=>{var t=(0,n._T)(e,[]);return s.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),s.createElement("path",{d:"M12 4v16m8-8H4"}))},i=e=>{var t=(0,n._T)(e,[]);return s.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),s.createElement("path",{d:"M20 12H4"}))};var o=r(13241),u=r(1153),l=r(69262);let c="flex mx-auto text-tremor-content-subtle dark:text-dark-tremor-content-subtle",d="cursor-pointer hover:text-tremor-content dark:hover:text-dark-tremor-content",h=s.forwardRef((e,t)=>{let{onSubmit:r,enableStepper:h=!0,disabled:p,onValueChange:f,onChange:m}=e,y=(0,n._T)(e,["onSubmit","enableStepper","disabled","onValueChange","onChange"]),g=(0,s.useRef)(null),[b,v]=s.useState(!1),w=s.useCallback(()=>{v(!0)},[]),x=s.useCallback(()=>{v(!1)},[]),[E,C]=s.useState(!1),k=s.useCallback(()=>{C(!0)},[]),P=s.useCallback(()=>{C(!1)},[]);return s.createElement(l.Z,Object.assign({type:"number",ref:(0,u.lq)([g,t]),disabled:p,makeInputClassName:(0,u.fn)("NumberInput"),onKeyDown:e=>{var t;if("Enter"===e.key&&!e.ctrlKey&&!e.altKey&&!e.shiftKey){let e=null===(t=g.current)||void 0===t?void 0:t.value;null==r||r(parseFloat(null!=e?e:""))}"ArrowDown"===e.key&&w(),"ArrowUp"===e.key&&k()},onKeyUp:e=>{"ArrowDown"===e.key&&x(),"ArrowUp"===e.key&&P()},onChange:e=>{p||(null==f||f(parseFloat(e.target.value)),null==m||m(e))},stepper:h?s.createElement("div",{className:(0,o.q)("flex justify-center align-middle")},s.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;p||(null===(e=g.current)||void 0===e||e.stepDown(),null===(t=g.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,o.q)(!p&&d,c,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},s.createElement(i,{"data-testid":"step-down",className:(b?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"})),s.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;p||(null===(e=g.current)||void 0===e||e.stepUp(),null===(t=g.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,o.q)(!p&&d,c,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},s.createElement(a,{"data-testid":"step-up",className:(E?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"}))):null},y))});h.displayName="NumberInput"},16853:function(e,t,r){r.d(t,{Z:function(){return c}});var n=r(5853),s=r(96398),a=r(44140),i=r(2265),o=r(13241),u=r(1153);let l=(0,u.fn)("Textarea"),c=i.forwardRef((e,t)=>{let{value:r,defaultValue:c="",placeholder:d="Type...",error:h=!1,errorMessage:p,disabled:f=!1,className:m,onChange:y,onValueChange:g,autoHeight:b=!1}=e,v=(0,n._T)(e,["value","defaultValue","placeholder","error","errorMessage","disabled","className","onChange","onValueChange","autoHeight"]),[w,x]=(0,a.Z)(c,r),E=(0,i.useRef)(null),C=(0,s.Uh)(w);return(0,i.useEffect)(()=>{let e=E.current;if(b&&e){e.style.height="60px";let t=e.scrollHeight;e.style.height=t+"px"}},[b,E,w]),i.createElement(i.Fragment,null,i.createElement("textarea",Object.assign({ref:(0,u.lq)([E,t]),value:w,placeholder:d,disabled:f,className:(0,o.q)(l("Textarea"),"w-full flex items-center outline-none rounded-tremor-default px-3 py-2 text-tremor-default focus:ring-2 transition duration-100 border","shadow-tremor-input focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:shadow-dark-tremor-input focus:dark:border-dark-tremor-brand-subtle focus:dark:ring-dark-tremor-brand-muted",(0,s.um)(C,f,h),f?"placeholder:text-tremor-content-subtle dark:placeholder:text-dark-tremor-content-subtle":"placeholder:text-tremor-content dark:placeholder:text-dark-tremor-content",m),"data-testid":"text-area",onChange:e=>{null==y||y(e),x(e.target.value),null==g||g(e.target.value)}},v)),h&&p?i.createElement("p",{className:(0,o.q)(l("errorMessage"),"text-sm text-red-500 mt-1")},p):null)});c.displayName="Textarea"},87452:function(e,t,r){r.d(t,{Z:function(){return d},r:function(){return c}});var n=r(5853),s=r(91054);r(42698),r(64016);var a=r(8710);r(33232);var i=r(13241),o=r(1153),u=r(2265);let l=(0,o.fn)("Accordion"),c=(0,u.createContext)({isOpen:!1}),d=u.forwardRef((e,t)=>{var r;let{defaultOpen:o=!1,children:d,className:h}=e,p=(0,n._T)(e,["defaultOpen","children","className"]),f=null!==(r=(0,u.useContext)(a.Z))&&void 0!==r?r:(0,i.q)("rounded-tremor-default border");return u.createElement(s.pJ,Object.assign({as:"div",ref:t,className:(0,i.q)(l("root"),"overflow-hidden","bg-tremor-background border-tremor-border","dark:bg-dark-tremor-background dark:border-dark-tremor-border",f,h),defaultOpen:o},p),e=>{let{open:t}=e;return u.createElement(c.Provider,{value:{isOpen:t}},d)})});d.displayName="Accordion"},88829:function(e,t,r){r.d(t,{Z:function(){return u}});var n=r(5853),s=r(2265),a=r(91054),i=r(13241);let o=(0,r(1153).fn)("AccordionBody"),u=s.forwardRef((e,t)=>{let{children:r,className:u}=e,l=(0,n._T)(e,["children","className"]);return s.createElement(a.pJ.Panel,Object.assign({ref:t,className:(0,i.q)(o("root"),"w-full text-tremor-default px-4 pb-3","text-tremor-content","dark:text-dark-tremor-content",u)},l),r)});u.displayName="AccordionBody"},72208:function(e,t,r){r.d(t,{Z:function(){return c}});var n=r(5853),s=r(2265),a=r(91054);let i=e=>{var t=(0,n._T)(e,[]);return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),s.createElement("path",{d:"M11.9999 10.8284L7.0502 15.7782L5.63599 14.364L11.9999 8L18.3639 14.364L16.9497 15.7782L11.9999 10.8284Z"}))};var o=r(87452),u=r(13241);let l=(0,r(1153).fn)("AccordionHeader"),c=s.forwardRef((e,t)=>{let{children:r,className:c}=e,d=(0,n._T)(e,["children","className"]),{isOpen:h}=(0,s.useContext)(o.r);return s.createElement(a.pJ.Button,Object.assign({ref:t,className:(0,u.q)(l("root"),"w-full flex items-center justify-between px-4 py-3","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis",c)},d),s.createElement("div",{className:(0,u.q)(l("children"),"flex flex-1 text-inherit mr-4")},r),s.createElement("div",null,s.createElement(i,{className:(0,u.q)(l("arrowIcon"),"h-5 w-5 -mr-1","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle",h?"transition-all":"transition-all -rotate-180")})))});c.displayName="AccordionHeader"},67982:function(e,t,r){r.d(t,{Z:function(){return u}});var n=r(5853),s=r(13241),a=r(1153),i=r(2265);let o=(0,a.fn)("Divider"),u=i.forwardRef((e,t)=>{let{className:r,children:a}=e,u=(0,n._T)(e,["className","children"]);return i.createElement("div",Object.assign({ref:t,className:(0,s.q)(o("root"),"w-full mx-auto my-6 flex justify-between gap-3 items-center text-tremor-default","text-tremor-content","dark:text-dark-tremor-content",r)},u),a?i.createElement(i.Fragment,null,i.createElement("div",{className:(0,s.q)("w-full h-[1px] bg-tremor-border dark:bg-dark-tremor-border")}),i.createElement("div",{className:(0,s.q)("text-inherit whitespace-nowrap")},a),i.createElement("div",{className:(0,s.q)("w-full h-[1px] bg-tremor-border dark:bg-dark-tremor-border")})):i.createElement("div",{className:(0,s.q)("w-full h-[1px] bg-tremor-border dark:bg-dark-tremor-border")}))});u.displayName="Divider"},23628:function(e,t,r){var n=r(2265);let s=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"}))});t.Z=s},49084:function(e,t,r){var n=r(2265);let s=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"}))});t.Z=s},2894:function(e,t,r){r.d(t,{R:function(){return o},m:function(){return i}});var n=r(18238),s=r(7989),a=r(11255),i=class extends s.F{#e;#t;#r;#n;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#r=e.mutationCache,this.#t=[],this.state=e.state||o(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#r.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||("pending"===this.state.status?this.scheduleGc():this.#r.remove(this))}continue(){return this.#n?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#s({type:"continue"})},r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#n=(0,a.Mz)({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{this.#s({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#s({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#r.canRun(this)});let n="pending"===this.state.status,s=!this.#n.canStart();try{if(n)t();else{this.#s({type:"pending",variables:e,isPaused:s}),await this.#r.config.onMutate?.(e,this,r);let t=await this.options.onMutate?.(e,r);t!==this.state.context&&this.#s({type:"pending",context:t,variables:e,isPaused:s})}let a=await this.#n.start();return await this.#r.config.onSuccess?.(a,e,this.state.context,this,r),await this.options.onSuccess?.(a,e,this.state.context,r),await this.#r.config.onSettled?.(a,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(a,null,e,this.state.context,r),this.#s({type:"success",data:a}),a}catch(t){try{throw await this.#r.config.onError?.(t,e,this.state.context,this,r),await this.options.onError?.(t,e,this.state.context,r),await this.#r.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(void 0,t,e,this.state.context,r),t}finally{this.#s({type:"error",error:t})}}finally{this.#r.runNext(this)}}#s(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),n.Vr.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#r.notify({mutation:this,type:"updated",action:e})})}};function o(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}},21623:function(e,t,r){r.d(t,{S:function(){return m}});var n=r(45345),s=r(21733),a=r(18238),i=r(24112),o=class extends i.l{constructor(e={}){super(),this.config=e,this.#a=new Map}#a;build(e,t,r){let a=t.queryKey,i=t.queryHash??(0,n.Rm)(a,t),o=this.get(i);return o||(o=new s.A({client:e,queryKey:a,queryHash:i,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(a)}),this.add(o)),o}add(e){this.#a.has(e.queryHash)||(this.#a.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#a.get(e.queryHash);t&&(e.destroy(),t===e&&this.#a.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){a.Vr.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#a.get(e)}getAll(){return[...this.#a.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,n._x)(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>(0,n._x)(e,t)):t}notify(e){a.Vr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){a.Vr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){a.Vr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},u=r(2894),l=class extends i.l{constructor(e={}){super(),this.config=e,this.#i=new Set,this.#o=new Map,this.#u=0}#i;#o;#u;build(e,t,r){let n=new u.m({client:e,mutationCache:this,mutationId:++this.#u,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#i.add(e);let t=c(e);if("string"==typeof t){let r=this.#o.get(t);r?r.push(e):this.#o.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#i.delete(e)){let t=c(e);if("string"==typeof t){let r=this.#o.get(t);if(r){if(r.length>1){let t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&this.#o.delete(t)}}}this.notify({type:"removed",mutation:e})}canRun(e){let t=c(e);if("string"!=typeof t)return!0;{let r=this.#o.get(t),n=r?.find(e=>"pending"===e.state.status);return!n||n===e}}runNext(e){let t=c(e);if("string"!=typeof t)return Promise.resolve();{let r=this.#o.get(t)?.find(t=>t!==e&&t.state.isPaused);return r?.continue()??Promise.resolve()}}clear(){a.Vr.batch(()=>{this.#i.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#i.clear(),this.#o.clear()})}getAll(){return Array.from(this.#i)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,n.X7)(t,e))}findAll(e={}){return this.getAll().filter(t=>(0,n.X7)(e,t))}notify(e){a.Vr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return a.Vr.batch(()=>Promise.all(e.map(e=>e.continue().catch(n.ZT))))}};function c(e){return e.options.scope?.id}var d=r(87045),h=r(57853);function p(e){return{onFetch:(t,r)=>{let s=t.options,a=t.fetchOptions?.meta?.fetchMore?.direction,i=t.state.data?.pages||[],o=t.state.data?.pageParams||[],u={pages:[],pageParams:[]},l=0,c=async()=>{let r=!1,c=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(t.signal.aborted?r=!0:t.signal.addEventListener("abort",()=>{r=!0}),t.signal)})},d=(0,n.cG)(t.options,t.fetchOptions),h=async(e,s,a)=>{if(r)return Promise.reject();if(null==s&&e.pages.length)return Promise.resolve(e);let i=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:s,direction:a?"backward":"forward",meta:t.options.meta};return c(e),e})(),o=await d(i),{maxPages:u}=t.options,l=a?n.Ht:n.VX;return{pages:l(e.pages,o,u),pageParams:l(e.pageParams,s,u)}};if(a&&i.length){let e="backward"===a,t={pages:i,pageParams:o},r=(e?function(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}:f)(s,t);u=await h(t,r,e)}else{let t=e??i.length;do{let e=0===l?o[0]??s.initialPageParam:f(s,u);if(l>0&&null==e)break;u=await h(u,e),l++}while(lt.options.persister?.(c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=c}}}function f(e,{pages:t,pageParams:r}){let n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}var m=class{#l;#r;#c;#d;#h;#p;#f;#m;constructor(e={}){this.#l=e.queryCache||new o,this.#r=e.mutationCache||new l,this.#c=e.defaultOptions||{},this.#d=new Map,this.#h=new Map,this.#p=0}mount(){this.#p++,1===this.#p&&(this.#f=d.j.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#l.onFocus())}),this.#m=h.N.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#l.onOnline())}))}unmount(){this.#p--,0===this.#p&&(this.#f?.(),this.#f=void 0,this.#m?.(),this.#m=void 0)}isFetching(e){return this.#l.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#r.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#l.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=this.#l.build(this,t),s=r.state.data;return void 0===s?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime((0,n.KC)(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(s))}getQueriesData(e){return this.#l.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,r){let s=this.defaultQueryOptions({queryKey:e}),a=this.#l.get(s.queryHash),i=a?.state.data,o=(0,n.SE)(t,i);if(void 0!==o)return this.#l.build(this,s).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return a.Vr.batch(()=>this.#l.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#l.get(t.queryHash)?.state}removeQueries(e){let t=this.#l;a.Vr.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let r=this.#l;return a.Vr.batch(()=>(r.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:!0,...t};return Promise.all(a.Vr.batch(()=>this.#l.findAll(e).map(e=>e.cancel(r)))).then(n.ZT).catch(n.ZT)}invalidateQueries(e,t={}){return a.Vr.batch(()=>(this.#l.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType==="none")?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t))}refetchQueries(e,t={}){let r={...t,cancelRefetch:t.cancelRefetch??!0};return Promise.all(a.Vr.batch(()=>this.#l.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,r);return r.throwOnError||(t=t.catch(n.ZT)),"paused"===e.state.fetchStatus?Promise.resolve():t}))).then(n.ZT)}fetchQuery(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let r=this.#l.build(this,t);return r.isStaleByTime((0,n.KC)(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(n.ZT).catch(n.ZT)}fetchInfiniteQuery(e){return e.behavior=p(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(n.ZT).catch(n.ZT)}ensureInfiniteQueryData(e){return e.behavior=p(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return h.N.isOnline()?this.#r.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#l}getMutationCache(){return this.#r}getDefaultOptions(){return this.#c}setDefaultOptions(e){this.#c=e}setQueryDefaults(e,t){this.#d.set((0,n.Ym)(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#d.values()],r={};return t.forEach(t=>{(0,n.to)(e,t.queryKey)&&Object.assign(r,t.defaultOptions)}),r}setMutationDefaults(e,t){this.#h.set((0,n.Ym)(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#h.values()],r={};return t.forEach(t=>{(0,n.to)(e,t.mutationKey)&&Object.assign(r,t.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#c.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=(0,n.Rm)(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===n.CN&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#c.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#l.clear(),this.#r.clear()}}},19616:function(e,t,r){r.d(t,{G:function(){return i}});var n=r(2265);let s={enabled:!0,leading:!1,trailing:!0,wait:0,onExecute:()=>{}};class a{constructor(e,t){this.fn=e,this._canLeadingExecute=!0,this._isPending=!1,this._executionCount=0,this._options={...s,...t}}setOptions(e){return this._options={...this._options,...e},this._options.enabled||(this._isPending=!1),this._options}getOptions(){return this._options}maybeExecute(...e){this._options.leading&&this._canLeadingExecute&&(this.executeFunction(...e),this._canLeadingExecute=!1),(this._options.leading||this._options.trailing)&&(this._isPending=!0),this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=setTimeout(()=>{this._canLeadingExecute=!0,this._isPending=!1,this._options.trailing&&this.executeFunction(...e)},this._options.wait)}executeFunction(...e){this._options.enabled&&(this.fn(...e),this._executionCount++,this._options.onExecute(this))}cancel(){this._timeoutId&&(clearTimeout(this._timeoutId),this._canLeadingExecute=!0,this._isPending=!1)}getExecutionCount(){return this._executionCount}getIsPending(){return this._options.enabled&&this._isPending}}function i(e,t){let[r,s]=(0,n.useState)(e),i=function(e,t){let[r]=(0,n.useState)(()=>{var r;return Object.getOwnPropertyNames(Object.getPrototypeOf(r=new a(e,t))).filter(e=>"function"==typeof r[e]).reduce((e,t)=>{let n=r[t];return"function"==typeof n&&(e[t]=n.bind(r)),e},{})});return r.setOptions(t),r}(s,t);return[r,i.maybeExecute,i]}},91054:function(e,t,r){let n,s;r.d(t,{pJ:function(){return N}});var a,i=r(71049),o=r(11323),u=r(2265),l=r(66797),c=r(93980),d=r(65573),h=r(67561),p=r(98218),f=r(33443),m=r(28294),y=r(31370),g=r(72468),b=r(5664),v=r(38929);let w=null!=(a=u.startTransition)?a:function(e){e()};var x=r(52724),E=((n=E||{})[n.Open=0]="Open",n[n.Closed=1]="Closed",n),C=((s=C||{})[s.ToggleDisclosure=0]="ToggleDisclosure",s[s.CloseDisclosure=1]="CloseDisclosure",s[s.SetButtonId=2]="SetButtonId",s[s.SetPanelId=3]="SetPanelId",s[s.SetButtonElement=4]="SetButtonElement",s[s.SetPanelElement=5]="SetPanelElement",s);let k={0:e=>({...e,disclosureState:(0,g.E)(e.disclosureState,{0:1,1:0})}),1:e=>1===e.disclosureState?e:{...e,disclosureState:1},2:(e,t)=>e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId},3:(e,t)=>e.panelId===t.panelId?e:{...e,panelId:t.panelId},4:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},5:(e,t)=>e.panelElement===t.element?e:{...e,panelElement:t.element}},P=(0,u.createContext)(null);function O(e){let t=(0,u.useContext)(P);if(null===t){let t=Error("<".concat(e," /> is missing a parent component."));throw Error.captureStackTrace&&Error.captureStackTrace(t,O),t}return t}P.displayName="DisclosureContext";let q=(0,u.createContext)(null);q.displayName="DisclosureAPIContext";let D=(0,u.createContext)(null);function S(e,t){return(0,g.E)(t.type,k,e,t)}D.displayName="DisclosurePanelContext";let T=u.Fragment,_=v.VN.RenderStrategy|v.VN.Static,N=Object.assign((0,v.yV)(function(e,t){let{defaultOpen:r=!1,...n}=e,s=(0,u.useRef)(null),a=(0,h.T)(t,(0,h.h)(e=>{s.current=e},void 0===e.as||e.as===u.Fragment)),i=(0,u.useReducer)(S,{disclosureState:r?0:1,buttonElement:null,panelElement:null,buttonId:null,panelId:null}),[{disclosureState:o,buttonId:l},d]=i,p=(0,c.z)(e=>{d({type:1});let t=(0,b.r)(s);if(!t||!l)return;let r=e?e instanceof HTMLElement?e:e.current instanceof HTMLElement?e.current:t.getElementById(l):t.getElementById(l);null==r||r.focus()}),y=(0,u.useMemo)(()=>({close:p}),[p]),w=(0,u.useMemo)(()=>({open:0===o,close:p}),[o,p]),x=(0,v.L6)();return u.createElement(P.Provider,{value:i},u.createElement(q.Provider,{value:y},u.createElement(f.Z,{value:p},u.createElement(m.up,{value:(0,g.E)(o,{0:m.ZM.Open,1:m.ZM.Closed})},x({ourProps:{ref:a},theirProps:n,slot:w,defaultTag:T,name:"Disclosure"})))))}),{Button:(0,v.yV)(function(e,t){let r=(0,u.useId)(),{id:n="headlessui-disclosure-button-".concat(r),disabled:s=!1,autoFocus:a=!1,...p}=e,[f,m]=O("Disclosure.Button"),g=(0,u.useContext)(D),b=null!==g&&g===f.panelId,w=(0,u.useRef)(null),E=(0,h.T)(w,t,(0,c.z)(e=>{if(!b)return m({type:4,element:e})}));(0,u.useEffect)(()=>{if(!b)return m({type:2,buttonId:n}),()=>{m({type:2,buttonId:null})}},[n,m,b]);let C=(0,c.z)(e=>{var t;if(b){if(1===f.disclosureState)return;switch(e.key){case x.R.Space:case x.R.Enter:e.preventDefault(),e.stopPropagation(),m({type:0}),null==(t=f.buttonElement)||t.focus()}}else switch(e.key){case x.R.Space:case x.R.Enter:e.preventDefault(),e.stopPropagation(),m({type:0})}}),k=(0,c.z)(e=>{e.key===x.R.Space&&e.preventDefault()}),P=(0,c.z)(e=>{var t;(0,y.P)(e.currentTarget)||s||(b?(m({type:0}),null==(t=f.buttonElement)||t.focus()):m({type:0}))}),{isFocusVisible:q,focusProps:S}=(0,i.F)({autoFocus:a}),{isHovered:T,hoverProps:_}=(0,o.X)({isDisabled:s}),{pressed:N,pressProps:I}=(0,l.x)({disabled:s}),M=(0,u.useMemo)(()=>({open:0===f.disclosureState,hover:T,active:N,disabled:s,focus:q,autofocus:a}),[f,T,N,q,s,a]),A=(0,d.f)(e,f.buttonElement),Q=b?(0,v.dG)({ref:E,type:A,disabled:s||void 0,autoFocus:a,onKeyDown:C,onClick:P},S,_,I):(0,v.dG)({ref:E,id:n,type:A,"aria-expanded":0===f.disclosureState,"aria-controls":f.panelElement?f.panelId:void 0,disabled:s||void 0,autoFocus:a,onKeyDown:C,onKeyUp:k,onClick:P},S,_,I);return(0,v.L6)()({ourProps:Q,theirProps:p,slot:M,defaultTag:"button",name:"Disclosure.Button"})}),Panel:(0,v.yV)(function(e,t){let r=(0,u.useId)(),{id:n="headlessui-disclosure-panel-".concat(r),transition:s=!1,...a}=e,[i,o]=O("Disclosure.Panel"),{close:l}=function e(t){let r=(0,u.useContext)(q);if(null===r){let r=Error("<".concat(t," /> is missing a parent component."));throw Error.captureStackTrace&&Error.captureStackTrace(r,e),r}return r}("Disclosure.Panel"),[d,f]=(0,u.useState)(null),y=(0,h.T)(t,(0,c.z)(e=>{w(()=>o({type:5,element:e}))}),f);(0,u.useEffect)(()=>(o({type:3,panelId:n}),()=>{o({type:3,panelId:null})}),[n,o]);let g=(0,m.oJ)(),[b,x]=(0,p.Y)(s,d,null!==g?(g&m.ZM.Open)===m.ZM.Open:0===i.disclosureState),E=(0,u.useMemo)(()=>({open:0===i.disclosureState,close:l}),[i.disclosureState,l]),C={ref:y,id:n,...(0,p.X)(x)},k=(0,v.L6)();return u.createElement(m.uu,null,u.createElement(D.Provider,{value:i.panelId},k({ourProps:C,theirProps:a,slot:E,defaultTag:"div",features:_,visible:b,name:"Disclosure.Panel"})))})})},33443:function(e,t,r){r.d(t,{Z:function(){return a}});var n=r(2265);let s=(0,n.createContext)(()=>{});function a(e){let{value:t,children:r}=e;return n.createElement(s.Provider,{value:t},r)}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/5333-438ba079aae9630c.js b/litellm/proxy/_experimental/out/_next/static/chunks/5333-1540faf81c7d7006.js similarity index 99% rename from litellm/proxy/_experimental/out/_next/static/chunks/5333-438ba079aae9630c.js rename to litellm/proxy/_experimental/out/_next/static/chunks/5333-1540faf81c7d7006.js index 5e4051ca903..2a03ddfa5f9 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/5333-438ba079aae9630c.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/5333-1540faf81c7d7006.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5333],{57365:function(e,t,n){n.d(t,{Z:function(){return a}});var r=n(5853),o=n(2265),l=n(51975),i=n(13241);let u=(0,n(1153).fn)("SelectItem"),a=o.forwardRef((e,t)=>{let{value:n,icon:a,className:s,children:c}=e,d=(0,r._T)(e,["value","icon","className","children"]);return o.createElement(l.wt,Object.assign({className:(0,i.q)(u("root"),"flex justify-start items-center cursor-default text-tremor-default px-2.5 py-2.5","data-[focus]:bg-tremor-background-muted data-[focus]:text-tremor-content-strong data-[selected]:text-tremor-content-strong data-[selected]:bg-tremor-background-muted text-tremor-content-emphasis","dark:data-[focus]:bg-dark-tremor-background-muted dark:data-[focus]:text-dark-tremor-content-strong dark:data-[selected]:text-dark-tremor-content-strong dark:data-[selected]:bg-dark-tremor-background-muted dark:text-dark-tremor-content-emphasis",s),ref:t,key:n,value:n},d),a&&o.createElement(a,{className:(0,i.q)(u("icon"),"flex-none w-5 h-5 mr-1.5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}),o.createElement("span",{className:"whitespace-nowrap truncate"},null!=c?c:n))});a.displayName="SelectItem"},67101:function(e,t,n){n.d(t,{Z:function(){return c}});var r=n(5853),o=n(13241),l=n(1153),i=n(2265),u=n(9496);let a=(0,l.fn)("Grid"),s=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"",c=i.forwardRef((e,t)=>{let{numItems:n=1,numItemsSm:l,numItemsMd:c,numItemsLg:d,children:f,className:p}=e,m=(0,r._T)(e,["numItems","numItemsSm","numItemsMd","numItemsLg","children","className"]),g=s(n,u._m),v=s(l,u.LH),h=s(c,u.l5),b=s(d,u.N4),x=(0,o.q)(g,v,h,b);return i.createElement("div",Object.assign({ref:t,className:(0,o.q)(a("root"),"grid",x,p)},m),f)});c.displayName="Grid"},9496:function(e,t,n){n.d(t,{LH:function(){return o},N4:function(){return i},PT:function(){return u},SP:function(){return a},VS:function(){return s},_m:function(){return r},_w:function(){return c},l5:function(){return l}});let r={0:"grid-cols-none",1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6",7:"grid-cols-7",8:"grid-cols-8",9:"grid-cols-9",10:"grid-cols-10",11:"grid-cols-11",12:"grid-cols-12"},o={0:"sm:grid-cols-none",1:"sm:grid-cols-1",2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6",7:"sm:grid-cols-7",8:"sm:grid-cols-8",9:"sm:grid-cols-9",10:"sm:grid-cols-10",11:"sm:grid-cols-11",12:"sm:grid-cols-12"},l={0:"md:grid-cols-none",1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3",4:"md:grid-cols-4",5:"md:grid-cols-5",6:"md:grid-cols-6",7:"md:grid-cols-7",8:"md:grid-cols-8",9:"md:grid-cols-9",10:"md:grid-cols-10",11:"md:grid-cols-11",12:"md:grid-cols-12"},i={0:"lg:grid-cols-none",1:"lg:grid-cols-1",2:"lg:grid-cols-2",3:"lg:grid-cols-3",4:"lg:grid-cols-4",5:"lg:grid-cols-5",6:"lg:grid-cols-6",7:"lg:grid-cols-7",8:"lg:grid-cols-8",9:"lg:grid-cols-9",10:"lg:grid-cols-10",11:"lg:grid-cols-11",12:"lg:grid-cols-12"},u={1:"col-span-1",2:"col-span-2",3:"col-span-3",4:"col-span-4",5:"col-span-5",6:"col-span-6",7:"col-span-7",8:"col-span-8",9:"col-span-9",10:"col-span-10",11:"col-span-11",12:"col-span-12",13:"col-span-13"},a={1:"sm:col-span-1",2:"sm:col-span-2",3:"sm:col-span-3",4:"sm:col-span-4",5:"sm:col-span-5",6:"sm:col-span-6",7:"sm:col-span-7",8:"sm:col-span-8",9:"sm:col-span-9",10:"sm:col-span-10",11:"sm:col-span-11",12:"sm:col-span-12",13:"sm:col-span-13"},s={1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3",4:"md:col-span-4",5:"md:col-span-5",6:"md:col-span-6",7:"md:col-span-7",8:"md:col-span-8",9:"md:col-span-9",10:"md:col-span-10",11:"md:col-span-11",12:"md:col-span-12",13:"md:col-span-13"},c={1:"lg:col-span-1",2:"lg:col-span-2",3:"lg:col-span-3",4:"lg:col-span-4",5:"lg:col-span-5",6:"lg:col-span-6",7:"lg:col-span-7",8:"lg:col-span-8",9:"lg:col-span-9",10:"lg:col-span-10",11:"lg:col-span-11",12:"lg:col-span-12",13:"lg:col-span-13"}},64803:function(e,t,n){n.d(t,{RR:function(){return m},YF:function(){return d},cv:function(){return f},dp:function(){return g},uY:function(){return p}});var r=n(51050),o=n(2265),l=n(54887),i="undefined"!=typeof document?o.useLayoutEffect:function(){};function u(e,t){let n,r,o;if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if((n=e.length)!==t.length)return!1;for(r=n;0!=r--;)if(!u(e[r],t[r]))return!1;return!0}if((n=(o=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!({}).hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!=r--;){let n=o[r];if(("_owner"!==n||!e.$$typeof)&&!u(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function a(e){return"undefined"==typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function s(e,t){let n=a(e);return Math.round(t*n)/n}function c(e){let t=o.useRef(e);return i(()=>{t.current=e}),t}function d(e){void 0===e&&(e={});let{placement:t="bottom",strategy:n="absolute",middleware:d=[],platform:f,elements:{reference:p,floating:m}={},transform:g=!0,whileElementsMounted:v,open:h}=e,[b,x]=o.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[E,y]=o.useState(d);u(E,d)||y(d);let[S,O]=o.useState(null),[R,w]=o.useState(null),C=o.useCallback(e=>{e!==M.current&&(M.current=e,O(e))},[]),P=o.useCallback(e=>{e!==k.current&&(k.current=e,w(e))},[]),L=p||S,T=m||R,M=o.useRef(null),k=o.useRef(null),I=o.useRef(b),F=null!=v,A=c(v),N=c(f),D=c(h),z=o.useCallback(()=>{if(!M.current||!k.current)return;let e={placement:t,strategy:n,middleware:E};N.current&&(e.platform=N.current),(0,r.oo)(M.current,k.current,e).then(e=>{let t={...e,isPositioned:!1!==D.current};H.current&&!u(I.current,t)&&(I.current=t,l.flushSync(()=>{x(t)}))})},[E,t,n,N,D]);i(()=>{!1===h&&I.current.isPositioned&&(I.current.isPositioned=!1,x(e=>({...e,isPositioned:!1})))},[h]);let H=o.useRef(!1);i(()=>(H.current=!0,()=>{H.current=!1}),[]),i(()=>{if(L&&(M.current=L),T&&(k.current=T),L&&T){if(A.current)return A.current(L,T,z);z()}},[L,T,z,A,F]);let _=o.useMemo(()=>({reference:M,floating:k,setReference:C,setFloating:P}),[C,P]),V=o.useMemo(()=>({reference:L,floating:T}),[L,T]),B=o.useMemo(()=>{let e={position:n,left:0,top:0};if(!V.floating)return e;let t=s(V.floating,b.x),r=s(V.floating,b.y);return g?{...e,transform:"translate("+t+"px, "+r+"px)",...a(V.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}},[n,g,V.floating,b.x,b.y]);return o.useMemo(()=>({...b,update:z,refs:_,elements:V,floatingStyles:B}),[b,z,_,V,B])}let f=(e,t)=>({...(0,r.cv)(e),options:[e,t]}),p=(e,t)=>({...(0,r.uY)(e),options:[e,t]}),m=(e,t)=>({...(0,r.RR)(e),options:[e,t]}),g=(e,t)=>({...(0,r.dp)(e),options:[e,t]})},52307:function(e,t,n){n.d(t,{dk:function(){return f},fw:function(){return d},zH:function(){return c}});var r=n(2265),o=n(93980),l=n(73389),i=n(67561),u=n(87550),a=n(38929);let s=(0,r.createContext)(null);function c(){var e,t;return null!=(t=null==(e=(0,r.useContext)(s))?void 0:e.value)?t:void 0}function d(){let[e,t]=(0,r.useState)([]);return[e.length>0?e.join(" "):void 0,(0,r.useMemo)(()=>function(e){let n=(0,o.z)(e=>(t(t=>[...t,e]),()=>t(t=>{let n=t.slice(),r=n.indexOf(e);return -1!==r&&n.splice(r,1),n}))),l=(0,r.useMemo)(()=>({register:n,slot:e.slot,name:e.name,props:e.props,value:e.value}),[n,e.slot,e.name,e.props,e.value]);return r.createElement(s.Provider,{value:l},e.children)},[t])]}s.displayName="DescriptionContext";let f=Object.assign((0,a.yV)(function(e,t){let n=(0,r.useId)(),o=(0,u.B)(),{id:c="headlessui-description-".concat(n),...d}=e,f=function e(){let t=(0,r.useContext)(s);if(null===t){let t=Error("You used a component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,e),t}return t}(),p=(0,i.T)(t);(0,l.e)(()=>f.register(c),[c,f.register]);let m=o||!1,g=(0,r.useMemo)(()=>({...f.slot,disabled:m}),[f.slot,m]),v={ref:p,...f.props,id:c};return(0,a.L6)()({ourProps:v,theirProps:d,slot:g,defaultTag:"p",name:f.name||"Description"})}),{})},7935:function(e,t,n){n.d(t,{__:function(){return p},bE:function(){return f},wp:function(){return d}});var r=n(2265),o=n(93980),l=n(73389),i=n(67561),u=n(87550),a=n(80281),s=n(38929);let c=(0,r.createContext)(null);function d(e){var t,n,o;let l=null!=(n=null==(t=(0,r.useContext)(c))?void 0:t.value)?n:void 0;return(null!=(o=null==e?void 0:e.length)?o:0)>0?[l,...e].filter(Boolean).join(" "):l}function f(){let{inherit:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=d(),[n,l]=(0,r.useState)([]),i=e?[t,...n].filter(Boolean):n;return[i.length>0?i.join(" "):void 0,(0,r.useMemo)(()=>function(e){let t=(0,o.z)(e=>(l(t=>[...t,e]),()=>l(t=>{let n=t.slice(),r=n.indexOf(e);return -1!==r&&n.splice(r,1),n}))),n=(0,r.useMemo)(()=>({register:t,slot:e.slot,name:e.name,props:e.props,value:e.value}),[t,e.slot,e.name,e.props,e.value]);return r.createElement(c.Provider,{value:n},e.children)},[l])]}c.displayName="LabelContext";let p=Object.assign((0,s.yV)(function(e,t){var n;let d=(0,r.useId)(),f=function e(){let t=(0,r.useContext)(c);if(null===t){let t=Error("You used a
+ } type="error" showIcon action={ diff --git a/ui/litellm-dashboard/src/components/networking.tsx b/ui/litellm-dashboard/src/components/networking.tsx index 0e45c0f3a91..c5dc3114ff6 100644 --- a/ui/litellm-dashboard/src/components/networking.tsx +++ b/ui/litellm-dashboard/src/components/networking.tsx @@ -5964,7 +5964,7 @@ export const listMCPTools = async (accessToken: string, serverId: string) => { throw new Error("Failed to fetch MCP tools"); } - // Return the full response object which includes tools, error, and message + // Return the full response object which includes tools, error, message, and stack_trace return data; } catch (error) { console.error("Failed to fetch MCP tools:", error); @@ -5973,6 +5973,7 @@ export const listMCPTools = async (accessToken: string, serverId: string) => { tools: [], error: "network_error", message: error instanceof Error ? error.message : "Failed to fetch MCP tools", + stack_trace: null, }; } }; diff --git a/ui/litellm-dashboard/src/hooks/useTestMCPConnection.tsx b/ui/litellm-dashboard/src/hooks/useTestMCPConnection.tsx index a82bb2fa45b..7354b1a5364 100644 --- a/ui/litellm-dashboard/src/hooks/useTestMCPConnection.tsx +++ b/ui/litellm-dashboard/src/hooks/useTestMCPConnection.tsx @@ -29,6 +29,7 @@ interface UseTestMCPConnectionReturn { tools: any[]; isLoadingTools: boolean; toolsError: string | null; + toolsErrorStackTrace: string | null; hasShownSuccessMessage: boolean; canFetchTools: boolean; fetchTools: () => Promise; @@ -44,6 +45,7 @@ export const useTestMCPConnection = ({ const [tools, setTools] = useState([]); const [isLoadingTools, setIsLoadingTools] = useState(false); const [toolsError, setToolsError] = useState(null); + const [toolsErrorStackTrace, setToolsErrorStackTrace] = useState(null); const [hasShownSuccessMessage, setHasShownSuccessMessage] = useState(false); // Check if we have the minimum required fields to fetch tools @@ -137,18 +139,21 @@ export const useTestMCPConnection = ({ if (toolsResponse.tools && !toolsResponse.error) { setTools(toolsResponse.tools); setToolsError(null); + setToolsErrorStackTrace(null); if (toolsResponse.tools.length > 0 && !hasShownSuccessMessage) { setHasShownSuccessMessage(true); } } else { const errorMessage = toolsResponse.message || "Failed to retrieve tools list"; setToolsError(errorMessage); + setToolsErrorStackTrace(toolsResponse.stack_trace || null); setTools([]); setHasShownSuccessMessage(false); } } catch (error) { console.error("Tools fetch error:", error); setToolsError(error instanceof Error ? error.message : String(error)); + setToolsErrorStackTrace(null); setTools([]); setHasShownSuccessMessage(false); } finally { @@ -159,6 +164,7 @@ export const useTestMCPConnection = ({ const clearTools = () => { setTools([]); setToolsError(null); + setToolsErrorStackTrace(null); setHasShownSuccessMessage(false); }; @@ -190,6 +196,7 @@ export const useTestMCPConnection = ({ tools, isLoadingTools, toolsError, + toolsErrorStackTrace, hasShownSuccessMessage, canFetchTools, fetchTools, From 6af693de364166cb9c2b5056c3db26b61a3b5cb1 Mon Sep 17 00:00:00 2001 From: Dominic Feliton <37809476+dominicfeliton@users.noreply.github.com> Date: Thu, 4 Dec 2025 19:24:28 -0800 Subject: [PATCH 044/178] (fix): empty response + vllm streaming (#17516) * Fix empty response + vllm streaming * Add unit test --- litellm/llms/openai/openai.py | 4 +-- .../llms/openai/test_openai_empty_response.py | 30 +++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/litellm/llms/openai/openai.py b/litellm/llms/openai/openai.py index 20842525e59..bb9225fc79b 100644 --- a/litellm/llms/openai/openai.py +++ b/litellm/llms/openai/openai.py @@ -444,7 +444,7 @@ class OpenAIChatCompletion(BaseLLM, BaseOpenAILLM): else: headers = {} response = raw_response.parse() - if not hasattr(response, "model_dump"): + if not data.get("stream") and not hasattr(response, "model_dump"): raise OpenAIError( status_code=500, message=f"Empty or invalid response from LLM endpoint. Received: {response!r}. Check the reverse proxy or model server configuration.", @@ -482,7 +482,7 @@ class OpenAIChatCompletion(BaseLLM, BaseOpenAILLM): else: headers = {} response = raw_response.parse() - if not hasattr(response, "model_dump"): + if not data.get("stream") and not hasattr(response, "model_dump"): raise OpenAIError( status_code=500, message=f"Empty or invalid response from LLM endpoint. Received: {response!r}. Check the reverse proxy or model server configuration.", diff --git a/tests/test_litellm/llms/openai/test_openai_empty_response.py b/tests/test_litellm/llms/openai/test_openai_empty_response.py index fb42918f381..d1692bdf9bd 100644 --- a/tests/test_litellm/llms/openai/test_openai_empty_response.py +++ b/tests/test_litellm/llms/openai/test_openai_empty_response.py @@ -95,3 +95,33 @@ class TestEmptyResponseHandling: assert response == mock_response assert headers == {"x-request-id": "123"} + + def test_sync_streaming_response_passes_through_without_model_dump(self): + """ + Test that streaming responses (which don't have model_dump) pass through + correctly without raising an error. This validates the fix for VLLM streaming. + """ + openai_chat = OpenAIChatCompletion() + + # Create a mock response WITHOUT model_dump (like an AsyncStream/Iterator) + mock_stream = MagicMock(spec=[]) # spec=[] means no attributes + + mock_raw_response = MagicMock() + mock_raw_response.headers = {"x-request-id": "123"} + mock_raw_response.parse.return_value = mock_stream + + mock_client = MagicMock() + mock_client.chat.completions.with_raw_response.create.return_value = ( + mock_raw_response + ) + + # Key: data has stream=True - this should bypass the model_dump check + headers, response = openai_chat.make_sync_openai_chat_completion_request( + openai_client=mock_client, + data={"messages": [{"role": "user", "content": "test"}], "stream": True}, + timeout=30, + logging_obj=MagicMock(), + ) + + assert response == mock_stream + assert headers == {"x-request-id": "123"} From a6006e698c210d204b75a851b59baeb56c8b197d Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Fri, 5 Dec 2025 09:34:49 +0530 Subject: [PATCH 045/178] Add support for cursor BYOK with its own configuration --- docs/my-website/docs/proxy/cursor.md | 94 ++++++++++++ docs/my-website/sidebars.js | 1 + .../proxy/response_api_endpoints/endpoints.py | 144 ++++++++++++++++++ .../response_api_endpoints/test_endpoints.py | 63 ++++++++ 4 files changed, 302 insertions(+) create mode 100644 docs/my-website/docs/proxy/cursor.md diff --git a/docs/my-website/docs/proxy/cursor.md b/docs/my-website/docs/proxy/cursor.md new file mode 100644 index 00000000000..1d9b6a0e0bc --- /dev/null +++ b/docs/my-website/docs/proxy/cursor.md @@ -0,0 +1,94 @@ +--- +id: cursor +title: Cursor Endpoint (/cursor/chat/completions) +description: Accept Responses API input from Cursor and return OpenAI Chat Completions output +--- + +LiteLLM provides a Cursor-specific endpoint to make Cursor IDE work seamlessly with the LiteLLM Proxy when using BYOK + custom `base_url`. + +- Accepts Requests in OpenAI Responses API input format (Cursor sends this) +- Returns Responses in OpenAI Chat Completions format (Cursor expects this) +- Supports streaming and non‑streaming + +## Endpoint + +- Path: `/cursor/chat/completions` +- Auth: Standard LiteLLM Proxy auth (`Authorization: Bearer `) +- Behavior: Internally routes to LiteLLM `/responses` flow and transforms output to Chat Completions + +## Why this exists + +When setting up Cursor with BYOK against a custom `base_url`, Cursor sends requests to the Chat Completions endpoint but in the OpenAI Responses API input shape. Without translation, Cursor won’t display streamed output. This endpoint bridges the formats: + +- Input: Responses API (`input`, tool calls, etc.) +- Output: Chat Completions (`choices`, `delta`, `finish_reason`, etc.) + +## Usage + +### Non-streaming + +```bash +curl -X POST http://localhost:4000/cursor/chat/completions \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer sk-1234" \ + -d '{ + "model": "gpt-4o", + "input": [{"role": "user", "content": "Hello"}] + }' +``` + +Example response (shape): + +```json +{ + "id": "chatcmpl-123", + "object": "chat.completion", + "created": 1733333333, + "model": "gpt-4o", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "Hello! How can I help you?" + }, + "finish_reason": "stop" + } + ], + "usage": { + "prompt_tokens": 10, + "completion_tokens": 8, + "total_tokens": 18 + } +} +``` + +### Streaming + +```bash +curl -N -X POST http://localhost:4000/cursor/chat/completions \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer sk-1234" \ + -d '{ + "model": "gpt-4o", + "input": [{"role": "user", "content": "Hello"}], + "stream": true + }' +``` + +- Server-Sent Events (SSE) +- Emits `chat.completion.chunk` deltas (`choices[].delta`) and ends with `data: [DONE]` + +## Configuration + +No special configuration is required beyond your normal LiteLLM Proxy setup. Ensure that: + +- Your `config.yaml` includes the models you want to call via this endpoint +- Your Cursor project uses your LiteLLM Proxy `base_url` and a valid API key + +## Notes + +- Only this page documents the Cursor endpoint. The native `/responses` docs remain unchanged. +- This endpoint is intended specifically for Cursor’s request/response expectations. Other clients should continue to use `/v1/chat/completions` or `/v1/responses` as appropriate. + + diff --git a/docs/my-website/sidebars.js b/docs/my-website/sidebars.js index cebe31a8e11..a2f1339f1e3 100644 --- a/docs/my-website/sidebars.js +++ b/docs/my-website/sidebars.js @@ -448,6 +448,7 @@ const sidebars = { "realtime", "rerank", "response_api", + "proxy/cursor", { type: "category", label: "/search", diff --git a/litellm/proxy/response_api_endpoints/endpoints.py b/litellm/proxy/response_api_endpoints/endpoints.py index 26d10c1ac47..7736c37a809 100644 --- a/litellm/proxy/response_api_endpoints/endpoints.py +++ b/litellm/proxy/response_api_endpoints/endpoints.py @@ -85,6 +85,150 @@ async def responses_api( ) +@router.post( + "/cursor/chat/completions", + dependencies=[Depends(user_api_key_auth)], + tags=["responses"], +) +async def cursor_chat_completions( + request: Request, + fastapi_response: Response, + user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth), +): + """ + Cursor-specific endpoint that accepts Responses API input format but returns chat completions format. + + This endpoint handles requests from Cursor IDE which sends Responses API format (`input` field) + but expects chat completions format response (`choices`, `messages`, etc.). + + ```bash + curl -X POST http://localhost:4000/cursor/chat/completions \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer sk-1234" \ + -d '{ + "model": "gpt-4o", + "input": [{"role": "user", "content": "Hello"}] + }' + Responds back in chat completions format. + ``` + """ + from litellm.completion_extras.litellm_responses_transformation.handler import ( + responses_api_bridge, + ) + from litellm.litellm_core_utils.streaming_handler import CustomStreamWrapper + from litellm.proxy.proxy_server import ( + _read_request_body, + async_data_generator, + general_settings, + llm_router, + proxy_config, + proxy_logging_obj, + user_api_base, + user_max_tokens, + user_model, + user_request_timeout, + user_temperature, + version, + ) + from litellm.responses.streaming_iterator import BaseResponsesAPIStreamingIterator + from litellm.types.llms.openai import ResponsesAPIResponse + + data = await _read_request_body(request=request) + processor = ProxyBaseLLMRequestProcessing(data=data) + + def cursor_data_generator(response, user_api_key_dict, request_data): + """ + Custom generator that transforms Responses API streaming chunks to chat completion chunks. + + This generator is used for the cursor endpoint to convert Responses API format responses + to chat completion format that Cursor IDE expects. + + Args: + response: The streaming response (BaseResponsesAPIStreamingIterator or other) + user_api_key_dict: User API key authentication dict + request_data: Request data containing model, logging_obj, etc. + + Returns: + Async generator that yields SSE-formatted chat completion chunks + """ + # If response is a BaseResponsesAPIStreamingIterator, transform it first + if isinstance(response, BaseResponsesAPIStreamingIterator): + # Transform Responses API iterator to chat completion iterator + completion_stream = responses_api_bridge.transformation_handler.get_model_response_iterator( + streaming_response=response, + sync_stream=False, + json_mode=False, + ) + # Wrap in CustomStreamWrapper to get the async generator + logging_obj = request_data.get("litellm_logging_obj") + streamwrapper = CustomStreamWrapper( + completion_stream=completion_stream, + model=request_data.get("model", ""), + custom_llm_provider=None, + logging_obj=logging_obj, + ) + # Use async_data_generator to format as SSE + return async_data_generator( + response=streamwrapper, + user_api_key_dict=user_api_key_dict, + request_data=request_data, + ) + # Otherwise, use the default generator + return async_data_generator( + response=response, + user_api_key_dict=user_api_key_dict, + request_data=request_data, + ) + + try: + response = await processor.base_process_llm_request( + request=request, + fastapi_response=fastapi_response, + user_api_key_dict=user_api_key_dict, + route_type="aresponses", + proxy_logging_obj=proxy_logging_obj, + llm_router=llm_router, + general_settings=general_settings, + proxy_config=proxy_config, + select_data_generator=cursor_data_generator, + model=None, + user_model=user_model, + user_temperature=user_temperature, + user_request_timeout=user_request_timeout, + user_max_tokens=user_max_tokens, + user_api_base=user_api_base, + version=version, + ) + + # Transform non-streaming Responses API response to chat completions format + if isinstance(response, ResponsesAPIResponse): + logging_obj = processor.data.get("litellm_logging_obj") + transformed_response = responses_api_bridge.transformation_handler.transform_response( + model=processor.data.get("model", ""), + raw_response=response, + model_response=None, + logging_obj=logging_obj, + request_data=processor.data, + messages=processor.data.get("input", []), + optional_params={}, + litellm_params={}, + encoding=None, + api_key=None, + json_mode=None, + ) + return transformed_response + + # Streaming responses are already transformed by cursor_select_data_generator + return response + except Exception as e: + raise await processor._handle_llm_api_exception( + e=e, + user_api_key_dict=user_api_key_dict, + proxy_logging_obj=proxy_logging_obj, + version=version, + ) + + @router.get( "/v1/responses/{response_id}", dependencies=[Depends(user_api_key_auth)], diff --git a/tests/test_litellm/proxy/response_api_endpoints/test_endpoints.py b/tests/test_litellm/proxy/response_api_endpoints/test_endpoints.py index bca0944aeac..4bbbf87edb8 100644 --- a/tests/test_litellm/proxy/response_api_endpoints/test_endpoints.py +++ b/tests/test_litellm/proxy/response_api_endpoints/test_endpoints.py @@ -51,3 +51,66 @@ class TestResponsesAPIEndpoints(unittest.TestCase): assert response.status_code in [200, 401, 500] + @pytest.mark.asyncio + @patch("litellm.proxy.proxy_server.llm_router") + @patch("litellm.proxy.proxy_server.user_api_key_auth") + async def test_cursor_chat_completions_route(self, mock_auth, mock_router): + """ + Test that /cursor/chat/completions endpoint: + 1. Accepts Responses API input format + 2. Returns chat completions format response + 3. Transforms streaming responses correctly + """ + from litellm.types.llms.openai import ResponsesAPIResponse + from litellm.types.utils import ResponseOutputMessage, ResponseOutputText + + mock_auth.return_value = MagicMock( + token="test_token", + user_id="test_user", + team_id=None, + ) + + # Mock a Responses API response + mock_responses_response = ResponsesAPIResponse( + id="resp_cursor123", + created_at=1234567890, + model="gpt-4o", + object="response", + output=[ + ResponseOutputMessage( + type="message", + role="assistant", + content=[ + ResponseOutputText(type="output_text", text="Hello from Cursor!") + ], + ) + ], + ) + + mock_router.aresponses = AsyncMock(return_value=mock_responses_response) + + client = TestClient(app) + + # Test with Responses API input format (what Cursor sends) + test_data = { + "model": "gpt-4o", + "input": [{"role": "user", "content": "Hello"}], + } + + response = client.post( + "/cursor/chat/completions", + json=test_data, + headers={"Authorization": "Bearer sk-1234"}, + ) + + # Should return 200 (or 401/500 if auth fails) + assert response.status_code in [200, 401, 500] + + # If successful, verify it returns chat completions format + if response.status_code == 200: + response_data = response.json() + # Should have chat completion structure + assert "choices" in response_data or "id" in response_data + # Should not have Responses API structure + assert "output" not in response_data or "status" not in response_data + From 4d83a48b59c15e7d4170b51e0c6b72ad2aae555f Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Fri, 5 Dec 2025 09:39:58 +0530 Subject: [PATCH 046/178] Add steps to add litellm proxy in cursor --- docs/my-website/docs/proxy/cursor.md | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/docs/my-website/docs/proxy/cursor.md b/docs/my-website/docs/proxy/cursor.md index 1d9b6a0e0bc..83284db9831 100644 --- a/docs/my-website/docs/proxy/cursor.md +++ b/docs/my-website/docs/proxy/cursor.md @@ -28,7 +28,7 @@ When setting up Cursor with BYOK against a custom `base_url`, Cursor sends reque ### Non-streaming ```bash -curl -X POST http://localhost:4000/cursor/chat/completions \ +curl -X POST https://litellm-internal/cursor/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer sk-1234" \ -d '{ @@ -66,7 +66,7 @@ Example response (shape): ### Streaming ```bash -curl -N -X POST http://localhost:4000/cursor/chat/completions \ +curl -N -X POST https://litellm-internal/cursor/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer sk-1234" \ -d '{ @@ -81,10 +81,26 @@ curl -N -X POST http://localhost:4000/cursor/chat/completions \ ## Configuration +### Base URL Setup + +**Important**: When configuring Cursor IDE to use this endpoint, you must include `/cursor` in the base URL. + +Cursor automatically appends `/chat/completions` to the base URL you provide. To ensure requests go to `/cursor/chat/completions`, configure your base URL in Cursor as: + +``` +Base URL: https://litellm-internal/cursor +``` + +This way, when Cursor appends `/chat/completions`, the full path becomes `/cursor/chat/completions`, which is the correct endpoint. + +**Example**: If your LiteLLM Proxy is running at `https://litellm-internal`, set the base URL in Cursor to `https://litellm-internal/cursor` (not just `https://litellm-internal`). + +### General Setup + No special configuration is required beyond your normal LiteLLM Proxy setup. Ensure that: - Your `config.yaml` includes the models you want to call via this endpoint -- Your Cursor project uses your LiteLLM Proxy `base_url` and a valid API key +- Your Cursor project uses your LiteLLM Proxy `base_url` (with `/cursor` included) and a valid API key ## Notes From 01ee46b49342258eac868eb24ce005c1604ada86 Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Fri, 5 Dec 2025 10:01:48 +0530 Subject: [PATCH 047/178] Add steps to add litellm proxy in cursor --- docs/my-website/docs/proxy/cursor.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/my-website/docs/proxy/cursor.md b/docs/my-website/docs/proxy/cursor.md index 83284db9831..6bfac517569 100644 --- a/docs/my-website/docs/proxy/cursor.md +++ b/docs/my-website/docs/proxy/cursor.md @@ -103,8 +103,6 @@ No special configuration is required beyond your normal LiteLLM Proxy setup. Ens - Your Cursor project uses your LiteLLM Proxy `base_url` (with `/cursor` included) and a valid API key ## Notes - -- Only this page documents the Cursor endpoint. The native `/responses` docs remain unchanged. - This endpoint is intended specifically for Cursor’s request/response expectations. Other clients should continue to use `/v1/chat/completions` or `/v1/responses` as appropriate. From 392e5059b0835e913133fef00b362545469887da Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Fri, 5 Dec 2025 10:02:42 +0530 Subject: [PATCH 048/178] Add steps to add litellm proxy in cursor --- docs/my-website/docs/proxy/cursor.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/my-website/docs/proxy/cursor.md b/docs/my-website/docs/proxy/cursor.md index 6bfac517569..d01c1e62036 100644 --- a/docs/my-website/docs/proxy/cursor.md +++ b/docs/my-website/docs/proxy/cursor.md @@ -1,6 +1,6 @@ --- id: cursor -title: Cursor Endpoint (/cursor/chat/completions) +title: /cursor/chat/completions - Cursor Endpoint description: Accept Responses API input from Cursor and return OpenAI Chat Completions output --- From 48b5100c181a8f116d98b75070ad4fd00bde5a35 Mon Sep 17 00:00:00 2001 From: Devaj Mody Date: Fri, 5 Dec 2025 00:50:15 -0500 Subject: [PATCH 049/178] fix(guardrails): mask all matching keywords in content filter (#17521) Fixes #17517 - Fixed bug where only the first matching blocked keyword was masked - Now iterates through ALL blocked keywords and masks each one - Added 3 regression tests for multiple keyword masking --- .../litellm_content_filter/content_filter.py | 16 ++- .../content_filter/test_content_filter.py | 116 ++++++++++++++++++ 2 files changed, 128 insertions(+), 4 deletions(-) diff --git a/litellm/proxy/guardrails/guardrail_hooks/litellm_content_filter/content_filter.py b/litellm/proxy/guardrails/guardrail_hooks/litellm_content_filter/content_filter.py index 6756b188847..c9feb2c47e6 100644 --- a/litellm/proxy/guardrails/guardrail_hooks/litellm_content_filter/content_filter.py +++ b/litellm/proxy/guardrails/guardrail_hooks/litellm_content_filter/content_filter.py @@ -355,10 +355,16 @@ class ContentFilterGuardrail(CustomGuardrail): text = text.replace(matched_text, redaction_tag) verbose_proxy_logger.info(f"Masked {pattern_name} in content") - # Check blocked words - word_match = self._check_blocked_words(text) - if word_match: - keyword, action, description = word_match + # Check blocked words - iterate through ALL blocked words + # to ensure all matching keywords are processed, not just the first one + text_lower = text.lower() + for keyword, (action, description) in self.blocked_words.items(): + if keyword not in text_lower: + continue + + verbose_proxy_logger.debug( + f"Blocked word '{keyword}' found with action {action}" + ) if action == ContentFilterAction.BLOCK: error_msg = f"Content blocked: keyword '{keyword}' detected" @@ -381,6 +387,8 @@ class ContentFilterGuardrail(CustomGuardrail): text, flags=re.IGNORECASE, ) + # Update text_lower after masking to avoid re-matching + text_lower = text.lower() verbose_proxy_logger.info(f"Masked keyword '{keyword}' in content") processed_texts.append(text) diff --git a/tests/test_litellm/proxy/guardrails/guardrail_hooks/content_filter/test_content_filter.py b/tests/test_litellm/proxy/guardrails/guardrail_hooks/content_filter/test_content_filter.py index b5c093fdf06..ec7a0c0700a 100644 --- a/tests/test_litellm/proxy/guardrails/guardrail_hooks/content_filter/test_content_filter.py +++ b/tests/test_litellm/proxy/guardrails/guardrail_hooks/content_filter/test_content_filter.py @@ -555,3 +555,119 @@ class TestContentFilterGuardrail: assert guardrail.blocked_words["langchain"] == ("BLOCK", None) assert "openai" in guardrail.blocked_words assert guardrail.blocked_words["openai"] == ("MASK", "Competitor name") + + @pytest.mark.asyncio + async def test_apply_guardrail_masks_all_different_blocked_keywords(self): + """ + Test that ALL different blocked keywords are masked, not just the first one. + + Regression test for GitHub issue #17517: + https://github.com/BerriAI/litellm/issues/17517 + + Before fix: + Input: "Keyword01 Keyword01 Keyword02" + Output: "[KEYWORD_REDACTED] [KEYWORD_REDACTED] Keyword02" + (only first matching keyword type was replaced) + + After fix: + Input: "Keyword01 Keyword01 Keyword02" + Output: "[KEYWORD_REDACTED] [KEYWORD_REDACTED] [KEYWORD_REDACTED]" + (all matching keywords are replaced) + """ + blocked_words = [ + BlockedWord( + keyword="keyword01", + action=ContentFilterAction.MASK, + ), + BlockedWord( + keyword="keyword02", + action=ContentFilterAction.MASK, + ), + ] + + guardrail = ContentFilterGuardrail( + guardrail_name="test-multiple-keywords", + blocked_words=blocked_words, + ) + + # Test case from issue #17517 + guardrailed_inputs = await guardrail.apply_guardrail( + inputs={"texts": ["Keyword01 Keyword01 Keyword02"]}, + request_data={}, + input_type="request", + ) + result = guardrailed_inputs.get("texts", []) + + assert result is not None + assert len(result) == 1 + # All keywords should be redacted + assert result[0] == "[KEYWORD_REDACTED] [KEYWORD_REDACTED] [KEYWORD_REDACTED]" + assert "Keyword01" not in result[0] + assert "Keyword02" not in result[0] + + @pytest.mark.asyncio + async def test_apply_guardrail_masks_multiple_keywords_different_order(self): + """ + Test that keyword order in input doesn't affect masking all keywords. + + Additional test for GitHub issue #17517. + """ + blocked_words = [ + BlockedWord( + keyword="keyword01", + action=ContentFilterAction.MASK, + ), + BlockedWord( + keyword="keyword02", + action=ContentFilterAction.MASK, + ), + ] + + guardrail = ContentFilterGuardrail( + guardrail_name="test-multiple-keywords-order", + blocked_words=blocked_words, + ) + + # Test with keyword02 appearing first + guardrailed_inputs = await guardrail.apply_guardrail( + inputs={"texts": ["Keyword02 Keyword01 Keyword02"]}, + request_data={}, + input_type="request", + ) + result = guardrailed_inputs.get("texts", []) + + assert result is not None + assert len(result) == 1 + assert result[0] == "[KEYWORD_REDACTED] [KEYWORD_REDACTED] [KEYWORD_REDACTED]" + + @pytest.mark.asyncio + async def test_apply_guardrail_blocks_on_any_blocked_keyword(self): + """ + Test that if any keyword has BLOCK action, it blocks even if others have MASK. + """ + blocked_words = [ + BlockedWord( + keyword="safe_word", + action=ContentFilterAction.MASK, + ), + BlockedWord( + keyword="danger_word", + action=ContentFilterAction.BLOCK, + ), + ] + + guardrail = ContentFilterGuardrail( + guardrail_name="test-block-priority", + blocked_words=blocked_words, + ) + + # Should block when danger_word is present, even if safe_word is also there + with pytest.raises(HTTPException) as exc_info: + await guardrail.apply_guardrail( + inputs={"texts": ["safe_word and danger_word together"]}, + request_data={}, + input_type="request", + ) + + assert exc_info.value.status_code == 400 + assert "danger_word" in str(exc_info.value.detail) From 8776336c3c61e4d647a364b2cde340639a50da45 Mon Sep 17 00:00:00 2001 From: Krish Dholakia Date: Thu, 4 Dec 2025 21:51:56 -0800 Subject: [PATCH 050/178] Enable detailed debugging for reference (#17508) * Deprecate set_verbose in favor of LITELLM_LOG Co-authored-by: krrishdholakia * Update debugging documentation links Co-authored-by: krrishdholakia --------- Co-authored-by: Cursor Agent --- docs/my-website/docs/proxy/config_settings.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/my-website/docs/proxy/config_settings.md b/docs/my-website/docs/proxy/config_settings.md index b71e100e157..d4a522f055c 100644 --- a/docs/my-website/docs/proxy/config_settings.md +++ b/docs/my-website/docs/proxy/config_settings.md @@ -29,7 +29,8 @@ litellm_settings: request_timeout: 10 # (int) llm requesttimeout in seconds. Raise Timeout error if call takes longer than 10s. Sets litellm.request_timeout force_ipv4: boolean # If true, litellm will force ipv4 for all LLM requests. Some users have seen httpx ConnectionError when using ipv6 + Anthropic API - set_verbose: boolean # sets litellm.set_verbose=True to view verbose debug logs. DO NOT LEAVE THIS ON IN PRODUCTION + # Debugging - see debugging docs for more options + # Use `--debug` or `--detailed_debug` CLI flags, or set LITELLM_LOG env var to "INFO", "DEBUG", or "ERROR" json_logs: boolean # if true, logs will be in json format # Fallbacks, reliability @@ -171,7 +172,7 @@ router_settings: | redact_user_api_key_info | boolean | If true, redacts information about the user api key from logs [Proxy Logging](logging#redacting-userapikeyinfo) | | mcp_aliases | object | Maps friendly aliases to MCP server names for easier tool access. Only the first alias for each server is used. [MCP Aliases](../mcp#mcp-aliases) | | langfuse_default_tags | array of strings | Default tags for Langfuse Logging. Use this if you want to control which LiteLLM-specific fields are logged as tags by the LiteLLM proxy. By default LiteLLM Proxy logs no LiteLLM-specific fields as tags. [Further docs](./logging#litellm-specific-tags-on-langfuse---cache_hit-cache_key) | -| set_verbose | boolean | If true, sets litellm.set_verbose=True to view verbose debug logs. DO NOT LEAVE THIS ON IN PRODUCTION | +| set_verbose | boolean | [DEPRECATED - see debugging docs](./debugging) Use `--debug` or `--detailed_debug` CLI flags, or set `LITELLM_LOG` env var to "INFO", "DEBUG", or "ERROR" instead. | | json_logs | boolean | If true, logs will be in json format. If you need to store the logs as JSON, just set the `litellm.json_logs = True`. We currently just log the raw POST request from litellm as a JSON [Further docs](./debugging) | | default_fallbacks | array of strings | List of fallback models to use if a specific model group is misconfigured / bad. [Further docs](./reliability#default-fallbacks) | | request_timeout | integer | The timeout for requests in seconds. If not set, the default value is `6000 seconds`. [For reference OpenAI Python SDK defaults to `600 seconds`.](https://github.com/openai/openai-python/blob/main/src/openai/_constants.py) | @@ -333,7 +334,7 @@ router_settings: | caching_groups | Optional[List[tuple]] | List of model groups for caching across model groups. Defaults to None. - e.g. caching_groups=[("openai-gpt-3.5-turbo", "azure-gpt-3.5-turbo")]| | alerting_config | AlertingConfig | [SDK-only arg] Slack alerting configuration. Defaults to None. [Further Docs](../routing.md#alerting-) | | assistants_config | AssistantsConfig | Set on proxy via `assistant_settings`. [Further docs](../assistants.md) | -| set_verbose | boolean | [DEPRECATED PARAM - see debug docs](./debugging.md) If true, sets the logging level to verbose. | +| set_verbose | boolean | [DEPRECATED PARAM - see debug docs](./debugging) If true, sets the logging level to verbose. | | retry_after | int | Time to wait before retrying a request in seconds. Defaults to 0. If `x-retry-after` is received from LLM API, this value is overridden. | | provider_budget_config | ProviderBudgetConfig | Provider budget configuration. Use this to set llm_provider budget limits. example $100/day to OpenAI, $100/day to Azure, etc. Defaults to None. [Further Docs](./provider_budget_routing.md) | | enable_pre_call_checks | boolean | If true, checks if a call is within the model's context window before making the call. [More information here](reliability) | @@ -798,7 +799,7 @@ router_settings: | SEND_USER_API_KEY_ALIAS | Flag to send user API key alias to Zscaler AI Guard. Default is False | SEND_USER_API_KEY_TEAM_ID | Flag to send user API key team ID to Zscaler AI Guard. Default is False | SEND_USER_API_KEY_USER_ID | Flag to send user API key user ID to Zscaler AI Guard. Default is False -| SET_VERBOSE | Flag to enable verbose logging +| SET_VERBOSE | [DEPRECATED] Use `LITELLM_LOG` instead with values "INFO", "DEBUG", or "ERROR". See [debugging docs](./debugging) | SINGLE_DEPLOYMENT_TRAFFIC_FAILURE_THRESHOLD | Minimum number of requests to consider "reasonable traffic" for single-deployment cooldown logic. Default is 1000 | SLACK_DAILY_REPORT_FREQUENCY | Frequency of daily Slack reports (e.g., daily, weekly) | SLACK_WEBHOOK_URL | Webhook URL for Slack integration From 63fae7949371786125a2e5c92aaf44570481af4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20Br=C3=BCnn?= <11316874+kristianmitk@users.noreply.github.com> Date: Fri, 5 Dec 2025 06:52:57 +0100 Subject: [PATCH 051/178] fix(sql): Optimize SpendLogs queries to use timestamp filtering for index usage (#17504) * fix: optimize SpendLogs queries to use timestamp filtering (#17487) * use timestamptz & enhance test --- .../analytics_endpoints.py | 2 +- .../spend_management_endpoints.py | 34 ++++---- .../spend_tracking/spend_tracking_utils.py | 2 +- .../test_spend_query_optimization.py | 84 +++++++++++++++++++ 4 files changed, 102 insertions(+), 20 deletions(-) create mode 100644 tests/test_litellm/proxy/spend_tracking/test_spend_query_optimization.py diff --git a/litellm/proxy/analytics_endpoints/analytics_endpoints.py b/litellm/proxy/analytics_endpoints/analytics_endpoints.py index f929cb74e40..4752593742c 100644 --- a/litellm/proxy/analytics_endpoints/analytics_endpoints.py +++ b/litellm/proxy/analytics_endpoints/analytics_endpoints.py @@ -84,7 +84,7 @@ async def get_global_activity( FROM "LiteLLM_SpendLogs" sl LEFT JOIN "LiteLLM_VerificationToken" vt ON sl."api_key" = vt."token" WHERE - sl."startTime" BETWEEN $1::date AND $2::date + interval '1 day' + sl."startTime" >= $1::timestamptz AND "startTime" < ($2::timestamptz + INTERVAL \'1 day\') GROUP BY vt."key_alias", sl."call_type", diff --git a/litellm/proxy/spend_tracking/spend_management_endpoints.py b/litellm/proxy/spend_tracking/spend_management_endpoints.py index 2d3fc023a39..5be9d9bab3c 100644 --- a/litellm/proxy/spend_tracking/spend_management_endpoints.py +++ b/litellm/proxy/spend_tracking/spend_management_endpoints.py @@ -213,7 +213,7 @@ async def get_global_activity_internal_user( COUNT(*) AS api_requests, SUM(total_tokens) AS total_tokens FROM "LiteLLM_SpendLogs" - WHERE "startTime" BETWEEN $1::date AND $2::date + interval '1 day' + WHERE "startTime" >= $1::timestamptz AND "startTime" < ($2::timestamptz + INTERVAL \'1 day\') AND "user" = $3 GROUP BY date_trunc('day', "startTime") """ @@ -297,7 +297,7 @@ async def get_global_activity( COUNT(*) AS api_requests, SUM(total_tokens) AS total_tokens FROM "LiteLLM_SpendLogs" - WHERE "startTime" BETWEEN $1::date AND $2::date + interval '1 day' + WHERE "startTime" >= $1::timestamptz AND "startTime" < ($2::timestamptz + INTERVAL \'1 day\') GROUP BY date_trunc('day', "startTime") """ db_response = await prisma_client.db.query_raw( @@ -356,7 +356,7 @@ async def get_global_activity_model_internal_user( COUNT(*) AS api_requests, SUM(total_tokens) AS total_tokens FROM "LiteLLM_SpendLogs" - WHERE "startTime" BETWEEN $1::date AND $2::date + interval '1 day' + WHERE "startTime" >= $1::timestamptz AND "startTime" < ($2::timestamptz + INTERVAL \'1 day\') AND "user" = $3 GROUP BY model_group, date_trunc('day', "startTime") """ @@ -464,7 +464,7 @@ async def get_global_activity_model( COUNT(*) AS api_requests, SUM(total_tokens) AS total_tokens FROM "LiteLLM_SpendLogs" - WHERE "startTime" BETWEEN $1::date AND $2::date + interval '1 day' + WHERE "startTime" >= $1::timestamptz AND "startTime" < ($2::timestamptz + INTERVAL \'1 day\') GROUP BY model_group, date_trunc('day', "startTime") """ db_response = await prisma_client.db.query_raw( @@ -609,8 +609,7 @@ async def get_global_activity_exceptions_per_deployment( FROM "LiteLLM_ErrorLogs" WHERE - "startTime" >= $1::date - AND "startTime" < ($2::date + INTERVAL '1 day') + "startTime" >= $1::timestamptz AND "startTime" < ($2::timestamptz + INTERVAL \'1 day\') AND model_group = $3 AND status_code = '429' GROUP BY @@ -741,8 +740,7 @@ async def get_global_activity_exceptions( FROM "LiteLLM_ErrorLogs" WHERE - "startTime" >= $1::date - AND "startTime" < ($2::date + INTERVAL '1 day') + "startTime" >= $1::timestamptz AND "startTime" < ($2::timestamptz + INTERVAL \'1 day\') AND model_group = $3 AND status_code = '429' GROUP BY @@ -855,7 +853,7 @@ async def get_global_spend_provider( model_id, SUM(spend) AS spend FROM "LiteLLM_SpendLogs" - WHERE "startTime" BETWEEN $1::date AND $2::date + WHERE "startTime" >= $1::timestamptz AND "startTime" < ($2::timestamptz + INTERVAL \'1 day\') AND length(model_id) > 0 AND "user" = $3 GROUP BY model_id @@ -869,7 +867,7 @@ async def get_global_spend_provider( model_id, SUM(spend) AS spend FROM "LiteLLM_SpendLogs" - WHERE "startTime" BETWEEN $1::date AND $2::date AND length(model_id) > 0 + WHERE "startTime" >= $1::timestamptz AND "startTime" < ($2::timestamptz + INTERVAL \'1 day\') AND length(model_id) > 0 GROUP BY model_id """ db_response = await prisma_client.db.query_raw( @@ -1019,7 +1017,7 @@ async def get_global_spend_report( FROM "LiteLLM_SpendLogs" sl WHERE - sl."startTime" BETWEEN $1::date AND $2::date AND sl.api_key = $3 + sl."startTime" >= $1::timestamptz AND "startTime" < ($2::timestamptz + INTERVAL \'1 day\') AND sl.api_key = $3 GROUP BY sl.api_key, sl.model @@ -1064,7 +1062,7 @@ async def get_global_spend_report( FROM "LiteLLM_SpendLogs" sl WHERE - sl."startTime" BETWEEN $1::date AND $2::date AND sl.user = $3 + sl."startTime" >= $1::timestamptz AND "startTime" < ($2::timestamptz + INTERVAL \'1 day\') AND sl.user = $3 GROUP BY sl.api_key, sl.model @@ -1118,7 +1116,7 @@ async def get_global_spend_report( ON sl.team_id = tt.team_id WHERE - sl."startTime" BETWEEN $1::date AND $2::date + sl."startTime" >= $1::timestamptz AND "startTime" < ($2::timestamptz + INTERVAL \'1 day\') GROUP BY date_trunc('day', sl."startTime"), tt.team_alias, @@ -1177,7 +1175,7 @@ async def get_global_spend_report( FROM "LiteLLM_SpendLogs" sl WHERE - sl."startTime" BETWEEN $1::date AND $2::date + sl."startTime" >= $1::timestamptz AND "startTime" < ($2::timestamptz + INTERVAL \'1 day\') GROUP BY date_trunc('day', sl."startTime"), customer, @@ -1234,7 +1232,7 @@ async def get_global_spend_report( FROM "LiteLLM_SpendLogs" sl WHERE - sl."startTime" BETWEEN $1::date AND $2::date + sl."startTime" >= $1::timestamptz AND "startTime" < ($2::timestamptz + INTERVAL \'1 day\') GROUP BY sl.api_key, sl.model @@ -1442,7 +1440,7 @@ async def _get_spend_report_for_time_range( jsonb_array_elements_text(request_tags) AS individual_request_tag, SUM(spend) AS total_spend FROM "LiteLLM_SpendLogs" - WHERE "startTime" >= $1::date AND "startTime" < ($2::date + INTERVAL '1 day') + WHERE "startTime" >= $1::timestamptz AND "startTime" < ($2::timestamptz + INTERVAL \'1 day\') GROUP BY individual_request_tag ORDER BY total_spend DESC; """ @@ -2683,8 +2681,8 @@ async def global_spend_end_users(data: Optional[GlobalEndUsersSpend] = None): sql_query = """ SELECT end_user, COUNT(*) AS total_count, SUM(spend) AS total_spend FROM "LiteLLM_SpendLogs" -WHERE "startTime" >= $1::timestamp - AND "startTime" < $2::timestamp +WHERE "startTime" >= $1::timestamptz + AND "startTime" < $2::timestamptz AND ( CASE WHEN $3::TEXT IS NULL THEN TRUE diff --git a/litellm/proxy/spend_tracking/spend_tracking_utils.py b/litellm/proxy/spend_tracking/spend_tracking_utils.py index a5ad105c3ba..ec379df7114 100644 --- a/litellm/proxy/spend_tracking/spend_tracking_utils.py +++ b/litellm/proxy/spend_tracking/spend_tracking_utils.py @@ -483,7 +483,7 @@ async def get_spend_by_team_and_customer( ON sl.team_id = tt.team_id WHERE - sl."startTime" BETWEEN $1::date AND $2::date + sl."startTime" >= $1::timestamptz AND sl."startTime" < ($2::timestamptz + INTERVAL '1 day') AND sl.team_id = $3 AND sl.end_user = $4 GROUP BY diff --git a/tests/test_litellm/proxy/spend_tracking/test_spend_query_optimization.py b/tests/test_litellm/proxy/spend_tracking/test_spend_query_optimization.py new file mode 100644 index 00000000000..f65c958b3db --- /dev/null +++ b/tests/test_litellm/proxy/spend_tracking/test_spend_query_optimization.py @@ -0,0 +1,84 @@ +""" +Test that spend queries use timestamp filtering instead of date casting. + +This prevents the performance issue where date casting prevents index usage. +GitHub Issue: #17487 +""" + +import datetime +import os +import sys +from datetime import timezone +from unittest.mock import AsyncMock, MagicMock + +import pytest + +sys.path.insert(0, os.path.abspath("../../../..")) + +from litellm.proxy.spend_tracking.spend_tracking_utils import ( + get_spend_by_team_and_customer, +) + + +@pytest.mark.asyncio +async def test_spend_query_uses_timestamp_filtering(): + """ + Test that spend queries use timestamp filtering for index optimization. + + Verifies: + 1. SQL does NOT cast the startTime column to DATE (which prevents index usage) + 2. SQL uses >= and < operators with INTERVAL for timestamp range filtering + 3. Parameters passed are datetime objects (not date objects) + """ + # Mock prisma client + mock_prisma = MagicMock() + mock_db = MagicMock() + mock_query_raw = AsyncMock(return_value=[]) + mock_db.query_raw = mock_query_raw + mock_prisma.db = mock_db + + # Use timezone-aware datetime objects + start_date = datetime.datetime(2024, 1, 1, tzinfo=timezone.utc) + end_date = datetime.datetime(2024, 1, 31, tzinfo=timezone.utc) + + # Call the function + await get_spend_by_team_and_customer( + start_date=start_date, + end_date=end_date, + team_id="test_team", + customer_id="test_customer", + prisma_client=mock_prisma, + ) + + # Verify the query was called + assert mock_query_raw.called, "query_raw should have been called" + + # Extract SQL and parameters + # Prisma query_raw is called like: query_raw(sql, param1, param2, ...) + call_args = mock_query_raw.call_args[0] + sql = call_args[0] + params = call_args[1:] + + # 1) SQL should NOT cast the startTime column to DATE (prevents index usage) + assert "::date" not in sql.lower(), \ + "SQL should not use '::date' casting which prevents index usage" + assert "date(" not in sql.lower(), \ + "SQL should not use DATE() function which prevents index usage" + + # 2) SQL should use timestamp-range filtering pattern for index optimization + assert '"startTime" >=' in sql or '"startTime">=' in sql, \ + "SQL should use >= operator for lower bound" + assert '"startTime" <' in sql or '"startTime"<' in sql, \ + "SQL should use < operator for upper bound" + assert "interval '1 day'" in sql.lower(), \ + "SQL should use INTERVAL for date arithmetic" + + # 3) Parameters should be datetime objects (not date objects) + assert isinstance(params[0], datetime.datetime), \ + "First parameter (start_date) should be datetime object" + assert isinstance(params[1], datetime.datetime), \ + "Second parameter (end_date) should be datetime object" + assert params[0].tzinfo is not None, \ + "start_date should be timezone-aware" + assert params[1].tzinfo is not None, \ + "end_date should be timezone-aware" From 8da265b9019aaa4ca757fb99d9838af2d1776c21 Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Thu, 4 Dec 2025 21:59:43 -0800 Subject: [PATCH 052/178] Fix select in edit membership --- .../organization/organization_view.tsx | 2 +- .../components/team/EditMembership.test.tsx | 72 +++++++++++++++++++ ...edit_membership.tsx => EditMembership.tsx} | 17 +++-- .../src/components/team/team_info.tsx | 4 +- 4 files changed, 83 insertions(+), 12 deletions(-) create mode 100644 ui/litellm-dashboard/src/components/team/EditMembership.test.tsx rename ui/litellm-dashboard/src/components/team/{edit_membership.tsx => EditMembership.tsx} (93%) diff --git a/ui/litellm-dashboard/src/components/organization/organization_view.tsx b/ui/litellm-dashboard/src/components/organization/organization_view.tsx index 76f5e81b2fc..962ec6fa4ea 100644 --- a/ui/litellm-dashboard/src/components/organization/organization_view.tsx +++ b/ui/litellm-dashboard/src/components/organization/organization_view.tsx @@ -39,7 +39,7 @@ import { } from "../networking"; import ObjectPermissionsView from "../object_permissions_view"; import NumericalInput from "../shared/numerical_input"; -import MemberModal from "../team/edit_membership"; +import MemberModal from "../team/EditMembership"; import VectorStoreSelector from "../vector_store_management/VectorStoreSelector"; interface OrganizationInfoProps { diff --git a/ui/litellm-dashboard/src/components/team/EditMembership.test.tsx b/ui/litellm-dashboard/src/components/team/EditMembership.test.tsx new file mode 100644 index 00000000000..03837ac7ff1 --- /dev/null +++ b/ui/litellm-dashboard/src/components/team/EditMembership.test.tsx @@ -0,0 +1,72 @@ +import { act, fireEvent, screen, waitFor } from "@testing-library/react"; +import { describe, expect, it, vi } from "vitest"; +import { renderWithProviders } from "../../../tests/test-utils"; +import EditMembership from "./EditMembership"; + +describe("EditMembership", () => { + const mockOnCancel = vi.fn(); + const mockOnSubmit = vi.fn(); + + const defaultConfig = { + title: "Add Member", + roleOptions: [ + { label: "Admin", value: "admin" }, + { label: "Member", value: "member" }, + ], + defaultRole: "member", + showEmail: true, + showUserId: false, + }; + + it("should render", () => { + renderWithProviders( + , + ); + + expect(screen.getByRole("dialog")).toBeInTheDocument(); + expect(screen.getByLabelText("Email")).toBeInTheDocument(); + expect(screen.getByLabelText("Role")).toBeInTheDocument(); + }); + + it("should submit form data when adding a member", async () => { + renderWithProviders( + , + ); + + const emailInput = screen.getByPlaceholderText("user@example.com"); + const submitButton = screen.getByRole("button", { name: "Add Member" }); + + act(() => { + fireEvent.change(emailInput, { target: { value: "test@example.com" } }); + }); + + await waitFor(() => { + expect(emailInput).toHaveValue("test@example.com"); + }); + + act(() => { + fireEvent.click(submitButton); + }); + + await waitFor(() => { + expect(mockOnSubmit).toHaveBeenCalledWith( + expect.objectContaining({ + user_email: "test@example.com", + role: "member", + }), + ); + }); + }); +}); diff --git a/ui/litellm-dashboard/src/components/team/edit_membership.tsx b/ui/litellm-dashboard/src/components/team/EditMembership.tsx similarity index 93% rename from ui/litellm-dashboard/src/components/team/edit_membership.tsx rename to ui/litellm-dashboard/src/components/team/EditMembership.tsx index 93142599aca..e201075cf41 100644 --- a/ui/litellm-dashboard/src/components/team/edit_membership.tsx +++ b/ui/litellm-dashboard/src/components/team/EditMembership.tsx @@ -1,7 +1,6 @@ +import { Text, TextInput } from "@tremor/react"; +import { Button as AntButton, Form, Modal, Select } from "antd"; import React, { useEffect } from "react"; -import { Modal, Form, Button as AntButton } from "antd"; -import { Select, SelectItem, TextInput } from "@tremor/react"; -import { Text } from "@tremor/react"; import NumericalInput from "../shared/numerical_input"; interface BaseMember { @@ -135,9 +134,9 @@ const MemberModal = ({ return ( ); @@ -199,14 +198,14 @@ const MemberModal = ({ // Then all other roles ...config.roleOptions.filter((option) => option.value !== initialData.role), ].map((option) => ( - + {option.label} - + )) : config.roleOptions.map((option) => ( - + {option.label} - + ))} diff --git a/ui/litellm-dashboard/src/components/team/team_info.tsx b/ui/litellm-dashboard/src/components/team/team_info.tsx index e9e5e6f640d..f2ca96c9d69 100644 --- a/ui/litellm-dashboard/src/components/team/team_info.tsx +++ b/ui/litellm-dashboard/src/components/team/team_info.tsx @@ -32,20 +32,20 @@ import { Button, Form, Input, message, Select, Switch, Tooltip } from "antd"; import { CheckIcon, CopyIcon } from "lucide-react"; import React, { useEffect, useMemo, useState } from "react"; import { copyToClipboard as utilCopyToClipboard } from "../../utils/dataUtils"; +import AgentSelector from "../agent_management/AgentSelector"; import DeleteResourceModal from "../common_components/DeleteResourceModal"; import PassThroughRoutesSelector from "../common_components/PassThroughRoutesSelector"; import { getModelDisplayName, unfurlWildcardModelsInList } from "../key_team_helpers/fetch_available_models_team_key"; import LoggingSettingsView from "../logging_settings_view"; import MCPServerSelector from "../mcp_server_management/MCPServerSelector"; import MCPToolPermissions from "../mcp_server_management/MCPToolPermissions"; -import AgentSelector from "../agent_management/AgentSelector"; import NotificationsManager from "../molecules/notifications_manager"; import { fetchMCPAccessGroups } from "../networking"; import ObjectPermissionsView from "../object_permissions_view"; import NumericalInput from "../shared/numerical_input"; import VectorStoreSelector from "../vector_store_management/VectorStoreSelector"; -import MemberModal from "./edit_membership"; import EditLoggingSettings from "./EditLoggingSettings"; +import MemberModal from "./EditMembership"; import MemberPermissions from "./member_permissions"; import TeamMembersComponent from "./team_member_view"; From 316f7671a9e6c7164e65c809038e0102073bc42f Mon Sep 17 00:00:00 2001 From: Cesar Garcia <128240629+Chesars@users.noreply.github.com> Date: Fri, 5 Dec 2025 03:01:59 -0300 Subject: [PATCH 053/178] fix(gemini): handle partial JSON chunks after first valid chunk (#17496) * fix(gemini): allow JSON accumulation on any chunk, not just first * test(gemini): add tests for partial JSON chunk handling --- .../vertex_and_google_ai_studio_gemini.py | 13 ++-- ...test_vertex_and_google_ai_studio_gemini.py | 59 +++++++++++++++++++ 2 files changed, 65 insertions(+), 7 deletions(-) diff --git a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py index 665661b9d22..a4c4f8bb3f7 100644 --- a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py +++ b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py @@ -2589,13 +2589,12 @@ class ModelResponseIterator: try: json_chunk = json.loads(chunk) - except json.JSONDecodeError as e: - if ( - self.sent_first_chunk is False - ): # only check for accumulated json, on first chunk, else raise error. Prevent real errors from being masked. - self.chunk_type = "accumulated_json" - return self.handle_accumulated_json_chunk(chunk=chunk) - raise e + except json.JSONDecodeError: + # Switch to accumulation mode for partial JSON chunks + # This can happen at any point due to network fragmentation, not just first chunk + # See: https://github.com/BerriAI/litellm/issues/16562 + self.chunk_type = "accumulated_json" + return self.handle_accumulated_json_chunk(chunk=chunk) if self.sent_first_chunk is False: self.sent_first_chunk = True diff --git a/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py b/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py index 2b305dbade1..89e35ecacd5 100644 --- a/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py +++ b/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py @@ -2062,3 +2062,62 @@ def test_gemini_image_models_excluded_from_thinking(): # None of these should have thinkingConfig assert "thinkingConfig" not in result, f"Model {model} should not have thinkingConfig" + +def test_partial_json_chunk_after_first_chunk(): + """ + Test that partial JSON chunks are handled correctly even AFTER the first chunk. + + This tests the fix for: + - https://github.com/BerriAI/litellm/issues/16562 + - https://github.com/BerriAI/litellm/issues/16037 + - https://github.com/BerriAI/litellm/issues/14747 + - https://github.com/BerriAI/litellm/issues/10410 + - https://github.com/BerriAI/litellm/issues/5650 + + The bug was that accumulation mode only activated on the first chunk. + If chunk 1 was valid and chunk 5 arrived partial, it would crash. + """ + from litellm.llms.vertex_ai.gemini.vertex_and_google_ai_studio_gemini import ( + ModelResponseIterator, + ) + + iterator = ModelResponseIterator( + streaming_response=MagicMock(), + sync_stream=True, + logging_obj=MagicMock(), + ) + + # First chunk arrives COMPLETE - this sets sent_first_chunk = True + first_chunk = '{"candidates": [{"content": {"parts": [{"text": "Hello"}]}}]}' + result1 = iterator.handle_valid_json_chunk(first_chunk) + assert result1 is not None, "First complete chunk should parse OK" + assert iterator.sent_first_chunk is True, "sent_first_chunk should be True after first chunk" + + # Later chunk arrives PARTIAL (simulating network fragmentation) + partial_chunk = '{"candidates": [{"content":' + result2 = iterator.handle_valid_json_chunk(partial_chunk) + + # Should switch to accumulation mode instead of crashing + assert result2 is None, "Partial chunk should return None while accumulating" + assert iterator.chunk_type == "accumulated_json", "Should switch to accumulated_json mode" + + +def test_partial_json_chunk_on_first_chunk(): + """Test that first chunk being partial still works (existing behavior).""" + from litellm.llms.vertex_ai.gemini.vertex_and_google_ai_studio_gemini import ( + ModelResponseIterator, + ) + + iterator = ModelResponseIterator( + streaming_response=MagicMock(), + sync_stream=True, + logging_obj=MagicMock(), + ) + + # First chunk is partial + partial = '{"candidates": [{"content":' + result = iterator.handle_valid_json_chunk(partial) + + assert result is None, "Partial first chunk should return None" + assert iterator.chunk_type == "accumulated_json", "Should switch to accumulated_json mode" + From 51cc102c30d82dfecad7df8745a0a2358391f532 Mon Sep 17 00:00:00 2001 From: Krish Dholakia Date: Thu, 4 Dec 2025 22:06:13 -0800 Subject: [PATCH 054/178] fix(unified_guardrail.py): support during_call event type for unified guardrails (#17514) * fix(unified_guardrail.py): support during_call event type for unified guardrails allows guardrails overriding apply_guardrails to work 'during_call' * feat(generic_guardrail_api.py): support new 'tool_calls' field for generic guardrail api returns the tool calls emitted by the LLM API to the user * fix(generic_guardrail_api.py): working anthropic /v1/messages tool call response send llm tool calls to guardrail api when called via `/v1/messages` API * fix(responses/): run generic_guardrail_api on responses api tool call responses * fix: fix tests * test: fix tests * fix: fix tests --- .../mock_bedrock_guardrail_server.py | 36 +--- .../transformation.py | 59 +----- .../chat/guardrail_translation/handler.py | 66 ++++-- litellm/llms/anthropic/chat/transformation.py | 132 +++++++----- .../chat/guardrail_translation/handler.py | 8 +- .../guardrail_translation/handler.py | 81 ++++++-- litellm/proxy/_new_secret_config.yaml | 2 +- .../generic_guardrail_api.py | 4 +- .../unified_guardrail/unified_guardrail.py | 46 ++++- litellm/proxy/utils.py | 18 +- .../transformation.py | 144 ++++++++++--- litellm/types/guardrails.py | 16 +- .../guardrail_hooks/generic_guardrail_api.py | 48 ++--- .../rerank/test_rerank_guardrail_handler.py | 28 +-- .../guardrail_translation/test_handler.py | 74 ++++++- .../test_text_completion_guardrail_handler.py | 21 +- ...test_image_generation_guardrail_handler.py | 14 +- ...test_openai_responses_guardrail_handler.py | 194 +++++++++++++++++- .../test_text_to_speech_guardrail_handler.py | 28 +-- ...t_audio_transcription_guardrail_handler.py | 28 +-- .../test_generic_guardrail_api.py | 2 +- 21 files changed, 738 insertions(+), 311 deletions(-) diff --git a/cookbook/mock_guardrail_server/mock_bedrock_guardrail_server.py b/cookbook/mock_guardrail_server/mock_bedrock_guardrail_server.py index fd53ece6604..b5c1b3fa0c8 100644 --- a/cookbook/mock_guardrail_server/mock_bedrock_guardrail_server.py +++ b/cookbook/mock_guardrail_server/mock_bedrock_guardrail_server.py @@ -361,41 +361,6 @@ async def health(): return {"status": "healthy"} -@app.post( - "/guardrail/{guardrailIdentifier}/version/{guardrailVersion}/apply", - response_model=BedrockGuardrailResponse, -) -async def apply_guardrail( - guardrailIdentifier: str, - guardrailVersion: str, - request: BedrockRequest, - token: str = Depends(verify_bearer_token), -) -> BedrockGuardrailResponse: - """ - Apply guardrail to input or output content. - - This endpoint mimics the AWS Bedrock ApplyGuardrail API. - - Args: - guardrailIdentifier: The guardrail ID - guardrailVersion: The guardrail version - request: The guardrail request containing content to analyze - token: Bearer token (verified by dependency) - - Returns: - BedrockGuardrailResponse with analysis results - """ - # Process the request - response, output_texts = process_guardrail_request(request) - - # Log the request (optional, for debugging) - print(f"Guardrail applied: {guardrailIdentifier} v{guardrailVersion}") - print(f"Source: {request.source}") - print(f"Action: {response.action}") - - return response - - """ LiteLLM exposes a basic guardrail API with the text extracted from the request and sent to the guardrail API, as well as the received request body for any further processing. @@ -427,6 +392,7 @@ class LitellmBasicGuardrailRequest(BaseModel): texts: List[str] images: Optional[List[str]] = None tools: Optional[List[dict]] = None + tool_calls: Optional[List[dict]] = None request_data: Dict[str, Any] = Field(default_factory=dict) additional_provider_specific_params: Dict[str, Any] = Field(default_factory=dict) input_type: Literal["request", "response"] diff --git a/litellm/completion_extras/litellm_responses_transformation/transformation.py b/litellm/completion_extras/litellm_responses_transformation/transformation.py index 2045836387f..c4233140b31 100644 --- a/litellm/completion_extras/litellm_responses_transformation/transformation.py +++ b/litellm/completion_extras/litellm_responses_transformation/transformation.py @@ -367,49 +367,14 @@ class LiteLLMResponsesTransformationHandler(CompletionTransformationBridge): reasoning_content = None # flush reasoning content index += 1 elif isinstance(item, ResponseFunctionToolCall): - - provider_specific_fields = getattr( - item, "provider_specific_fields", None + from litellm.responses.litellm_completion_transformation.transformation import ( + LiteLLMCompletionResponsesConfig, ) - if provider_specific_fields and not isinstance( - provider_specific_fields, dict - ): - provider_specific_fields = ( - dict(provider_specific_fields) - if hasattr(provider_specific_fields, "__dict__") - else {} - ) - elif hasattr(item, "get") and callable(item.get): # type: ignore - provider_fields = item.get("provider_specific_fields") # type: ignore - if provider_fields: - provider_specific_fields = ( - provider_fields - if isinstance(provider_fields, dict) - else ( - dict(provider_fields) # type: ignore - if hasattr(provider_fields, "__dict__") - else {} - ) - ) - function_dict: Dict[str, Any] = { - "name": item.name, - "arguments": item.arguments, - } - - if provider_specific_fields: - function_dict["provider_specific_fields"] = provider_specific_fields - - tool_call_dict: Dict[str, Any] = { - "id": item.call_id, - "function": function_dict, - "type": "function", - } - - if provider_specific_fields: - tool_call_dict["provider_specific_fields"] = ( - provider_specific_fields - ) + tool_call_dict = LiteLLMCompletionResponsesConfig.convert_response_function_tool_call_to_chat_completion_tool_call( + tool_call_item=item, + index=index, + ) msg = Message( content=None, @@ -718,17 +683,9 @@ class LiteLLMResponsesTransformationHandler(CompletionTransformationBridge): } } elif format_type == "json_object": - return { - "format": { - "type": "json_object" - } - } + return {"format": {"type": "json_object"}} elif format_type == "text": - return { - "format": { - "type": "text" - } - } + return {"format": {"type": "text"}} return None diff --git a/litellm/llms/anthropic/chat/guardrail_translation/handler.py b/litellm/llms/anthropic/chat/guardrail_translation/handler.py index 5969a76ed90..d8bede65f09 100644 --- a/litellm/llms/anthropic/chat/guardrail_translation/handler.py +++ b/litellm/llms/anthropic/chat/guardrail_translation/handler.py @@ -16,13 +16,17 @@ import json from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, cast from litellm._logging import verbose_proxy_logger +from litellm.llms.anthropic.chat.transformation import AnthropicConfig from litellm.llms.anthropic.experimental_pass_through.adapters.transformation import ( LiteLLMAnthropicMessagesAdapter, ) from litellm.llms.base_llm.guardrail_translation.base_translation import BaseTranslation from litellm.types.guardrails import GenericGuardrailAPIInputs from litellm.types.llms.anthropic import AllAnthropicToolsValues -from litellm.types.llms.openai import ChatCompletionToolParam +from litellm.types.llms.openai import ( + ChatCompletionToolCallChunk, + ChatCompletionToolParam, +) if TYPE_CHECKING: from litellm.integrations.custom_guardrail import CustomGuardrail @@ -209,7 +213,7 @@ class AnthropicMessagesHandler(BaseTranslation): user_api_key_dict: Optional[Any] = None, ) -> Any: """ - Process output response by applying guardrails to text content. + Process output response by applying guardrails to text content and tool calls. Args: response: Anthropic MessagesResponse object @@ -221,17 +225,15 @@ class AnthropicMessagesHandler(BaseTranslation): Modified response with guardrail applied to content Response Format Support: - - List content: response.content = [{"type": "text", "text": "text here"}, ...] + - List content: response.content = [ + {"type": "text", "text": "text here"}, + {"type": "tool_use", "id": "...", "name": "...", "input": {...}}, + ... + ] """ - # Step 0: Check if response has any text content to process - if not self._has_text_content(response): - verbose_proxy_logger.warning( - "Anthropic Messages: No text content in response, skipping guardrail" - ) - return response - texts_to_check: List[str] = [] images_to_check: List[str] = [] + tool_calls_to_check: List[ChatCompletionToolCallChunk] = [] task_mappings: List[Tuple[int, Optional[int]]] = [] # Track (content_index, None) for each text @@ -239,10 +241,13 @@ class AnthropicMessagesHandler(BaseTranslation): if not response_content: return response - # Step 1: Extract all text content from response + # Step 1: Extract all text content and tool calls from response for content_idx, content_block in enumerate(response_content): - # Check if this is a text block by checking the 'type' field - if isinstance(content_block, dict) and content_block.get("type") == "text": + # Check if this is a text or tool_use block by checking the 'type' field + if isinstance(content_block, dict) and content_block.get("type") in [ + "text", + "tool_use", + ]: # Cast to dict to handle the union type properly self._extract_output_text_and_images( content_block=cast(Dict[str, Any], content_block), @@ -250,10 +255,11 @@ class AnthropicMessagesHandler(BaseTranslation): texts_to_check=texts_to_check, images_to_check=images_to_check, task_mappings=task_mappings, + tool_calls_to_check=tool_calls_to_check, ) # Step 2: Apply guardrail to all texts in batch - if texts_to_check: + if texts_to_check or tool_calls_to_check: # Create a request_data dict with response info and user API key metadata request_data: dict = {"response": response} @@ -267,6 +273,9 @@ class AnthropicMessagesHandler(BaseTranslation): inputs = GenericGuardrailAPIInputs(texts=texts_to_check) if images_to_check: inputs["images"] = images_to_check + if tool_calls_to_check: + inputs["tool_calls"] = tool_calls_to_check + guardrailed_inputs = await guardrail_to_apply.apply_guardrail( inputs=inputs, request_data=request_data, @@ -419,17 +428,32 @@ class AnthropicMessagesHandler(BaseTranslation): texts_to_check: List[str], images_to_check: List[str], task_mappings: List[Tuple[int, Optional[int]]], + tool_calls_to_check: Optional[List[ChatCompletionToolCallChunk]] = None, ) -> None: """ - Extract text content and images from a response content block. + Extract text content, images, and tool calls from a response content block. - Override this method to customize text/image extraction logic. + Override this method to customize text/image/tool extraction logic. """ - content_text = content_block.get("text") - if content_text and isinstance(content_text, str): - # Simple string content - texts_to_check.append(content_text) - task_mappings.append((content_idx, None)) + content_type = content_block.get("type") + + # Extract text content + if content_type == "text": + content_text = content_block.get("text") + if content_text and isinstance(content_text, str): + # Simple string content + texts_to_check.append(content_text) + task_mappings.append((content_idx, None)) + + # Extract tool calls + elif content_type == "tool_use": + tool_call = AnthropicConfig.convert_tool_use_to_openai_format( + anthropic_tool_content=content_block, + index=content_idx, + ) + if tool_calls_to_check is None: + tool_calls_to_check = [] + tool_calls_to_check.append(tool_call) async def _apply_guardrail_responses_to_output( self, diff --git a/litellm/llms/anthropic/chat/transformation.py b/litellm/llms/anthropic/chat/transformation.py index bdc986ae27f..b477dbd457e 100644 --- a/litellm/llms/anthropic/chat/transformation.py +++ b/litellm/llms/anthropic/chat/transformation.py @@ -54,10 +54,7 @@ from litellm.types.utils import ( CompletionTokensDetailsWrapper, ) from litellm.types.utils import Message as LitellmMessage -from litellm.types.utils import ( - PromptTokensDetailsWrapper, - ServerToolUse, -) +from litellm.types.utils import PromptTokensDetailsWrapper, ServerToolUse from litellm.utils import ( ModelResponse, Usage, @@ -119,6 +116,36 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig): def get_config(cls): return super().get_config() + @staticmethod + def convert_tool_use_to_openai_format( + anthropic_tool_content: Dict[str, Any], + index: int, + ) -> ChatCompletionToolCallChunk: + """ + Convert Anthropic tool_use format to OpenAI ChatCompletionToolCallChunk format. + + Args: + anthropic_tool_content: Anthropic tool_use content block with format: + {"type": "tool_use", "id": "...", "name": "...", "input": {...}} + index: The index of this tool call + + Returns: + ChatCompletionToolCallChunk in OpenAI format + """ + tool_call = ChatCompletionToolCallChunk( + id=anthropic_tool_content["id"], + type="function", + function=ChatCompletionToolCallFunctionChunk( + name=anthropic_tool_content["name"], + arguments=json.dumps(anthropic_tool_content["input"]), + ), + index=index, + ) + # Include caller information if present (for programmatic tool calling) + if "caller" in anthropic_tool_content: + tool_call["caller"] = cast(Dict[str, Any], anthropic_tool_content["caller"]) # type: ignore[typeddict-item] + return tool_call + def _is_claude_opus_4_5(self, model: str) -> bool: """Check if the model is Claude Opus 4.5.""" return "opus-4-5" in model.lower() or "opus_4_5" in model.lower() @@ -279,7 +306,7 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig): elif tool["type"] == "tool_search_tool_regex_20251119": # Tool search tool using regex from litellm.types.llms.anthropic import AnthropicToolSearchToolRegex - + tool_name_obj = tool.get("name", "tool_search_tool_regex") if not isinstance(tool_name_obj, str): raise ValueError("Tool search tool must have a valid name") @@ -291,7 +318,7 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig): elif tool["type"] == "tool_search_tool_bm25_20251119": # Tool search tool using BM25 from litellm.types.llms.anthropic import AnthropicToolSearchToolBM25 - + tool_name_obj = tool.get("name", "tool_search_tool_bm25") if not isinstance(tool_name_obj, str): raise ValueError("Tool search tool must have a valid name") @@ -309,7 +336,10 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig): if returned_tool is not None: # Only set cache_control on tools that support it (not tool search tools) tool_type = returned_tool.get("type", "") - if tool_type not in ("tool_search_tool_regex_20251119", "tool_search_tool_bm25_20251119"): + if tool_type not in ( + "tool_search_tool_regex_20251119", + "tool_search_tool_bm25_20251119", + ): if _cache_control is not None: returned_tool["cache_control"] = _cache_control # type: ignore[typeddict-item] elif _cache_control_function is not None and isinstance( @@ -318,14 +348,19 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig): returned_tool["cache_control"] = ChatCompletionCachedContent( # type: ignore[typeddict-item] **_cache_control_function # type: ignore ) - + ## check if defer_loading is set in the tool _defer_loading = tool.get("defer_loading", None) _defer_loading_function = tool.get("function", {}).get("defer_loading", None) if returned_tool is not None: # Only set defer_loading on tools that support it (not tool search tools or computer tools) tool_type = returned_tool.get("type", "") - if tool_type not in ("tool_search_tool_regex_20251119", "tool_search_tool_bm25_20251119", "computer_20241022", "computer_20250124"): + if tool_type not in ( + "tool_search_tool_regex_20251119", + "tool_search_tool_bm25_20251119", + "computer_20241022", + "computer_20250124", + ): if _defer_loading is not None: if not isinstance(_defer_loading, bool): raise ValueError("defer_loading must be a boolean") @@ -334,14 +369,21 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig): if not isinstance(_defer_loading_function, bool): raise ValueError("defer_loading must be a boolean") returned_tool["defer_loading"] = _defer_loading_function # type: ignore[typeddict-item] - + ## check if allowed_callers is set in the tool _allowed_callers = tool.get("allowed_callers", None) - _allowed_callers_function = tool.get("function", {}).get("allowed_callers", None) + _allowed_callers_function = tool.get("function", {}).get( + "allowed_callers", None + ) if returned_tool is not None: # Only set allowed_callers on tools that support it (not tool search tools or computer tools) tool_type = returned_tool.get("type", "") - if tool_type not in ("tool_search_tool_regex_20251119", "tool_search_tool_bm25_20251119", "computer_20241022", "computer_20250124"): + if tool_type not in ( + "tool_search_tool_regex_20251119", + "tool_search_tool_bm25_20251119", + "computer_20241022", + "computer_20250124", + ): if _allowed_callers is not None: if not isinstance(_allowed_callers, list) or not all( isinstance(item, str) for item in _allowed_callers @@ -354,7 +396,7 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig): ): raise ValueError("allowed_callers must be a list of strings") returned_tool["allowed_callers"] = _allowed_callers_function # type: ignore[typeddict-item] - + ## check if input_examples is set in the tool _input_examples = tool.get("input_examples", None) _input_examples_function = tool.get("function", {}).get("input_examples", None) @@ -423,31 +465,32 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig): """Check if tool search tools are present in the tools list.""" if not tools: return False - + for tool in tools: tool_type = tool.get("type", "") - if tool_type in ["tool_search_tool_regex_20251119", "tool_search_tool_bm25_20251119"]: + if tool_type in [ + "tool_search_tool_regex_20251119", + "tool_search_tool_bm25_20251119", + ]: return True return False - def _separate_deferred_tools( - self, tools: List - ) -> Tuple[List, List]: + def _separate_deferred_tools(self, tools: List) -> Tuple[List, List]: """ Separate tools into deferred and non-deferred lists. - + Returns: Tuple of (non_deferred_tools, deferred_tools) """ non_deferred = [] deferred = [] - + for tool in tools: if tool.get("defer_loading", False): deferred.append(tool) else: non_deferred.append(tool) - + return non_deferred, deferred def _expand_tool_references( @@ -457,28 +500,28 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig): ) -> List: """ Expand tool_reference blocks to full tool definitions. - + When Anthropic's tool search returns results, it includes tool_reference blocks that reference tools by name. This method expands those references to full tool definitions from the deferred_tools catalog. - + Args: content: Response content that may contain tool_reference blocks deferred_tools: List of deferred tools that can be referenced - + Returns: Content with tool_reference blocks expanded to full tool definitions """ if not deferred_tools: return content - + # Create a mapping of tool names to tool definitions tool_map = {} for tool in deferred_tools: tool_name = tool.get("name") or tool.get("function", {}).get("name") if tool_name: tool_map[tool_name] = tool - + # Expand tool references in content expanded_content = [] for item in content: @@ -492,7 +535,7 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig): expanded_content.append(item) else: expanded_content.append(item) - + return expanded_content def _map_stop_sequences( @@ -995,7 +1038,7 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig): "messages": anthropic_messages, **optional_params, } - + ## Handle output_config (Anthropic-specific parameter) if "output_config" in optional_params: output_config = optional_params.get("output_config") @@ -1054,34 +1097,20 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig): text_content += content["text"] ## TOOL CALLING elif content["type"] == "tool_use": - tool_call = ChatCompletionToolCallChunk( - id=content["id"], - type="function", - function=ChatCompletionToolCallFunctionChunk( - name=content["name"], - arguments=json.dumps(content["input"]), - ), + tool_call = AnthropicConfig.convert_tool_use_to_openai_format( + anthropic_tool_content=content, index=idx, ) - # Include caller information if present (for programmatic tool calling) - if "caller" in content: - tool_call["caller"] = cast(Dict[str, Any], content["caller"]) # type: ignore[typeddict-item] tool_calls.append(tool_call) ## SERVER TOOL USE (for tool search) elif content["type"] == "server_tool_use": # Server tool use blocks are for tool search - treat as tool calls - tool_call = ChatCompletionToolCallChunk( - id=content["id"], - type="function", - function=ChatCompletionToolCallFunctionChunk( - name=content["name"], - arguments=json.dumps(content.get("input", {})), - ), + # Note: using .get("input", {}) for server_tool_use as input may not be present + content_with_input = {**content, "input": content.get("input", {})} + tool_call = AnthropicConfig.convert_tool_use_to_openai_format( + anthropic_tool_content=content_with_input, index=idx, ) - # Include caller information if present (for programmatic tool calling) - if "caller" in content: - tool_call["caller"] = cast(Dict[str, Any], content["caller"]) # type: ignore[typeddict-item] tool_calls.append(tool_call) ## TOOL SEARCH TOOL RESULT (skip - this is metadata about tool discovery) elif content["type"] == "tool_search_tool_result": @@ -1122,7 +1151,10 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig): return text_content, citations, thinking_blocks, reasoning_content, tool_calls def calculate_usage( - self, usage_object: dict, reasoning_content: Optional[str], completion_response: Optional[dict] = None + self, + usage_object: dict, + reasoning_content: Optional[str], + completion_response: Optional[dict] = None, ) -> Usage: # NOTE: Sometimes the usage object has None set explicitly for token counts, meaning .get() & key access returns None, and we need to account for this prompt_tokens = usage_object.get("input_tokens", 0) or 0 @@ -1160,7 +1192,7 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig): tool_search_requests = cast( int, _usage["server_tool_use"]["tool_search_requests"] ) - + # Count tool_search_requests from content blocks if not in usage # Anthropic doesn't always include tool_search_requests in the usage object if tool_search_requests is None and completion_response is not None: diff --git a/litellm/llms/openai/chat/guardrail_translation/handler.py b/litellm/llms/openai/chat/guardrail_translation/handler.py index 76aa6f730c2..463b50beb5c 100644 --- a/litellm/llms/openai/chat/guardrail_translation/handler.py +++ b/litellm/llms/openai/chat/guardrail_translation/handler.py @@ -89,7 +89,7 @@ class OpenAIChatCompletionsHandler(BaseTranslation): ) guardrailed_texts = guardrailed_inputs.get("texts", []) - guardrailed_tool_calls = guardrailed_inputs.get("tools", []) + guardrailed_tool_calls = guardrailed_inputs.get("tool_calls", []) # Step 3: Map guardrail responses back to original message structure if guardrailed_texts and texts_to_check: @@ -155,7 +155,7 @@ class OpenAIChatCompletionsHandler(BaseTranslation): images_to_check.append(url) # Extract tool calls (typically in assistant messages) - tool_calls = message.get("tools", None) + tool_calls = message.get("tool_calls", None) if tool_calls is not None and isinstance(tool_calls, list): for tool_call_idx, tool_call in enumerate(tool_calls): if isinstance(tool_call, dict): @@ -261,7 +261,7 @@ class OpenAIChatCompletionsHandler(BaseTranslation): # Step 1: Extract all text content, images, and tool calls from response choices for choice_idx, choice in enumerate(response.choices): - self._extract_output_text_and_images( + self._extract_output_text_images_and_tool_calls( choice=choice, choice_idx=choice_idx, texts_to_check=texts_to_check, @@ -478,7 +478,7 @@ class OpenAIChatCompletionsHandler(BaseTranslation): return True return False - def _extract_output_text_and_images( + def _extract_output_text_images_and_tool_calls( self, choice: Union[Choices, StreamingChoices], choice_idx: int, diff --git a/litellm/llms/openai/responses/guardrail_translation/handler.py b/litellm/llms/openai/responses/guardrail_translation/handler.py index fb8b16817b2..2ab37f061fd 100644 --- a/litellm/llms/openai/responses/guardrail_translation/handler.py +++ b/litellm/llms/openai/responses/guardrail_translation/handler.py @@ -38,8 +38,15 @@ from litellm.responses.litellm_completion_transformation.transformation import ( LiteLLMCompletionResponsesConfig, ) from litellm.types.guardrails import GenericGuardrailAPIInputs -from litellm.types.llms.openai import ChatCompletionToolParam -from litellm.types.responses.main import GenericResponseOutputItem, OutputText +from litellm.types.llms.openai import ( + ChatCompletionToolCallChunk, + ChatCompletionToolParam, +) +from litellm.types.responses.main import ( + GenericResponseOutputItem, + OutputFunctionToolCall, + OutputText, +) if TYPE_CHECKING: from litellm.integrations.custom_guardrail import CustomGuardrail @@ -251,7 +258,7 @@ class OpenAIResponsesHandler(BaseTranslation): user_api_key_dict: Optional[Any] = None, ) -> Any: """ - Process output response by applying guardrails to text content. + Process output response by applying guardrails to text content and tool calls. Args: response: LiteLLM ResponsesAPIResponse object @@ -264,22 +271,19 @@ class OpenAIResponsesHandler(BaseTranslation): Response Format Support: - response.output is a list of output items - - Each output item has a content list with OutputText objects + - Each output item can be: + * GenericResponseOutputItem with a content list of OutputText objects + * OutputFunctionToolCall with tool call data - Each OutputText object has a text field """ - # Step 0: Check if response has any text content to process - if not self._has_text_content(response): - verbose_proxy_logger.warning( - "OpenAI Responses API: No text content in response, skipping guardrail" - ) - return response texts_to_check: List[str] = [] images_to_check: List[str] = [] + tool_calls_to_check: List[ChatCompletionToolCallChunk] = [] task_mappings: List[Tuple[int, int]] = [] # Track (output_item_index, content_index) for each text - # Step 1: Extract all text content from response output + # Step 1: Extract all text content and tool calls from response output for output_idx, output_item in enumerate(response.output): self._extract_output_text_and_images( output_item=output_item, @@ -287,10 +291,11 @@ class OpenAIResponsesHandler(BaseTranslation): texts_to_check=texts_to_check, images_to_check=images_to_check, task_mappings=task_mappings, + tool_calls_to_check=tool_calls_to_check, ) # Step 2: Apply guardrail to all texts in batch - if texts_to_check: + if texts_to_check or tool_calls_to_check: # Create a request_data dict with response info and user API key metadata request_data: dict = {"response": response} @@ -304,6 +309,9 @@ class OpenAIResponsesHandler(BaseTranslation): inputs = GenericGuardrailAPIInputs(texts=texts_to_check) if images_to_check: inputs["images"] = images_to_check + if tool_calls_to_check: + inputs["tool_calls"] = tool_calls_to_check + guardrailed_inputs = await guardrail_to_apply.apply_guardrail( inputs=inputs, request_data=request_data, @@ -398,12 +406,57 @@ class OpenAIResponsesHandler(BaseTranslation): texts_to_check: List[str], images_to_check: List[str], task_mappings: List[Tuple[int, int]], + tool_calls_to_check: Optional[List[ChatCompletionToolCallChunk]] = None, ) -> None: """ - Extract text content and images from a response output item. + Extract text content, images, and tool calls from a response output item. - Override this method to customize text/image extraction logic. + Override this method to customize text/image/tool extraction logic. """ + # Check if this is a tool call (OutputFunctionToolCall) + if isinstance(output_item, OutputFunctionToolCall): + if tool_calls_to_check is not None: + tool_call_dict = LiteLLMCompletionResponsesConfig.convert_response_function_tool_call_to_chat_completion_tool_call( + tool_call_item=output_item, + index=output_idx, + ) + tool_calls_to_check.append( + cast(ChatCompletionToolCallChunk, tool_call_dict) + ) + return + elif ( + isinstance(output_item, BaseModel) + and hasattr(output_item, "type") + and getattr(output_item, "type") == "function_call" + ): + if tool_calls_to_check is not None: + tool_call_dict = LiteLLMCompletionResponsesConfig.convert_response_function_tool_call_to_chat_completion_tool_call( + tool_call_item=output_item, + index=output_idx, + ) + tool_calls_to_check.append( + cast(ChatCompletionToolCallChunk, tool_call_dict) + ) + return + elif ( + isinstance(output_item, dict) and output_item.get("type") == "function_call" + ): + # Handle dict representation of tool call + if tool_calls_to_check is not None: + # Convert dict to OutputFunctionToolCall for processing + try: + tool_call_obj = OutputFunctionToolCall(**output_item) + tool_call_dict = LiteLLMCompletionResponsesConfig.convert_response_function_tool_call_to_chat_completion_tool_call( + tool_call_item=tool_call_obj, + index=output_idx, + ) + tool_calls_to_check.append( + cast(ChatCompletionToolCallChunk, tool_call_dict) + ) + except Exception: + pass + return + # Handle both GenericResponseOutputItem and dict content: Optional[Union[List[OutputText], List[dict]]] = None if isinstance(output_item, BaseModel): diff --git a/litellm/proxy/_new_secret_config.yaml b/litellm/proxy/_new_secret_config.yaml index f1916e99ff9..f763615c67b 100644 --- a/litellm/proxy/_new_secret_config.yaml +++ b/litellm/proxy/_new_secret_config.yaml @@ -15,7 +15,7 @@ guardrails: - guardrail_name: generic-guardrail litellm_params: guardrail: generic_guardrail_api - mode: ["pre_call", "post_call", "during_call"] + mode: ["post_call"] headers: Authorization: Bearer mock-bedrock-token-12345 api_base: http://localhost:8080 diff --git a/litellm/proxy/guardrails/guardrail_hooks/generic_guardrail_api/generic_guardrail_api.py b/litellm/proxy/guardrails/guardrail_hooks/generic_guardrail_api/generic_guardrail_api.py index 55f1fbc8c86..93cbe1c0bba 100644 --- a/litellm/proxy/guardrails/guardrail_hooks/generic_guardrail_api/generic_guardrail_api.py +++ b/litellm/proxy/guardrails/guardrail_hooks/generic_guardrail_api/generic_guardrail_api.py @@ -175,6 +175,7 @@ class GenericGuardrailAPI(CustomGuardrail): texts = inputs.get("texts", []) images = inputs.get("images") tools = inputs.get("tools") + tool_calls = inputs.get("tool_calls") # Use provided request_data or create an empty dict if request_data is None: @@ -201,6 +202,7 @@ class GenericGuardrailAPI(CustomGuardrail): request_data=user_metadata, images=images, tools=tools, + tool_calls=tool_calls, additional_provider_specific_params=additional_params, input_type=input_type, ) @@ -214,7 +216,7 @@ class GenericGuardrailAPI(CustomGuardrail): # Make the API request response = await self.async_handler.post( url=self.api_base, - json=guardrail_request.to_dict(), + json=guardrail_request.model_dump(), headers=headers, ) diff --git a/litellm/proxy/guardrails/guardrail_hooks/unified_guardrail/unified_guardrail.py b/litellm/proxy/guardrails/guardrail_hooks/unified_guardrail/unified_guardrail.py index c16cb89b785..2c120124a27 100644 --- a/litellm/proxy/guardrails/guardrail_hooks/unified_guardrail/unified_guardrail.py +++ b/litellm/proxy/guardrails/guardrail_hooks/unified_guardrail/unified_guardrail.py @@ -96,6 +96,51 @@ class UnifiedLLMGuardrails(CustomLogger): ) return data + async def async_moderation_hook( + self, data: dict, user_api_key_dict: UserAPIKeyAuth, call_type: CallTypesLiteral + ) -> Any: + """ + Runs in parallel to LLM API call + Runs on only Input + + This can NOT modify the input, only used to reject or accept a call before going to LLM API + """ + global endpoint_guardrail_translation_mappings + + verbose_proxy_logger.debug("Running UnifiedLLMGuardrails moderation hook") + + guardrail_to_apply: CustomGuardrail = data.pop("guardrail_to_apply", None) + if guardrail_to_apply is None: + return data + + event_type: GuardrailEventHooks = GuardrailEventHooks.during_call + if ( + guardrail_to_apply.should_run_guardrail(data=data, event_type=event_type) + is not True + ): + verbose_proxy_logger.debug( + "UnifiedLLMGuardrails: Pre-call scanning disabled for %s", + guardrail_to_apply.guardrail_name, + ) + return data + + if endpoint_guardrail_translation_mappings is None: + endpoint_guardrail_translation_mappings = ( + load_guardrail_translation_mappings() + ) + if CallTypes(call_type) not in endpoint_guardrail_translation_mappings: + return data + + endpoint_translation = endpoint_guardrail_translation_mappings[ + CallTypes(call_type) + ]() + + return await endpoint_translation.process_input_messages( + data=data, + guardrail_to_apply=guardrail_to_apply, + litellm_logging_obj=data.get("litellm_logging_obj"), + ) + async def async_post_call_success_hook( self, data: dict, @@ -193,7 +238,6 @@ class UnifiedLLMGuardrails(CustomLogger): "guardrail_to_apply", None ) - # Get sampling rate from guardrail config or optional_params, default to 5 sampling_rate = 5 if guardrail_to_apply is not None: diff --git a/litellm/proxy/utils.py b/litellm/proxy/utils.py index 28a7ef001d5..aca9bd96eb9 100644 --- a/litellm/proxy/utils.py +++ b/litellm/proxy/utils.py @@ -1031,15 +1031,25 @@ class ProxyLogging: ) else: user_api_key_auth_dict = user_api_key_dict - # Add task to list for parallel execution - guardrail_tasks.append( - callback.async_moderation_hook( + if ( + "apply_guardrail" in type(callback).__dict__ + and user_api_key_dict is not None + ): + data["guardrail_to_apply"] = callback + guardrail_task = unified_guardrail.async_moderation_hook( + user_api_key_dict=user_api_key_dict, + data=data, + call_type=call_type, + ) + else: + + guardrail_task = callback.async_moderation_hook( data=data, user_api_key_dict=user_api_key_auth_dict, # type: ignore call_type=call_type, # type: ignore ) - ) + guardrail_tasks.append(guardrail_task) # Step 2: Run all guardrail tasks in parallel if guardrail_tasks: diff --git a/litellm/responses/litellm_completion_transformation/transformation.py b/litellm/responses/litellm_completion_transformation/transformation.py index bd12d0cbb49..0446031d7d6 100644 --- a/litellm/responses/litellm_completion_transformation/transformation.py +++ b/litellm/responses/litellm_completion_transformation/transformation.py @@ -107,7 +107,10 @@ class LiteLLMCompletionResponsesConfig: """ Transform a Responses API request into a Chat Completion request """ - tools, web_search_options = LiteLLMCompletionResponsesConfig.transform_responses_api_tools_to_chat_completion_tools( + ( + tools, + web_search_options, + ) = LiteLLMCompletionResponsesConfig.transform_responses_api_tools_to_chat_completion_tools( responses_api_request.get("tools") or [] # type: ignore ) @@ -218,9 +221,9 @@ class LiteLLMCompletionResponsesConfig: _messages = litellm_completion_request.get("messages") or [] session_messages = chat_completion_session.get("messages") or [] litellm_completion_request["messages"] = session_messages + _messages - litellm_completion_request[ - "litellm_trace_id" - ] = chat_completion_session.get("litellm_session_id") + litellm_completion_request["litellm_trace_id"] = chat_completion_session.get( + "litellm_session_id" + ) return litellm_completion_request @staticmethod @@ -482,19 +485,17 @@ class LiteLLMCompletionResponsesConfig: return new_item @staticmethod - def _transform_input_image_item_to_image_item(item: Dict[str, Any]) -> ChatCompletionImageObject: + def _transform_input_image_item_to_image_item( + item: Dict[str, Any], + ) -> ChatCompletionImageObject: """ Transform a Responses API input_image item to a Chat Completion image item """ image_url_obj = ChatCompletionImageUrlObject( - url=item.get("image_url") or "", - detail=item.get("detail") or "auto" + url=item.get("image_url") or "", detail=item.get("detail") or "auto" ) - return ChatCompletionImageObject( - type="image_url", - image_url=image_url_obj - ) + return ChatCompletionImageObject(type="image_url", image_url=image_url_obj) @staticmethod def _transform_responses_api_content_to_chat_completion_content( @@ -561,7 +562,10 @@ class LiteLLMCompletionResponsesConfig: @staticmethod def transform_responses_api_tools_to_chat_completion_tools( tools: Optional[List[Union[FunctionToolParam, OpenAIMcpServerTool]]], - ) -> Tuple[List[Union[ChatCompletionToolParam, OpenAIMcpServerTool]], Optional[OpenAIWebSearchOptions]]: + ) -> Tuple[ + List[Union[ChatCompletionToolParam, OpenAIMcpServerTool]], + Optional[OpenAIWebSearchOptions], + ]: """ Transform a Responses API tools into a Chat Completion tools """ @@ -574,9 +578,17 @@ class LiteLLMCompletionResponsesConfig: for tool in tools: if tool.get("type") == "mcp": chat_completion_tools.append(cast(OpenAIMcpServerTool, tool)) - elif tool.get("type") == "web_search_preview" or tool.get("type") == "web_search": - _search_context_size: Literal["low", "medium", "high"] = cast(Literal["low", "medium", "high"], tool.get("search_context_size")) - _user_location: Optional[OpenAIWebSearchUserLocation] = cast(Optional[OpenAIWebSearchUserLocation], tool.get("user_location") or None) + elif ( + tool.get("type") == "web_search_preview" + or tool.get("type") == "web_search" + ): + _search_context_size: Literal["low", "medium", "high"] = cast( + Literal["low", "medium", "high"], tool.get("search_context_size") + ) + _user_location: Optional[OpenAIWebSearchUserLocation] = cast( + Optional[OpenAIWebSearchUserLocation], + tool.get("user_location") or None, + ) web_search_options = OpenAIWebSearchOptions( search_context_size=_search_context_size, user_location=_user_location, @@ -618,16 +630,30 @@ class LiteLLMCompletionResponsesConfig: for tool in all_chat_completion_tools: if tool.type == "function": function_definition = tool.function - provider_specific_fields: Optional[Dict[str, Any]] = None - if hasattr(tool, "provider_specific_fields") and getattr(tool, "provider_specific_fields", None): + provider_specific_fields: Optional[Dict] = None + if hasattr(tool, "provider_specific_fields") and getattr( + tool, "provider_specific_fields", None + ): provider_specific_fields = getattr(tool, "provider_specific_fields") if not isinstance(provider_specific_fields, dict): - provider_specific_fields = dict(provider_specific_fields) if hasattr(provider_specific_fields, "__dict__") else {} - elif hasattr(function_definition, "provider_specific_fields") and getattr(function_definition, "provider_specific_fields", None): - provider_specific_fields = getattr(function_definition, "provider_specific_fields") + provider_specific_fields = ( + dict(provider_specific_fields) # type: ignore + if hasattr(provider_specific_fields, "__dict__") + else {} + ) + elif hasattr( + function_definition, "provider_specific_fields" + ) and getattr(function_definition, "provider_specific_fields", None): + provider_specific_fields = getattr( + function_definition, "provider_specific_fields" + ) if not isinstance(provider_specific_fields, dict): - provider_specific_fields = dict(provider_specific_fields) if hasattr(provider_specific_fields, "__dict__") else {} - + provider_specific_fields = ( + dict(provider_specific_fields) # type: ignore + if hasattr(provider_specific_fields, "__dict__") + else {} + ) + output_tool_call: OutputFunctionToolCall = OutputFunctionToolCall( name=function_definition.name or "", arguments=function_definition.get("arguments") or "", @@ -636,11 +662,11 @@ class LiteLLMCompletionResponsesConfig: type="function_call", # critical this is "function_call" to work with tools like openai codex status=function_definition.get("status") or "completed", ) - + # Pass through provider_specific_fields as-is if present if provider_specific_fields: setattr(output_tool_call, "provider_specific_fields", provider_specific_fields) # type: ignore - + responses_tools.append(output_tool_call) return responses_tools @@ -672,6 +698,69 @@ class LiteLLMCompletionResponsesConfig: # Default to completed for unknown finish reasons return "completed" + @staticmethod + def convert_response_function_tool_call_to_chat_completion_tool_call( + tool_call_item: Any, + index: int = 0, + ) -> Dict[str, Any]: + """ + Convert ResponseFunctionToolCall to ChatCompletionToolCallChunk format. + + Args: + tool_call_item: ResponseFunctionToolCall object or similar with name, arguments, call_id + index: The index of this tool call + + Returns: + Dictionary in ChatCompletionToolCallChunk format + """ + from litellm.types.llms.openai import ( + ChatCompletionToolCallChunk, + ChatCompletionToolCallFunctionChunk, + ) + + # Extract provider_specific_fields if present + provider_specific_fields = getattr( + tool_call_item, "provider_specific_fields", None + ) + if provider_specific_fields and not isinstance(provider_specific_fields, dict): + provider_specific_fields = ( + dict(provider_specific_fields) + if hasattr(provider_specific_fields, "__dict__") + else {} + ) + elif hasattr(tool_call_item, "get") and callable(tool_call_item.get): # type: ignore + provider_fields = tool_call_item.get("provider_specific_fields") # type: ignore + if provider_fields: + provider_specific_fields = ( + provider_fields + if isinstance(provider_fields, dict) + else ( + dict(provider_fields) # type: ignore + if hasattr(provider_fields, "__dict__") + else {} + ) + ) + + function_dict: Dict[str, Any] = { + "name": tool_call_item.name, + "arguments": tool_call_item.arguments, + } + + if provider_specific_fields: + function_dict["provider_specific_fields"] = provider_specific_fields + + tool_call_dict: Dict[str, Any] = { + "id": tool_call_item.call_id, + "function": function_dict, + "type": "function", + "index": 0, + } + + if provider_specific_fields: + tool_call_dict["provider_specific_fields"] = provider_specific_fields + + return tool_call_dict + @staticmethod def transform_chat_completion_response_to_responses_api_response( request_input: Union[str, ResponseInputParam], @@ -904,7 +993,6 @@ class LiteLLMCompletionResponsesConfig: return response_output_annotations - @staticmethod def _transform_chat_completion_usage_to_responses_usage( chat_completion_response: Union[ModelResponse, Usage], @@ -974,12 +1062,10 @@ class LiteLLMCompletionResponsesConfig: "name": format_param.get("name", "response_schema"), "schema": format_param.get("schema", {}), "strict": format_param.get("strict", False), - } + }, } elif format_type == "json_object": - return { - "type": "json_object" - } + return {"type": "json_object"} elif format_type == "text": return None diff --git a/litellm/types/guardrails.py b/litellm/types/guardrails.py index ea3a6cc4ede..da9b591de28 100644 --- a/litellm/types/guardrails.py +++ b/litellm/types/guardrails.py @@ -5,7 +5,11 @@ from typing import Any, Dict, List, Literal, Optional, Union from pydantic import BaseModel, ConfigDict, Field from typing_extensions import Required, TypedDict -from litellm.types.llms.openai import ChatCompletionToolParam +from litellm.types.llms.openai import ( + AllMessageValues, + ChatCompletionToolCallChunk, + ChatCompletionToolParam, +) from litellm.types.proxy.guardrails.guardrail_hooks.enkryptai import ( EnkryptAIGuardrailConfigs, ) @@ -742,6 +746,10 @@ class PatchGuardrailRequest(BaseModel): class GenericGuardrailAPIInputs(TypedDict, total=False): - texts: List[str] - images: List[str] - tools: List[ChatCompletionToolParam] + texts: List[str] # extracted text from the LLM response - for basic text guardrails + images: List[str] # extracted images from the LLM response - for image guardrails + tools: List[ChatCompletionToolParam] # tools sent to the LLM + tool_calls: List[ChatCompletionToolCallChunk] # tool calls sent from the LLM + structured_messages: List[ + AllMessageValues + ] # structured messages sent to the LLM - indicates if text is from system or user diff --git a/litellm/types/proxy/guardrails/guardrail_hooks/generic_guardrail_api.py b/litellm/types/proxy/guardrails/guardrail_hooks/generic_guardrail_api.py index 66823270e87..31b61101973 100644 --- a/litellm/types/proxy/guardrails/guardrail_hooks/generic_guardrail_api.py +++ b/litellm/types/proxy/guardrails/guardrail_hooks/generic_guardrail_api.py @@ -3,7 +3,10 @@ from typing import Any, Dict, List, Literal, Optional from pydantic import BaseModel, Field from typing_extensions import TypedDict -from litellm.types.llms.openai import ChatCompletionToolParam +from litellm.types.llms.openai import ( + ChatCompletionToolCallChunk, + ChatCompletionToolParam, +) from litellm.types.proxy.guardrails.guardrail_hooks.base import GuardrailConfigModel @@ -42,7 +45,7 @@ class GenericGuardrailAPIConfigModel( return "Generic Guardrail API" -class GenericGuardrailAPIRequest: +class GenericGuardrailAPIRequest(BaseModel): """Request model for the Generic Guardrail API""" input_type: Literal["request", "response"] @@ -50,40 +53,12 @@ class GenericGuardrailAPIRequest: litellm_trace_id: Optional[ str ] # the trace id of the LLM call - useful if there are multiple LLM calls for the same conversation - - def __init__( - self, - texts: List[str], - request_data: GenericGuardrailAPIMetadata, - input_type: Literal["request", "response"], - litellm_call_id: Optional[str], - litellm_trace_id: Optional[str], - additional_provider_specific_params: Optional[Dict[str, Any]] = None, - images: Optional[List[str]] = None, - tools: Optional[List[ChatCompletionToolParam]] = None, - ): - self.texts = texts - self.request_data = request_data - self.additional_provider_specific_params = ( - additional_provider_specific_params or {} - ) - self.images = images - self.input_type = input_type - self.litellm_call_id = litellm_call_id - self.litellm_trace_id = litellm_trace_id - self.tools = tools - - def to_dict(self) -> dict: - return { - "texts": self.texts, - "request_data": self.request_data, - "images": self.images, - "tools": self.tools, - "additional_provider_specific_params": self.additional_provider_specific_params, - "input_type": self.input_type, - "litellm_call_id": self.litellm_call_id, - "litellm_trace_id": self.litellm_trace_id, - } + texts: List[str] + request_data: GenericGuardrailAPIMetadata + additional_provider_specific_params: Optional[Dict[str, Any]] + images: Optional[List[str]] + tools: Optional[List[ChatCompletionToolParam]] + tool_calls: Optional[List[ChatCompletionToolCallChunk]] class GenericGuardrailAPIResponse: @@ -116,4 +91,5 @@ class GenericGuardrailAPIResponse: blocked_reason=data.get("blocked_reason"), texts=data.get("texts"), images=data.get("images"), + tools=data.get("tools"), ) diff --git a/tests/test_litellm/llms/cohere/rerank/test_rerank_guardrail_handler.py b/tests/test_litellm/llms/cohere/rerank/test_rerank_guardrail_handler.py index 9c2bbeb7a68..88072cd7760 100644 --- a/tests/test_litellm/llms/cohere/rerank/test_rerank_guardrail_handler.py +++ b/tests/test_litellm/llms/cohere/rerank/test_rerank_guardrail_handler.py @@ -22,9 +22,10 @@ class MockGuardrail(CustomGuardrail): """Mock guardrail for testing""" async def apply_guardrail( - self, texts: List[str], request_data: dict, input_type: str, **kwargs - ) -> Tuple[List[str], Optional[List[str]]]: - return ([f"{text} [GUARDRAILED]" for text in texts], None) + self, inputs: dict, request_data: dict, input_type: str, **kwargs + ) -> dict: + texts = inputs.get("texts", []) + return {"texts": [f"{text} [GUARDRAILED]" for text in texts]} class TestHandlerDiscovery: @@ -186,10 +187,11 @@ class TestPIIMaskingScenario: """Mock PII masking guardrail""" async def apply_guardrail( - self, texts: List[str], request_data: dict, input_type: str, **kwargs - ) -> Tuple[List[str], Optional[List[str]]]: + self, inputs: dict, request_data: dict, input_type: str, **kwargs + ) -> dict: import re + texts = inputs.get("texts", []) masked_texts = [] for text in texts: masked = re.sub( @@ -199,7 +201,7 @@ class TestPIIMaskingScenario: ) masked = masked.replace("John Doe", "[NAME_REDACTED]") masked_texts.append(masked) - return (masked_texts, None) + return {"texts": masked_texts} handler = CohereRerankHandler() guardrail = PIIMaskingGuardrail(guardrail_name="mask_pii") @@ -237,10 +239,11 @@ class TestPIIMaskingScenario: """Mock PII masking guardrail""" async def apply_guardrail( - self, texts: List[str], request_data: dict, input_type: str, **kwargs - ) -> Tuple[List[str], Optional[List[str]]]: + self, inputs: dict, request_data: dict, input_type: str, **kwargs + ) -> dict: import re + texts = inputs.get("texts", []) masked_texts = [] for text in texts: # Mask emails @@ -254,7 +257,7 @@ class TestPIIMaskingScenario: # Mask names masked = masked.replace("Alice Smith", "[NAME_REDACTED]") masked_texts.append(masked) - return (masked_texts, None) + return {"texts": masked_texts} handler = CohereRerankHandler() guardrail = PIIMaskingGuardrail(guardrail_name="mask_pii") @@ -349,16 +352,17 @@ class TestContentFilteringScenario: """Mock content filter guardrail""" async def apply_guardrail( - self, texts: List[str], request_data: dict, input_type: str, **kwargs - ) -> Tuple[List[str], Optional[List[str]]]: + self, inputs: dict, request_data: dict, input_type: str, **kwargs + ) -> dict: bad_words = ["inappropriate", "offensive"] + texts = inputs.get("texts", []) filtered_texts = [] for text in texts: filtered = text for word in bad_words: filtered = filtered.replace(word, "[FILTERED]") filtered_texts.append(filtered) - return (filtered_texts, None) + return {"texts": filtered_texts} handler = CohereRerankHandler() guardrail = ContentFilterGuardrail(guardrail_name="content_filter") diff --git a/tests/test_litellm/llms/openai/chat/guardrail_translation/test_handler.py b/tests/test_litellm/llms/openai/chat/guardrail_translation/test_handler.py index 09f3f8dcf0f..951ec908f09 100644 --- a/tests/test_litellm/llms/openai/chat/guardrail_translation/test_handler.py +++ b/tests/test_litellm/llms/openai/chat/guardrail_translation/test_handler.py @@ -46,12 +46,12 @@ class MockGuardrail(CustomGuardrail): request_data: dict, input_type: Literal["request", "response"], logging_obj: Optional[Any] = None, - ) -> Tuple[List[str], Optional[List[str]]]: + ) -> GenericGuardrailAPIInputs: """Mock apply_guardrail that uppercases text and modifies tool calls""" self.last_inputs = inputs self.last_request_data = request_data - # Return modified texts (uppercase for testing) + # Return modified inputs (uppercase texts for testing) texts = inputs.get("texts", []) modified_texts = [text.upper() for text in texts] @@ -75,7 +75,13 @@ class MockGuardrail(CustomGuardrail): # If not JSON, just uppercase the string function["arguments"] = function["arguments"].upper() - return modified_texts, [] + # Return modified inputs as GenericGuardrailAPIInputs + result: GenericGuardrailAPIInputs = {"texts": modified_texts} + if tool_calls: + result["tool_calls"] = tool_calls # type: ignore + if "images" in inputs: + result["images"] = inputs["images"] # type: ignore + return result class TestOpenAIChatCompletionsHandlerToolCallsInput: @@ -512,6 +518,68 @@ class TestOpenAIChatCompletionsHandlerToolCallsOutput: assert args1["location"] == "TOKYO" assert args2["topic"] == "TECHNOLOGY" + @pytest.mark.asyncio + async def test_extract_tool_calls_from_real_openai_response(self): + """Test extraction of tool calls from a real OpenAI API response structure""" + handler = OpenAIChatCompletionsHandler() + guardrail = MockGuardrail() + + # Create a response matching the exact structure from OpenAI API + response = ModelResponse( + id="chatcmpl-abc123", + created=1699896916, + model="gpt-4o-mini", + object="chat.completion", + choices=[ + Choices( + finish_reason="tool_calls", + index=0, + message=Message( + content=None, + role="assistant", + tool_calls=[ + ChatCompletionMessageToolCall( + id="call_abc123", + type="function", + function=Function( + name="get_current_weather", + arguments='{\n"location": "Boston, MA"\n}', + ), + ) + ], + ), + ) + ], + ) + + # Process the output + await handler.process_output_response(response, guardrail) + + # Verify tool calls were extracted and passed to guardrail + assert guardrail.last_inputs is not None + assert "tool_calls" in guardrail.last_inputs + assert len(guardrail.last_inputs["tool_calls"]) == 1 + + # Verify the tool call details + tool_call = guardrail.last_inputs["tool_calls"][0] + assert tool_call["id"] == "call_abc123" + assert tool_call["type"] == "function" + assert tool_call["function"]["name"] == "get_current_weather" + + # Verify arguments can be parsed + args = json.loads(tool_call["function"]["arguments"]) + assert "location" in args + + # Verify tool call was modified by guardrail (location should be uppercased) + response_tool_call = response.choices[0].message.tool_calls[0] + modified_args = json.loads(response_tool_call.function.arguments) + assert modified_args["location"] == "BOSTON, MA" # Should be uppercased + + # Verify response metadata + assert response.id == "chatcmpl-abc123" + assert response.model == "gpt-4o-mini" + assert response.choices[0].finish_reason == "tool_calls" + if __name__ == "__main__": # Run the tests diff --git a/tests/test_litellm/llms/openai/completion/test_text_completion_guardrail_handler.py b/tests/test_litellm/llms/openai/completion/test_text_completion_guardrail_handler.py index c861e48ad48..257db89d073 100644 --- a/tests/test_litellm/llms/openai/completion/test_text_completion_guardrail_handler.py +++ b/tests/test_litellm/llms/openai/completion/test_text_completion_guardrail_handler.py @@ -23,9 +23,10 @@ class MockGuardrail(CustomGuardrail): """Mock guardrail for testing""" async def apply_guardrail( - self, texts: List[str], request_data: dict, input_type: str, **kwargs - ) -> Tuple[List[str], Optional[List[str]]]: - return ([f"{text} [GUARDRAILED]" for text in texts], None) + self, inputs: dict, request_data: dict, input_type: str, **kwargs + ) -> dict: + texts = inputs.get("texts", []) + return {"texts": [f"{text} [GUARDRAILED]" for text in texts]} class TestHandlerDiscovery: @@ -246,11 +247,12 @@ class TestPIIMaskingScenario: """Mock PII masking guardrail""" async def apply_guardrail( - self, texts: List[str], request_data: dict, input_type: str, **kwargs - ) -> Tuple[List[str], Optional[List[str]]]: + self, inputs: dict, request_data: dict, input_type: str, **kwargs + ) -> dict: # Simple mock: replace email-like patterns import re + texts = inputs.get("texts", []) masked_texts = [] for text in texts: masked = re.sub( @@ -261,7 +263,7 @@ class TestPIIMaskingScenario: # Replace names (simple mock) masked = masked.replace("John Doe", "[NAME_REDACTED]") masked_texts.append(masked) - return (masked_texts, None) + return {"texts": masked_texts} handler = OpenAITextCompletionHandler() guardrail = PIIMaskingGuardrail(guardrail_name="mask_pii") @@ -309,10 +311,11 @@ class TestPIIMaskingScenario: """Mock PII masking guardrail""" async def apply_guardrail( - self, texts: List[str], request_data: dict, input_type: str, **kwargs - ) -> Tuple[List[str], Optional[List[str]]]: + self, inputs: dict, request_data: dict, input_type: str, **kwargs + ) -> dict: import re + texts = inputs.get("texts", []) masked_texts = [] for text in texts: masked = re.sub( @@ -321,7 +324,7 @@ class TestPIIMaskingScenario: text, ) masked_texts.append(masked) - return (masked_texts, None) + return {"texts": masked_texts} handler = OpenAITextCompletionHandler() guardrail = PIIMaskingGuardrail(guardrail_name="mask_pii") diff --git a/tests/test_litellm/llms/openai/image_generation/test_image_generation_guardrail_handler.py b/tests/test_litellm/llms/openai/image_generation/test_image_generation_guardrail_handler.py index 5e183e32208..cfccd6f3bbe 100644 --- a/tests/test_litellm/llms/openai/image_generation/test_image_generation_guardrail_handler.py +++ b/tests/test_litellm/llms/openai/image_generation/test_image_generation_guardrail_handler.py @@ -22,9 +22,10 @@ class MockGuardrail(CustomGuardrail): """Mock guardrail for testing""" async def apply_guardrail( - self, texts: List[str], request_data: dict, input_type: str, **kwargs - ) -> Tuple[List[str], Optional[List[str]]]: - return ([f"{text} [GUARDRAILED]" for text in texts], None) + self, inputs: dict, request_data: dict, input_type: str, **kwargs + ) -> dict: + texts = inputs.get("texts", []) + return {"texts": [f"{text} [GUARDRAILED]" for text in texts]} class TestHandlerDiscovery: @@ -144,11 +145,12 @@ class TestPIIMaskingScenario: """Mock PII masking guardrail""" async def apply_guardrail( - self, texts: List[str], request_data: dict, input_type: str, **kwargs - ) -> Tuple[List[str], Optional[List[str]]]: + self, inputs: dict, request_data: dict, input_type: str, **kwargs + ) -> dict: # Simple mock: replace email-like patterns import re + texts = inputs.get("texts", []) masked_texts = [] for text in texts: masked = re.sub( @@ -159,7 +161,7 @@ class TestPIIMaskingScenario: # Replace names (simple mock) masked = masked.replace("John Doe", "[NAME_REDACTED]") masked_texts.append(masked) - return (masked_texts, None) + return {"texts": masked_texts} handler = OpenAIImageGenerationHandler() guardrail = PIIMaskingGuardrail(guardrail_name="mask_pii") diff --git a/tests/test_litellm/llms/openai/responses/test_openai_responses_guardrail_handler.py b/tests/test_litellm/llms/openai/responses/test_openai_responses_guardrail_handler.py index cc76be08178..e9558580d98 100644 --- a/tests/test_litellm/llms/openai/responses/test_openai_responses_guardrail_handler.py +++ b/tests/test_litellm/llms/openai/responses/test_openai_responses_guardrail_handler.py @@ -23,8 +23,13 @@ from litellm.llms import get_guardrail_translation_mapping from litellm.llms.openai.responses.guardrail_translation.handler import ( OpenAIResponsesHandler, ) +from litellm.types.guardrails import GenericGuardrailAPIInputs from litellm.types.llms.openai import ResponsesAPIResponse -from litellm.types.responses.main import GenericResponseOutputItem, OutputText +from litellm.types.responses.main import ( + GenericResponseOutputItem, + OutputFunctionToolCall, + OutputText, +) from litellm.types.utils import CallTypes @@ -33,16 +38,16 @@ class MockGuardrail(CustomGuardrail): async def apply_guardrail( self, - texts: List[str], + inputs: GenericGuardrailAPIInputs, request_data: dict, input_type: Literal["request", "response"], logging_obj: Optional[Any] = None, - images: Optional[List[str]] = None, - ) -> Tuple[List[str], Optional[List[str]]]: + ) -> GenericGuardrailAPIInputs: """ For requests: Append [GUARDRAILED] to text For responses: Block by raising HTTPException (masking responses is no longer supported) """ + texts = inputs.get("texts", []) if input_type == "response": # Responses should be blocked, not masked raise HTTPException( @@ -50,7 +55,8 @@ class MockGuardrail(CustomGuardrail): detail={"error": "Response blocked by guardrail", "texts": texts}, ) # For requests, we can still mask/transform - return ([f"{text} [GUARDRAILED]" for text in texts], None) + inputs["texts"] = [f"{text} [GUARDRAILED]" for text in texts] + return inputs class TestOpenAIResponsesHandlerDiscovery: @@ -532,3 +538,181 @@ class TestOpenAIResponsesHandlerEdgeCases: # Should skip processing and return unchanged assert result == response + + +class TestOpenAIResponsesHandlerToolCallExtraction: + """Test tool call extraction functionality""" + + def test_extract_tool_call_from_function_call_output(self): + """Test extracting tool calls from OutputFunctionToolCall in response output""" + handler = OpenAIResponsesHandler() + + # Create output item matching the user's provided response structure + output_item = OutputFunctionToolCall( + arguments='{"location":"Boston, MA","unit":"celsius"}', + call_id="call_4SjsMeA6DUHwGKaE87ZojgOF", + name="get_current_weather", + type="function_call", + id="fc_0a8bd293ceb771ca00693240cb185c8196b4b4d23948c6ac88", + status="completed", + ) + + texts_to_check: List[str] = [] + images_to_check: List[str] = [] + tool_calls_to_check: List[Any] = [] + task_mappings: List[Tuple[int, int]] = [] + + # Extract tool calls + handler._extract_output_text_and_images( + output_item=output_item, + output_idx=0, + texts_to_check=texts_to_check, + images_to_check=images_to_check, + task_mappings=task_mappings, + tool_calls_to_check=tool_calls_to_check, + ) + + # Verify tool call was extracted + assert len(tool_calls_to_check) == 1 + assert len(texts_to_check) == 0 # No text content in tool call + + # Verify tool call structure + tool_call = tool_calls_to_check[0] + assert tool_call["id"] == "call_4SjsMeA6DUHwGKaE87ZojgOF" + assert tool_call["type"] == "function" + assert tool_call["function"]["name"] == "get_current_weather" + assert ( + tool_call["function"]["arguments"] + == '{"location":"Boston, MA","unit":"celsius"}' + ) + assert tool_call["index"] == 0 + + def test_extract_tool_call_from_dict_format(self): + """Test extracting tool calls from dict representation of function call""" + handler = OpenAIResponsesHandler() + + # Create output item as dict (another format that may be encountered) + output_item = { + "arguments": '{"location":"Boston, MA","unit":"celsius"}', + "call_id": "call_4SjsMeA6DUHwGKaE87ZojgOF", + "name": "get_current_weather", + "type": "function_call", + "id": "fc_0a8bd293ceb771ca00693240cb185c8196b4b4d23948c6ac88", + "status": "completed", + } + + texts_to_check: List[str] = [] + images_to_check: List[str] = [] + tool_calls_to_check: List[Any] = [] + task_mappings: List[Tuple[int, int]] = [] + + # Extract tool calls + handler._extract_output_text_and_images( + output_item=output_item, + output_idx=0, + texts_to_check=texts_to_check, + images_to_check=images_to_check, + task_mappings=task_mappings, + tool_calls_to_check=tool_calls_to_check, + ) + + # Verify tool call was extracted + assert len(tool_calls_to_check) == 1 + assert len(texts_to_check) == 0 # No text content in tool call + + # Verify tool call structure + tool_call = tool_calls_to_check[0] + assert tool_call["id"] == "call_4SjsMeA6DUHwGKaE87ZojgOF" + assert tool_call["type"] == "function" + assert tool_call["function"]["name"] == "get_current_weather" + assert ( + tool_call["function"]["arguments"] + == '{"location":"Boston, MA","unit":"celsius"}' + ) + + @pytest.mark.asyncio + async def test_process_output_response_with_tool_calls(self): + """Test processing output response containing function tool calls""" + handler = OpenAIResponsesHandler() + guardrail = MockGuardrail(guardrail_name="test") + + # Create a full response matching user's provided structure + response = ResponsesAPIResponse( + id="resp_zlasw86v56zobnneYprKIagz33tpQeh7arqL9mrI1oec47HNQLGz0VL0PpM9z67EADHExs7UjtyGqpoBKcM9oR6icMGx826UsXnlvu3ZvIyrVA1CaMgeaMo9H5DdQMhvmXtriqXpikuyYbIsko97x8GvtBIoSCcovM9s5KCwJ4eWSjfr51d6-GwLIMkCNbQI6AN11uYyIKrIfCt_9j7FZdBnRHhZ0_zE7E1LYWQPm9G9_nPmTyh9FXNLUZ9Uib1SejrCetPargnpQeBibaXqPoj_pXFKvgc-_-znG5IWEsM8WH9Pjbm6uWEwpUiCxt8yfjQGEADqaluLAts1mnzQVEhCtZbU67QG3ebSG-rXtBw511f2pJPzZ8kI4hPISmZL8Co3LmIrdpmzzb02sQRoH3v4HCwzVGXgtRwRYkdpffebYElQWzvYDhqIHFHKNavfF8mC5AVPvPRA5h1Pf3utTf26", + created_at=1764901066, + model="gpt-4.1-mini-2025-04-14", + object="response", + status="completed", + output=[ + OutputFunctionToolCall( + arguments='{"location":"Boston, MA","unit":"celsius"}', + call_id="call_4SjsMeA6DUHwGKaE87ZojgOF", + name="get_current_weather", + type="function_call", + id="fc_0a8bd293ceb771ca00693240cb185c8196b4b4d23948c6ac88", + status="completed", + ) + ], + ) + + # Response should be blocked since MockGuardrail blocks responses + with pytest.raises(HTTPException) as exc_info: + await handler.process_output_response(response, guardrail) + + assert exc_info.value.status_code == 400 + assert "Response blocked by guardrail" in str(exc_info.value.detail) + + def test_extract_mixed_content_with_text_and_tool_calls(self): + """Test extracting both text and tool calls from response""" + handler = OpenAIResponsesHandler() + + # Create a response with both text and tool call outputs + texts_to_check: List[str] = [] + images_to_check: List[str] = [] + tool_calls_to_check: List[Any] = [] + task_mappings: List[Tuple[int, int]] = [] + + # First extract from a message output + text_output = { + "type": "message", + "id": "msg_123", + "status": "completed", + "role": "assistant", + "content": [ + {"type": "output_text", "text": "I'll check the weather for you"}, + ], + } + + handler._extract_output_text_and_images( + output_item=text_output, + output_idx=0, + texts_to_check=texts_to_check, + images_to_check=images_to_check, + task_mappings=task_mappings, + tool_calls_to_check=tool_calls_to_check, + ) + + # Then extract from a tool call output + tool_call_output = OutputFunctionToolCall( + arguments='{"location":"Boston, MA","unit":"celsius"}', + call_id="call_4SjsMeA6DUHwGKaE87ZojgOF", + name="get_current_weather", + type="function_call", + id="fc_0a8bd293ceb771ca00693240cb185c8196b4b4d23948c6ac88", + status="completed", + ) + + handler._extract_output_text_and_images( + output_item=tool_call_output, + output_idx=1, + texts_to_check=texts_to_check, + images_to_check=images_to_check, + task_mappings=task_mappings, + tool_calls_to_check=tool_calls_to_check, + ) + + # Verify both were extracted + assert len(texts_to_check) == 1 + assert texts_to_check[0] == "I'll check the weather for you" + assert len(tool_calls_to_check) == 1 + assert tool_calls_to_check[0]["function"]["name"] == "get_current_weather" diff --git a/tests/test_litellm/llms/openai/speech/test_text_to_speech_guardrail_handler.py b/tests/test_litellm/llms/openai/speech/test_text_to_speech_guardrail_handler.py index dfd96beb2f4..5b6387cb100 100644 --- a/tests/test_litellm/llms/openai/speech/test_text_to_speech_guardrail_handler.py +++ b/tests/test_litellm/llms/openai/speech/test_text_to_speech_guardrail_handler.py @@ -22,9 +22,10 @@ class MockGuardrail(CustomGuardrail): """Mock guardrail for testing""" async def apply_guardrail( - self, texts: List[str], request_data: dict, input_type: str, **kwargs - ) -> Tuple[List[str], Optional[List[str]]]: - return ([f"{text} [GUARDRAILED]" for text in texts], None) + self, inputs: dict, request_data: dict, input_type: str, **kwargs + ) -> dict: + texts = inputs.get("texts", []) + return {"texts": [f"{text} [GUARDRAILED]" for text in texts]} class MockBinaryResponse: @@ -172,11 +173,12 @@ class TestPIIMaskingScenario: """Mock PII masking guardrail""" async def apply_guardrail( - self, texts: List[str], request_data: dict, input_type: str, **kwargs - ) -> Tuple[List[str], Optional[List[str]]]: + self, inputs: dict, request_data: dict, input_type: str, **kwargs + ) -> dict: # Simple mock: replace email-like patterns import re + texts = inputs.get("texts", []) masked_texts = [] for text in texts: masked = re.sub( @@ -188,7 +190,7 @@ class TestPIIMaskingScenario: masked = masked.replace("John Doe", "[NAME_REDACTED]") masked = masked.replace("555-1234", "[PHONE_REDACTED]") masked_texts.append(masked) - return (masked_texts, None) + return {"texts": masked_texts} handler = OpenAITextToSpeechHandler() guardrail = PIIMaskingGuardrail(guardrail_name="mask_pii") @@ -217,10 +219,11 @@ class TestPIIMaskingScenario: """Mock PII masking guardrail""" async def apply_guardrail( - self, texts: List[str], request_data: dict, input_type: str, **kwargs - ) -> Tuple[List[str], Optional[List[str]]]: + self, inputs: dict, request_data: dict, input_type: str, **kwargs + ) -> dict: import re + texts = inputs.get("texts", []) masked_texts = [] for text in texts: # Mask account numbers @@ -234,7 +237,7 @@ class TestPIIMaskingScenario: r"\d{4}[- ]?\d{4}[- ]?\d{4}[- ]?\d{4}", "[CC_REDACTED]", masked ) masked_texts.append(masked) - return (masked_texts, None) + return {"texts": masked_texts} handler = OpenAITextToSpeechHandler() guardrail = PIIMaskingGuardrail(guardrail_name="mask_pii") @@ -269,17 +272,18 @@ class TestContentModerationScenario: """Mock content filter guardrail""" async def apply_guardrail( - self, texts: List[str], request_data: dict, input_type: str, **kwargs - ) -> Tuple[List[str], Optional[List[str]]]: + self, inputs: dict, request_data: dict, input_type: str, **kwargs + ) -> dict: # Simple mock: filter inappropriate words bad_words = ["badword", "inappropriate", "offensive"] + texts = inputs.get("texts", []) filtered_texts = [] for text in texts: filtered = text for word in bad_words: filtered = filtered.replace(word, "[FILTERED]") filtered_texts.append(filtered) - return (filtered_texts, None) + return {"texts": filtered_texts} handler = OpenAITextToSpeechHandler() guardrail = ContentFilterGuardrail(guardrail_name="content_filter") diff --git a/tests/test_litellm/llms/openai/transcriptions/test_audio_transcription_guardrail_handler.py b/tests/test_litellm/llms/openai/transcriptions/test_audio_transcription_guardrail_handler.py index 4d2cb142b35..307972ff477 100644 --- a/tests/test_litellm/llms/openai/transcriptions/test_audio_transcription_guardrail_handler.py +++ b/tests/test_litellm/llms/openai/transcriptions/test_audio_transcription_guardrail_handler.py @@ -23,9 +23,10 @@ class MockGuardrail(CustomGuardrail): """Mock guardrail for testing""" async def apply_guardrail( - self, texts: List[str], request_data: dict, input_type: str, **kwargs - ) -> Tuple[List[str], Optional[List[str]]]: - return ([f"{text} [GUARDRAILED]" for text in texts], None) + self, inputs: dict, request_data: dict, input_type: str, **kwargs + ) -> dict: + texts = inputs.get("texts", []) + return {"texts": [f"{text} [GUARDRAILED]" for text in texts]} class TestHandlerDiscovery: @@ -143,11 +144,12 @@ class TestPIIMaskingScenario: """Mock PII masking guardrail""" async def apply_guardrail( - self, texts: List[str], request_data: dict, input_type: str, **kwargs - ) -> Tuple[List[str], Optional[List[str]]]: + self, inputs: dict, request_data: dict, input_type: str, **kwargs + ) -> dict: # Simple mock: replace email-like patterns import re + texts = inputs.get("texts", []) masked_texts = [] for text in texts: masked = re.sub( @@ -159,7 +161,7 @@ class TestPIIMaskingScenario: masked = masked.replace("John Doe", "[NAME_REDACTED]") masked = masked.replace("555-1234", "[PHONE_REDACTED]") masked_texts.append(masked) - return (masked_texts, None) + return {"texts": masked_texts} handler = OpenAIAudioTranscriptionHandler() guardrail = PIIMaskingGuardrail(guardrail_name="mask_pii") @@ -187,10 +189,11 @@ class TestPIIMaskingScenario: """Mock PII masking guardrail""" async def apply_guardrail( - self, texts: List[str], request_data: dict, input_type: str, **kwargs - ) -> Tuple[List[str], Optional[List[str]]]: + self, inputs: dict, request_data: dict, input_type: str, **kwargs + ) -> dict: import re + texts = inputs.get("texts", []) masked_texts = [] for text in texts: # Mask credit card numbers @@ -206,7 +209,7 @@ class TestPIIMaskingScenario: masked, ) masked_texts.append(masked) - return (masked_texts, None) + return {"texts": masked_texts} handler = OpenAIAudioTranscriptionHandler() guardrail = PIIMaskingGuardrail(guardrail_name="mask_pii") @@ -240,17 +243,18 @@ class TestContentModerationScenario: """Mock profanity filter guardrail""" async def apply_guardrail( - self, texts: List[str], request_data: dict, input_type: str, **kwargs - ) -> Tuple[List[str], Optional[List[str]]]: + self, inputs: dict, request_data: dict, input_type: str, **kwargs + ) -> dict: # Simple mock: replace common profanity bad_words = ["badword1", "badword2", "inappropriate"] + texts = inputs.get("texts", []) filtered_texts = [] for text in texts: filtered = text for word in bad_words: filtered = filtered.replace(word, "[FILTERED]") filtered_texts.append(filtered) - return (filtered_texts, None) + return {"texts": filtered_texts} handler = OpenAIAudioTranscriptionHandler() guardrail = ProfanityFilterGuardrail(guardrail_name="content_filter") diff --git a/tests/test_litellm/proxy/guardrails/guardrail_hooks/test_generic_guardrail_api.py b/tests/test_litellm/proxy/guardrails/guardrail_hooks/test_generic_guardrail_api.py index f3578fbcefa..eeae0ece02c 100644 --- a/tests/test_litellm/proxy/guardrails/guardrail_hooks/test_generic_guardrail_api.py +++ b/tests/test_litellm/proxy/guardrails/guardrail_hooks/test_generic_guardrail_api.py @@ -179,7 +179,7 @@ class TestMetadataExtraction: generic_guardrail.async_handler, "post", return_value=mock_response ) as mock_post: await generic_guardrail.apply_guardrail( - inputs=GenericGuardrailAPIInputs(texts=["Who is Ishaan?"]), + inputs={"texts": ["Who is Ishaan?"]}, request_data=mock_request_data_input, input_type="request", ) From b3a3081e8eec5bd369877938fa47d6ee59fccc61 Mon Sep 17 00:00:00 2001 From: Krish Dholakia Date: Thu, 4 Dec 2025 22:08:00 -0800 Subject: [PATCH 055/178] Guardrails API - new `structured_messages` param (#17518) * fix(generic_guardrail_api.py): add 'structured_messages' support allows guardrail provider to know if text is from system or user * fix(generic_guardrail_api.md): document 'structured_messages' parameter give api provider a way to distinguish between user and system messages * feat(anthropic/): return openai chat completion format structured messages when calls made via `/v1/messages` on Anthropic * feat(responses/guardrail_translation): support 'structured_messages' param for guardrails structured openai chat completion spec messages, for guardrail checks when using /v1/responses api allows guardrail checks to work consistently across APIs --- .../mock_bedrock_guardrail_server.py | 1 + .../adding_provider/generic_guardrail_api.md | 39 +++++++++++++++++++ .../chat/guardrail_translation/handler.py | 25 ++++++++---- .../chat/guardrail_translation/handler.py | 4 ++ .../guardrail_translation/handler.py | 11 ++++++ .../index.html} | 0 .../proxy/_experimental/out/guardrails.html | 1 - .../out/{login.html => login/index.html} | 0 .../out/{logs.html => logs/index.html} | 0 .../{model-hub.html => model-hub/index.html} | 0 .../index.html} | 0 .../index.html} | 0 .../proxy/_experimental/out/onboarding.html | 1 - .../index.html} | 0 .../index.html} | 0 .../out/{teams.html => teams/index.html} | 0 .../{test-key.html => test-key/index.html} | 0 .../out/{usage.html => usage/index.html} | 0 .../out/{users.html => users/index.html} | 0 .../index.html} | 0 litellm/proxy/_new_secret_config.yaml | 2 +- .../generic_guardrail_api.py | 2 + litellm/types/guardrails.py | 1 + .../guardrail_hooks/generic_guardrail_api.py | 8 ++-- 24 files changed, 82 insertions(+), 13 deletions(-) rename litellm/proxy/_experimental/out/{api-reference.html => api-reference/index.html} (100%) delete mode 100644 litellm/proxy/_experimental/out/guardrails.html rename litellm/proxy/_experimental/out/{login.html => login/index.html} (100%) rename litellm/proxy/_experimental/out/{logs.html => logs/index.html} (100%) rename litellm/proxy/_experimental/out/{model-hub.html => model-hub/index.html} (100%) rename litellm/proxy/_experimental/out/{model_hub_table.html => model_hub_table/index.html} (100%) rename litellm/proxy/_experimental/out/{models-and-endpoints.html => models-and-endpoints/index.html} (100%) delete mode 100644 litellm/proxy/_experimental/out/onboarding.html rename litellm/proxy/_experimental/out/{organizations.html => organizations/index.html} (100%) rename litellm/proxy/_experimental/out/{playground.html => playground/index.html} (100%) rename litellm/proxy/_experimental/out/{teams.html => teams/index.html} (100%) rename litellm/proxy/_experimental/out/{test-key.html => test-key/index.html} (100%) rename litellm/proxy/_experimental/out/{usage.html => usage/index.html} (100%) rename litellm/proxy/_experimental/out/{users.html => users/index.html} (100%) rename litellm/proxy/_experimental/out/{virtual-keys.html => virtual-keys/index.html} (100%) diff --git a/cookbook/mock_guardrail_server/mock_bedrock_guardrail_server.py b/cookbook/mock_guardrail_server/mock_bedrock_guardrail_server.py index b5c1b3fa0c8..7bf9cc32484 100644 --- a/cookbook/mock_guardrail_server/mock_bedrock_guardrail_server.py +++ b/cookbook/mock_guardrail_server/mock_bedrock_guardrail_server.py @@ -398,6 +398,7 @@ class LitellmBasicGuardrailRequest(BaseModel): input_type: Literal["request", "response"] litellm_call_id: Optional[str] = None litellm_trace_id: Optional[str] = None + structured_messages: Optional[List[Dict[str, Any]]] = None class LitellmBasicGuardrailResponse(BaseModel): diff --git a/docs/my-website/docs/adding_provider/generic_guardrail_api.md b/docs/my-website/docs/adding_provider/generic_guardrail_api.md index f8c07b25f9d..f599d424dd2 100644 --- a/docs/my-website/docs/adding_provider/generic_guardrail_api.md +++ b/docs/my-website/docs/adding_provider/generic_guardrail_api.md @@ -69,6 +69,10 @@ Implement `POST /beta/litellm_basic_guardrail_api` } } ], + "structured_messages": [ // optional, full messages in OpenAI format (for chat endpoints) + {"role": "system", "content": "You are a helpful assistant"}, + {"role": "user", "content": "Hello"} + ], "request_data": { "user_api_key_hash": "hash of the litellm virtual key used", "user_api_key_alias": "alias of the litellm virtual key used", @@ -147,6 +151,29 @@ The `tools` parameter provides information about available function/tool definit - Log tool usage for audit purposes - Block sensitive tools based on user context +### `structured_messages` Parameter + +The `structured_messages` parameter provides the full input in OpenAI chat completion spec format, useful for distinguishing between system and user messages. + +**Format:** Array of OpenAI chat completion messages (see [OpenAI API reference](https://platform.openai.com/docs/api-reference/chat/create#chat-create-messages)) + +**Example:** +```json +[ + {"role": "system", "content": "You are a helpful assistant"}, + {"role": "user", "content": "Hello"} +] +``` + +**Availability:** +- **Supported endpoints:** `/v1/chat/completions`, `/v1/messages`, `/v1/responses` +- **Input only:** Only passed for `input_type="request"` (pre-call guardrails) + +**Use cases:** +- Apply different policies for system vs user messages +- Enforce role-based content restrictions +- Log structured conversation context + ## LiteLLM Configuration Add to `config.yaml`: @@ -211,6 +238,7 @@ class GuardrailRequest(BaseModel): texts: List[str] images: Optional[List[str]] = None tools: Optional[List[Dict[str, Any]]] = None # OpenAI ChatCompletionToolParam format + structured_messages: Optional[List[Dict[str, Any]]] = None # OpenAI messages format (for chat endpoints) request_data: Dict[str, Any] input_type: str # "request" or "response" litellm_call_id: Optional[str] = None @@ -247,6 +275,17 @@ async def apply_guardrail(request: GuardrailRequest): blocked_reason=f"Tool '{function_name}' is not allowed" ) + # Example: Check structured messages (if present in request) + if request.structured_messages: + for message in request.structured_messages: + if message.get("role") == "system": + # Apply stricter policies to system messages + if "admin" in message.get("content", "").lower(): + return GuardrailResponse( + action="BLOCKED", + blocked_reason="System message contains restricted terms" + ) + return GuardrailResponse(action="NONE") ``` diff --git a/litellm/llms/anthropic/chat/guardrail_translation/handler.py b/litellm/llms/anthropic/chat/guardrail_translation/handler.py index d8bede65f09..e1af433f23f 100644 --- a/litellm/llms/anthropic/chat/guardrail_translation/handler.py +++ b/litellm/llms/anthropic/chat/guardrail_translation/handler.py @@ -22,6 +22,11 @@ from litellm.llms.anthropic.experimental_pass_through.adapters.transformation im ) from litellm.llms.base_llm.guardrail_translation.base_translation import BaseTranslation from litellm.types.guardrails import GenericGuardrailAPIInputs +from litellm.types.llms.anthropic import ( + AllAnthropicToolsValues, + AnthropicMessagesRequest, +) +from litellm.types.llms.openai import ChatCompletionToolParam from litellm.types.llms.anthropic import AllAnthropicToolsValues from litellm.types.llms.openai import ( ChatCompletionToolCallChunk, @@ -65,9 +70,19 @@ class AnthropicMessagesHandler(BaseTranslation): if messages is None: return data + chat_completion_compatible_request = ( + LiteLLMAnthropicMessagesAdapter().translate_anthropic_to_openai( + anthropic_message_request=cast(AnthropicMessagesRequest, data) + ) + ) + + structured_messages = chat_completion_compatible_request.get("messages", []) + texts_to_check: List[str] = [] images_to_check: List[str] = [] - tools_to_check: List[ChatCompletionToolParam] = [] + tools_to_check: List[ChatCompletionToolParam] = ( + chat_completion_compatible_request.get("tools", []) + ) task_mappings: List[Tuple[int, Optional[int]]] = [] # Track (message_index, content_index) for each text # content_index is None for string content, int for list content @@ -82,12 +97,6 @@ class AnthropicMessagesHandler(BaseTranslation): task_mappings=task_mappings, ) - if tools is not None: - self._extract_input_tools( - tools=tools, - tools_to_check=tools_to_check, - ) - # Step 2: Apply guardrail to all texts in batch if texts_to_check: inputs = GenericGuardrailAPIInputs(texts=texts_to_check) @@ -95,6 +104,8 @@ class AnthropicMessagesHandler(BaseTranslation): inputs["images"] = images_to_check if tools_to_check: inputs["tools"] = tools_to_check + if structured_messages: + inputs["structured_messages"] = structured_messages guardrailed_inputs = await guardrail_to_apply.apply_guardrail( inputs=inputs, request_data=data, diff --git a/litellm/llms/openai/chat/guardrail_translation/handler.py b/litellm/llms/openai/chat/guardrail_translation/handler.py index 463b50beb5c..aa2580453a8 100644 --- a/litellm/llms/openai/chat/guardrail_translation/handler.py +++ b/litellm/llms/openai/chat/guardrail_translation/handler.py @@ -80,6 +80,10 @@ class OpenAIChatCompletionsHandler(BaseTranslation): inputs["images"] = images_to_check if tool_calls_to_check: inputs["tool_calls"] = tool_calls_to_check # type: ignore + if messages: + inputs["structured_messages"] = ( + messages # pass the openai /chat/completions messages to the guardrail, as-is + ) guardrailed_inputs = await guardrail_to_apply.apply_guardrail( inputs=inputs, diff --git a/litellm/llms/openai/responses/guardrail_translation/handler.py b/litellm/llms/openai/responses/guardrail_translation/handler.py index 2ab37f061fd..0fdea47415f 100644 --- a/litellm/llms/openai/responses/guardrail_translation/handler.py +++ b/litellm/llms/openai/responses/guardrail_translation/handler.py @@ -81,6 +81,13 @@ class OpenAIResponsesHandler(BaseTranslation): if input_data is None: return data + structured_messages = ( + LiteLLMCompletionResponsesConfig.transform_responses_api_input_to_messages( + input=input_data, + responses_api_request=data, + ) + ) + # Handle simple string input if isinstance(input_data, str): inputs = GenericGuardrailAPIInputs(texts=[input_data]) @@ -91,6 +98,8 @@ class OpenAIResponsesHandler(BaseTranslation): self._extract_and_transform_tools(data["tools"], tools_to_check) if tools_to_check: inputs["tools"] = tools_to_check + if structured_messages: + inputs["structured_messages"] = structured_messages # type: ignore guardrailed_inputs = await guardrail_to_apply.apply_guardrail( inputs=inputs, @@ -134,6 +143,8 @@ class OpenAIResponsesHandler(BaseTranslation): inputs["images"] = images_to_check if tools_to_check: inputs["tools"] = tools_to_check + if structured_messages: + inputs["structured_messages"] = structured_messages # type: ignore guardrailed_inputs = await guardrail_to_apply.apply_guardrail( inputs=inputs, request_data=data, diff --git a/litellm/proxy/_experimental/out/api-reference.html b/litellm/proxy/_experimental/out/api-reference/index.html similarity index 100% rename from litellm/proxy/_experimental/out/api-reference.html rename to litellm/proxy/_experimental/out/api-reference/index.html diff --git a/litellm/proxy/_experimental/out/guardrails.html b/litellm/proxy/_experimental/out/guardrails.html deleted file mode 100644 index d10f6fdaf8d..00000000000 --- a/litellm/proxy/_experimental/out/guardrails.html +++ /dev/null @@ -1 +0,0 @@ -LiteLLM Dashboard \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/login.html b/litellm/proxy/_experimental/out/login/index.html similarity index 100% rename from litellm/proxy/_experimental/out/login.html rename to litellm/proxy/_experimental/out/login/index.html diff --git a/litellm/proxy/_experimental/out/logs.html b/litellm/proxy/_experimental/out/logs/index.html similarity index 100% rename from litellm/proxy/_experimental/out/logs.html rename to litellm/proxy/_experimental/out/logs/index.html diff --git a/litellm/proxy/_experimental/out/model-hub.html b/litellm/proxy/_experimental/out/model-hub/index.html similarity index 100% rename from litellm/proxy/_experimental/out/model-hub.html rename to litellm/proxy/_experimental/out/model-hub/index.html diff --git a/litellm/proxy/_experimental/out/model_hub_table.html b/litellm/proxy/_experimental/out/model_hub_table/index.html similarity index 100% rename from litellm/proxy/_experimental/out/model_hub_table.html rename to litellm/proxy/_experimental/out/model_hub_table/index.html diff --git a/litellm/proxy/_experimental/out/models-and-endpoints.html b/litellm/proxy/_experimental/out/models-and-endpoints/index.html similarity index 100% rename from litellm/proxy/_experimental/out/models-and-endpoints.html rename to litellm/proxy/_experimental/out/models-and-endpoints/index.html diff --git a/litellm/proxy/_experimental/out/onboarding.html b/litellm/proxy/_experimental/out/onboarding.html deleted file mode 100644 index 7da5d460163..00000000000 --- a/litellm/proxy/_experimental/out/onboarding.html +++ /dev/null @@ -1 +0,0 @@ -LiteLLM Dashboard \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/organizations.html b/litellm/proxy/_experimental/out/organizations/index.html similarity index 100% rename from litellm/proxy/_experimental/out/organizations.html rename to litellm/proxy/_experimental/out/organizations/index.html diff --git a/litellm/proxy/_experimental/out/playground.html b/litellm/proxy/_experimental/out/playground/index.html similarity index 100% rename from litellm/proxy/_experimental/out/playground.html rename to litellm/proxy/_experimental/out/playground/index.html diff --git a/litellm/proxy/_experimental/out/teams.html b/litellm/proxy/_experimental/out/teams/index.html similarity index 100% rename from litellm/proxy/_experimental/out/teams.html rename to litellm/proxy/_experimental/out/teams/index.html diff --git a/litellm/proxy/_experimental/out/test-key.html b/litellm/proxy/_experimental/out/test-key/index.html similarity index 100% rename from litellm/proxy/_experimental/out/test-key.html rename to litellm/proxy/_experimental/out/test-key/index.html diff --git a/litellm/proxy/_experimental/out/usage.html b/litellm/proxy/_experimental/out/usage/index.html similarity index 100% rename from litellm/proxy/_experimental/out/usage.html rename to litellm/proxy/_experimental/out/usage/index.html diff --git a/litellm/proxy/_experimental/out/users.html b/litellm/proxy/_experimental/out/users/index.html similarity index 100% rename from litellm/proxy/_experimental/out/users.html rename to litellm/proxy/_experimental/out/users/index.html diff --git a/litellm/proxy/_experimental/out/virtual-keys.html b/litellm/proxy/_experimental/out/virtual-keys/index.html similarity index 100% rename from litellm/proxy/_experimental/out/virtual-keys.html rename to litellm/proxy/_experimental/out/virtual-keys/index.html diff --git a/litellm/proxy/_new_secret_config.yaml b/litellm/proxy/_new_secret_config.yaml index f763615c67b..6c21b29fc53 100644 --- a/litellm/proxy/_new_secret_config.yaml +++ b/litellm/proxy/_new_secret_config.yaml @@ -15,7 +15,7 @@ guardrails: - guardrail_name: generic-guardrail litellm_params: guardrail: generic_guardrail_api - mode: ["post_call"] + mode: ["pre_call"] headers: Authorization: Bearer mock-bedrock-token-12345 api_base: http://localhost:8080 diff --git a/litellm/proxy/guardrails/guardrail_hooks/generic_guardrail_api/generic_guardrail_api.py b/litellm/proxy/guardrails/guardrail_hooks/generic_guardrail_api/generic_guardrail_api.py index 93cbe1c0bba..c7b4f19a089 100644 --- a/litellm/proxy/guardrails/guardrail_hooks/generic_guardrail_api/generic_guardrail_api.py +++ b/litellm/proxy/guardrails/guardrail_hooks/generic_guardrail_api/generic_guardrail_api.py @@ -175,6 +175,7 @@ class GenericGuardrailAPI(CustomGuardrail): texts = inputs.get("texts", []) images = inputs.get("images") tools = inputs.get("tools") + structured_messages = inputs.get("structured_messages") tool_calls = inputs.get("tool_calls") # Use provided request_data or create an empty dict @@ -202,6 +203,7 @@ class GenericGuardrailAPI(CustomGuardrail): request_data=user_metadata, images=images, tools=tools, + structured_messages=structured_messages, tool_calls=tool_calls, additional_provider_specific_params=additional_params, input_type=input_type, diff --git a/litellm/types/guardrails.py b/litellm/types/guardrails.py index da9b591de28..9abb7b3443e 100644 --- a/litellm/types/guardrails.py +++ b/litellm/types/guardrails.py @@ -5,6 +5,7 @@ from typing import Any, Dict, List, Literal, Optional, Union from pydantic import BaseModel, ConfigDict, Field from typing_extensions import Required, TypedDict +from litellm.types.llms.openai import AllMessageValues, ChatCompletionToolParam from litellm.types.llms.openai import ( AllMessageValues, ChatCompletionToolCallChunk, diff --git a/litellm/types/proxy/guardrails/guardrail_hooks/generic_guardrail_api.py b/litellm/types/proxy/guardrails/guardrail_hooks/generic_guardrail_api.py index 31b61101973..a99ed9fa414 100644 --- a/litellm/types/proxy/guardrails/guardrail_hooks/generic_guardrail_api.py +++ b/litellm/types/proxy/guardrails/guardrail_hooks/generic_guardrail_api.py @@ -3,6 +3,7 @@ from typing import Any, Dict, List, Literal, Optional from pydantic import BaseModel, Field from typing_extensions import TypedDict +from litellm.types.llms.openai import AllMessageValues, ChatCompletionToolParam from litellm.types.llms.openai import ( ChatCompletionToolCallChunk, ChatCompletionToolParam, @@ -53,11 +54,12 @@ class GenericGuardrailAPIRequest(BaseModel): litellm_trace_id: Optional[ str ] # the trace id of the LLM call - useful if there are multiple LLM calls for the same conversation - texts: List[str] - request_data: GenericGuardrailAPIMetadata - additional_provider_specific_params: Optional[Dict[str, Any]] + structured_messages: Optional[List[AllMessageValues]] images: Optional[List[str]] tools: Optional[List[ChatCompletionToolParam]] + texts: Optional[List[str]] + request_data: GenericGuardrailAPIMetadata + additional_provider_specific_params: Optional[Dict[str, Any]] tool_calls: Optional[List[ChatCompletionToolCallChunk]] From 99fd96687f15edb1e1f76db431568492ab24674b Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Fri, 5 Dec 2025 11:46:14 +0530 Subject: [PATCH 056/178] Fix vector store configuration synchronization failure --- .../proxy/vector_stores/endpoints.py | 42 +-- .../vector_store_pre_call_hook.py | 15 +- .../vector_stores/vector_store_registry.py | 119 +++++++++ .../test_vector_store_endpoints.py | 243 ++++++++++++++++++ 4 files changed, 400 insertions(+), 19 deletions(-) diff --git a/enterprise/litellm_enterprise/proxy/vector_stores/endpoints.py b/enterprise/litellm_enterprise/proxy/vector_stores/endpoints.py index fdb1dba372f..21933165217 100644 --- a/enterprise/litellm_enterprise/proxy/vector_stores/endpoints.py +++ b/enterprise/litellm_enterprise/proxy/vector_stores/endpoints.py @@ -141,28 +141,36 @@ async def list_vector_stores( """ from litellm.proxy.proxy_server import prisma_client - seen_vector_store_ids = set() - try: - # Get in-memory vector stores - in_memory_vector_stores: List[LiteLLM_ManagedVectorStore] = [] - if litellm.vector_store_registry is not None: - in_memory_vector_stores = copy.deepcopy( - litellm.vector_store_registry.vector_stores - ) - - # Get vector stores from database + # Get vector stores from database (source of truth) + # Only return what's in the database to ensure consistency across instances vector_stores_from_db = await VectorStoreRegistry._get_vector_stores_from_db( prisma_client=prisma_client ) + + # Also clean up in-memory registry to remove any deleted vector stores + if litellm.vector_store_registry is not None: + db_vector_store_ids = { + vs.get("vector_store_id") + for vs in vector_stores_from_db + if vs.get("vector_store_id") + } + # Remove any in-memory vector stores that no longer exist in database + vector_stores_to_remove = [] + for vs in litellm.vector_store_registry.vector_stores: + vs_id = vs.get("vector_store_id") + if vs_id and vs_id not in db_vector_store_ids: + vector_stores_to_remove.append(vs_id) + for vs_id in vector_stores_to_remove: + litellm.vector_store_registry.delete_vector_store_from_registry( + vector_store_id=vs_id + ) + verbose_proxy_logger.debug( + f"Removed deleted vector store {vs_id} from in-memory registry" + ) - # Combine in-memory and database vector stores - combined_vector_stores: List[LiteLLM_ManagedVectorStore] = [] - for vector_store in in_memory_vector_stores + vector_stores_from_db: - vector_store_id = vector_store.get("vector_store_id", None) - if vector_store_id not in seen_vector_store_ids: - combined_vector_stores.append(vector_store) - seen_vector_store_ids.add(vector_store_id) + # Use database as single source of truth for listing + combined_vector_stores: List[LiteLLM_ManagedVectorStore] = vector_stores_from_db total_count = len(combined_vector_stores) total_pages = (total_count + page_size - 1) // page_size diff --git a/litellm/integrations/vector_store_integrations/vector_store_pre_call_hook.py b/litellm/integrations/vector_store_integrations/vector_store_pre_call_hook.py index 236935778d6..218581a41ad 100644 --- a/litellm/integrations/vector_store_integrations/vector_store_pre_call_hook.py +++ b/litellm/integrations/vector_store_integrations/vector_store_pre_call_hook.py @@ -74,9 +74,20 @@ class VectorStorePreCallHook(CustomLogger): if litellm.vector_store_registry is None: return model, messages, non_default_params + # Get prisma_client for database fallback + prisma_client = None + try: + from litellm.proxy.proxy_server import prisma_client as _prisma_client + prisma_client = _prisma_client + except ImportError: + pass + + # Use database fallback to ensure synchronization across instances vector_stores_to_run: List[LiteLLM_ManagedVectorStore] = ( - litellm.vector_store_registry.pop_vector_stores_to_run( - non_default_params=non_default_params, tools=tools + await litellm.vector_store_registry.pop_vector_stores_to_run_with_db_fallback( + non_default_params=non_default_params, + tools=tools, + prisma_client=prisma_client ) ) diff --git a/litellm/vector_stores/vector_store_registry.py b/litellm/vector_stores/vector_store_registry.py index 78c8d7cf2ec..cf0bf89d701 100644 --- a/litellm/vector_stores/vector_store_registry.py +++ b/litellm/vector_stores/vector_store_registry.py @@ -233,6 +233,36 @@ class VectorStoreRegistry: return vector_store return None + async def get_litellm_managed_vector_store_from_registry_or_db( + self, vector_store_id: str, prisma_client: Optional[PrismaClient] = None + ) -> Optional[LiteLLM_ManagedVectorStore]: + """ + Returns the vector store from the registry, falling back to database if not found. + This ensures synchronization across multiple instances. + """ + # First check in-memory registry + vector_store = self.get_litellm_managed_vector_store_from_registry(vector_store_id) + if vector_store is not None: + return vector_store + + # Fall back to database if not found in memory + if prisma_client is not None: + try: + vector_stores_from_db = await self._get_vector_stores_from_db( + prisma_client=prisma_client + ) + for db_vector_store in vector_stores_from_db: + if db_vector_store.get("vector_store_id") == vector_store_id: + # Add to in-memory registry for future use + self.add_vector_store_to_registry(vector_store=db_vector_store) + return db_vector_store + except Exception as e: + verbose_logger.debug( + f"Error fetching vector store from database: {str(e)}" + ) + + return None + def get_litellm_managed_vector_store_from_registry_by_name( self, vector_store_name: str ) -> Optional[LiteLLM_ManagedVectorStore]: @@ -289,6 +319,95 @@ class VectorStoreRegistry: return vector_stores_to_run + async def pop_vector_stores_to_run_with_db_fallback( + self, + non_default_params: Dict, + tools: Optional[List[Dict]] = None, + prisma_client: Optional[PrismaClient] = None + ) -> List[LiteLLM_ManagedVectorStore]: + """ + Pops the vector stores to run with their tool parameters merged. + Falls back to database if vector stores are not found in memory. + This ensures synchronization across multiple instances. + + Primary function to use for vector store pre call hook. + + Args: + non_default_params: Parameters dict to pop vector_store_ids from + tools: Optional list of tools to extract vector store params from + prisma_client: Optional database client for fallback lookup + + Returns: + List of vector stores with tool parameters merged into litellm_params + """ + # Pop vector_store_ids from params + vector_store_ids: List[str] = non_default_params.pop("vector_store_ids", None) or [] + + # Extract params from tools and collect IDs + params_by_id = self.get_and_pop_recognised_vector_store_tools( + tools=tools, + vector_store_ids=vector_store_ids + ) + + vector_stores_to_run: List[LiteLLM_ManagedVectorStore] = [] + + for vector_store_id in vector_store_ids: + vector_store = None + + # First check in-memory registry + for vs in self.vector_stores: + if vs.get("vector_store_id") == vector_store_id: + vector_store = vs + break + + # Verify vector store still exists in database (if we have DB access) + # This ensures deleted vector stores are removed from cache + if vector_store is not None and prisma_client is not None: + try: + # Check if it still exists in database + db_vector_store = await prisma_client.db.litellm_managedvectorstorestable.find_unique( + where={"vector_store_id": vector_store_id} + ) + if db_vector_store is None: + # Vector store was deleted from database, remove from cache + verbose_logger.debug( + f"Vector store {vector_store_id} found in memory but deleted from database, removing from cache" + ) + self.delete_vector_store_from_registry(vector_store_id=vector_store_id) + vector_store = None + except Exception as e: + verbose_logger.debug( + f"Error verifying vector store {vector_store_id} in database: {str(e)}" + ) + + # Fall back to database if not found in memory (or was deleted) + if vector_store is None and prisma_client is not None: + try: + vector_store = await self.get_litellm_managed_vector_store_from_registry_or_db( + vector_store_id=vector_store_id, + prisma_client=prisma_client + ) + except Exception as e: + verbose_logger.debug( + f"Error fetching vector store {vector_store_id} from database: {str(e)}" + ) + + if vector_store is not None: + # Create a copy to avoid modifying the registry + vector_store_copy = vector_store.copy() + + # Merge tool params if they exist + if vector_store_id in params_by_id: + existing_params = vector_store_copy.get("litellm_params", {}) or {} + tool_params_dict = params_by_id[vector_store_id].to_dict() + # Tool params take precedence over existing params + tool_params_dict.update(existing_params) + vector_store_copy["litellm_params"] = tool_params_dict + + vector_stores_to_run.append(vector_store_copy) + + return vector_stores_to_run + def _get_vector_store_ids_from_tool_calls( self, tools: Optional[List[Dict]] = None, vector_store_ids: List[str] = [] ) -> List[str]: diff --git a/tests/test_litellm/proxy/vector_store_endpoints/test_vector_store_endpoints.py b/tests/test_litellm/proxy/vector_store_endpoints/test_vector_store_endpoints.py index badbef42d6c..b98354032fe 100644 --- a/tests/test_litellm/proxy/vector_store_endpoints/test_vector_store_endpoints.py +++ b/tests/test_litellm/proxy/vector_store_endpoints/test_vector_store_endpoints.py @@ -1,5 +1,6 @@ import os import sys +from datetime import datetime, timezone from unittest.mock import AsyncMock, MagicMock, patch import pytest @@ -802,3 +803,245 @@ class TestVectorStoreManagementEndpointsExist: f"Expected endpoint {method} {path} not found in registered routes. " f"Available routes: {app_routes}" ) + + +@pytest.mark.asyncio +async def test_vector_store_synchronization_across_instances(): + """ + Test that vector stores are properly synchronized across multiple instances. + + This test simulates the scenario where: + 1. Instance 1 creates a vector store (writes to DB, updates its own cache) + 2. Instance 2 should be able to find it (via database fallback) + 3. Instance 1 deletes the vector store (removes from DB, updates its own cache) + 4. Instance 2 should not show it in the list (database is source of truth) + """ + from datetime import datetime, timezone + from unittest.mock import AsyncMock, MagicMock + + from litellm.types.vector_stores import ( + LiteLLM_ManagedVectorStore, + VectorStoreDeleteRequest, + ) + from litellm.vector_stores.vector_store_registry import VectorStoreRegistry + + # Simulate two instances with separate in-memory registries + instance_1_registry = VectorStoreRegistry(vector_stores=[]) + instance_2_registry = VectorStoreRegistry(vector_stores=[]) + + # Mock database that both instances share + mock_db_vector_stores = [] + + async def mock_find_unique(where): + """Mock find_unique for checking if vector store exists""" + vector_store_id = where.get("vector_store_id") + for vs in mock_db_vector_stores: + if vs.get("vector_store_id") == vector_store_id: + # Create a simple object that dict() can convert + class MockVectorStore: + def __init__(self, data): + for key, value in data.items(): + setattr(self, key, value) + self._data = data + + def __iter__(self): + return iter(self._data.items()) + return MockVectorStore(vs) + return None + + async def mock_find_many(order=None): + """Mock find_many for listing vector stores""" + # Return objects that can be converted to dict using dict() + # The _get_vector_stores_from_db uses dict(vector_store), so we need to make it work + result = [] + for vs in mock_db_vector_stores: + # Create a simple object that dict() can convert + class MockVectorStore: + def __init__(self, data): + for key, value in data.items(): + setattr(self, key, value) + self._data = data + + def __iter__(self): + return iter(self._data.items()) + result.append(MockVectorStore(vs)) + return result + + async def mock_create(data): + """Mock create for adding vector store to DB""" + vector_store = data.copy() + mock_db_vector_stores.append(vector_store) + mock_obj = MagicMock() + mock_obj.model_dump.return_value = vector_store + for key, value in vector_store.items(): + setattr(mock_obj, key, value) + return mock_obj + + async def mock_delete(where): + """Mock delete for removing vector store from DB""" + vector_store_id = where.get("vector_store_id") + mock_db_vector_stores[:] = [ + vs for vs in mock_db_vector_stores + if vs.get("vector_store_id") != vector_store_id + ] + return None + + # Create mock prisma client + mock_prisma_client = MagicMock() + mock_prisma_client.db.litellm_managedvectorstorestable.find_unique = AsyncMock( + side_effect=mock_find_unique + ) + mock_prisma_client.db.litellm_managedvectorstorestable.find_many = AsyncMock( + side_effect=mock_find_many + ) + mock_prisma_client.db.litellm_managedvectorstorestable.create = AsyncMock( + side_effect=mock_create + ) + mock_prisma_client.db.litellm_managedvectorstorestable.delete = AsyncMock( + side_effect=mock_delete + ) + + # Test vector store data + test_vector_store_id = "test-sync-store-001" + test_vector_store: LiteLLM_ManagedVectorStore = { + "vector_store_id": test_vector_store_id, + "custom_llm_provider": "bedrock", + "vector_store_name": "Test Sync Store", + "vector_store_description": "Testing synchronization", + "litellm_params": { + "vector_store_id": test_vector_store_id, + "custom_llm_provider": "bedrock", + "region_name": "us-east-1" + }, + "created_at": datetime.now(timezone.utc), + "updated_at": datetime.now(timezone.utc), + } + + # Step 1: Create vector store on Instance 1 + # (Simulate what happens in new_vector_store endpoint) + await mock_prisma_client.db.litellm_managedvectorstorestable.create( + data=test_vector_store + ) + instance_1_registry.add_vector_store_to_registry(vector_store=test_vector_store) + + # Verify it's in Instance 1's memory + assert instance_1_registry.get_litellm_managed_vector_store_from_registry( + test_vector_store_id + ) is not None, "Vector store should be in Instance 1's memory" + + # Verify it's in the database + db_store = await mock_prisma_client.db.litellm_managedvectorstorestable.find_unique( + where={"vector_store_id": test_vector_store_id} + ) + assert db_store is not None, "Vector store should be in database" + + # Step 2: Instance 2 should be able to find it via database fallback + # (Simulate what happens in pop_vector_stores_to_run_with_db_fallback) + found_store = await instance_2_registry.get_litellm_managed_vector_store_from_registry_or_db( + vector_store_id=test_vector_store_id, + prisma_client=mock_prisma_client + ) + assert found_store is not None, "Instance 2 should find vector store from database" + assert found_store.get("vector_store_id") == test_vector_store_id + + # Verify it's now cached in Instance 2's memory + assert instance_2_registry.get_litellm_managed_vector_store_from_registry( + test_vector_store_id + ) is not None, "Vector store should now be cached in Instance 2's memory" + + # Step 3: Test that Instance 2 can list vector stores from database + # (Simulate what happens in list_vector_stores endpoint - using DB as source of truth) + vector_stores_from_db = await VectorStoreRegistry._get_vector_stores_from_db( + prisma_client=mock_prisma_client + ) + + # Verify vector store appears in the database list + vector_store_ids = [vs.get("vector_store_id") for vs in vector_stores_from_db] + assert test_vector_store_id in vector_store_ids, ( + "Instance 2 should see vector store from database" + ) + + # Verify the list endpoint logic: only show DB stores (filter out stale cache) + # This simulates what list_vector_stores does + db_vector_store_ids = { + vs.get("vector_store_id") + for vs in vector_stores_from_db + if vs.get("vector_store_id") + } + + # Instance 2's in-memory cache should only contain stores that exist in DB + # (This is what the list endpoint cleanup does) + for vs in list(instance_2_registry.vector_stores): + vs_id = vs.get("vector_store_id") + if vs_id and vs_id not in db_vector_store_ids: + instance_2_registry.delete_vector_store_from_registry(vector_store_id=vs_id) + + # After cleanup, instance 2 should still have the vector store (it's in DB) + assert instance_2_registry.get_litellm_managed_vector_store_from_registry( + test_vector_store_id + ) is not None, "Instance 2 should still have vector store (it exists in DB)" + + # Step 4: Delete vector store on Instance 1 + # (Simulate what happens in delete_vector_store endpoint) + await mock_prisma_client.db.litellm_managedvectorstorestable.delete( + where={"vector_store_id": test_vector_store_id} + ) + instance_1_registry.delete_vector_store_from_registry( + vector_store_id=test_vector_store_id + ) + + # Verify it's removed from Instance 1's memory + assert instance_1_registry.get_litellm_managed_vector_store_from_registry( + test_vector_store_id + ) is None, "Vector store should be removed from Instance 1's memory" + + # Verify it's removed from database + db_store_after_delete = await mock_prisma_client.db.litellm_managedvectorstorestable.find_unique( + where={"vector_store_id": test_vector_store_id} + ) + assert db_store_after_delete is None, "Vector store should be removed from database" + + # Step 5: Instance 2 should NOT show it in the list (database is source of truth) + # The list endpoint logic should clean up stale cache entries + vector_stores_from_db_after_delete = await VectorStoreRegistry._get_vector_stores_from_db( + prisma_client=mock_prisma_client + ) + + # Verify vector store does NOT appear in the database list + vector_store_ids_after_delete = [vs.get("vector_store_id") for vs in vector_stores_from_db_after_delete] + assert test_vector_store_id not in vector_store_ids_after_delete, ( + "Deleted vector store should not be in database" + ) + + # Simulate list endpoint cleanup logic + db_vector_store_ids_after_delete = { + vs.get("vector_store_id") + for vs in vector_stores_from_db_after_delete + if vs.get("vector_store_id") + } + + # Remove any in-memory vector stores that no longer exist in database + for vs in list(instance_2_registry.vector_stores): + vs_id = vs.get("vector_store_id") + if vs_id and vs_id not in db_vector_store_ids_after_delete: + instance_2_registry.delete_vector_store_from_registry(vector_store_id=vs_id) + + # Verify it was removed from Instance 2's cache + assert instance_2_registry.get_litellm_managed_vector_store_from_registry( + test_vector_store_id + ) is None, ( + "Deleted vector store should be removed from Instance 2's cache" + ) + + # Step 6: Test that using a deleted vector store fails gracefully + # (Simulate what happens in pop_vector_stores_to_run_with_db_fallback) + non_default_params = {"vector_store_ids": [test_vector_store_id]} + vector_stores_to_run = await instance_2_registry.pop_vector_stores_to_run_with_db_fallback( + non_default_params=non_default_params, + tools=None, + prisma_client=mock_prisma_client + ) + + assert len(vector_stores_to_run) == 0, ( + "Deleted vector store should not be returned when trying to use it" + ) From 50283a00a3eea4bc3bb862193e32c924fb4f47cc Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Thu, 4 Dec 2025 22:51:52 -0800 Subject: [PATCH 057/178] e2e fix --- .../proxy_admin_ui_tests/e2e_ui_tests/view_internal_user.spec.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/proxy_admin_ui_tests/e2e_ui_tests/view_internal_user.spec.ts b/tests/proxy_admin_ui_tests/e2e_ui_tests/view_internal_user.spec.ts index 2aae9e2bb54..853b2155b8d 100644 --- a/tests/proxy_admin_ui_tests/e2e_ui_tests/view_internal_user.spec.ts +++ b/tests/proxy_admin_ui_tests/e2e_ui_tests/view_internal_user.spec.ts @@ -31,6 +31,7 @@ test("view internal user page", async ({ page }) => { // Wait for the table to load await page.waitForSelector("tbody tr", { timeout: 10000 }); await page.waitForTimeout(2000); // Additional wait for table to stabilize + await page.waitForLoadState("networkidle"); // Test all expected fields are present // Verify that the API Keys column is rendered for all users From c8fbcc7f1c2b08130822d925a41caef5114ed3b8 Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Fri, 5 Dec 2025 12:32:23 +0530 Subject: [PATCH 058/178] add tutorial as well --- .../docs/tutorials/cursor_integration.md | 226 ++++++++++++++++++ docs/my-website/sidebars.js | 27 +-- 2 files changed, 227 insertions(+), 26 deletions(-) create mode 100644 docs/my-website/docs/tutorials/cursor_integration.md diff --git a/docs/my-website/docs/tutorials/cursor_integration.md b/docs/my-website/docs/tutorials/cursor_integration.md new file mode 100644 index 00000000000..f0d87b050cf --- /dev/null +++ b/docs/my-website/docs/tutorials/cursor_integration.md @@ -0,0 +1,226 @@ +--- +sidebar_label: "Cursor IDE" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Cursor IDE Integration with LiteLLM + +This tutorial shows you how to integrate Cursor IDE with LiteLLM Proxy, allowing you to use any LiteLLM-supported model through Cursor's interface with BYOK (Bring Your Own Key) and custom base URL. + +## Benefits of using Cursor with LiteLLM + +When you use Cursor IDE with LiteLLM you get the following benefits: + +**Developer Benefits:** +- Universal Model Access: Use any LiteLLM supported model (Anthropic, OpenAI, Vertex AI, Bedrock, etc.) through the Cursor IDE interface. +- Higher Rate Limits & Reliability: Load balance across multiple models and providers to avoid hitting individual provider limits, with fallbacks to ensure you get responses even if one provider fails. +- Streaming Support: Full streaming support with proper response transformation for Cursor's expected format. + +**Proxy Admin Benefits:** +- Centralized Management: Control access to all models through a single LiteLLM proxy instance without giving your developers API Keys to each provider. +- Budget Controls: Set spending limits and track costs across all Cursor usage. +- Request Logging: Track all requests made through Cursor for debugging and monitoring. + +## Prerequisites + +Before you begin, ensure you have: +- Cursor IDE installed +- A running LiteLLM Proxy instance with **HTTPS enabled** (HTTP is not supported) +- A valid LiteLLM Proxy API key +- An HTTPS domain for your LiteLLM Proxy (required by Cursor) + +## Quick Start Guide + +### Step 1: Install LiteLLM + +Install LiteLLM with proxy support: + +```bash +pip install litellm[proxy] +``` + +### Step 2: Configure LiteLLM Proxy + +Create a `config.yaml` file with your model configurations: + +```yaml showLineNumbers title="config.yaml" +model_list: + - model_name: gpt-4o + litellm_params: + model: gpt-4o + api_key: os.environ/OPENAI_API_KEY + + - model_name: claude-3-5-sonnet + litellm_params: + model: anthropic/claude-3-5-sonnet-20241022 + api_key: os.environ/ANTHROPIC_API_KEY + +general_settings: + master_key: sk-1234567890 # Change this to a secure key +``` + +### Step 3: Start LiteLLM Proxy + +Start the proxy server with HTTPS enabled: + +```bash +litellm --config config.yaml --port 4000 +``` + +:::warning HTTPS Required + +**Important**: Cursor IDE requires HTTPS connections. HTTP (`http://`) will not work. You must: +- Deploy your LiteLLM Proxy with HTTPS enabled +- Use a valid SSL certificate +- Access the proxy via an HTTPS domain (e.g., `https://your-proxy-domain.com`) + +For local development, you'll need to set up HTTPS (e.g., using a reverse proxy like nginx with SSL, or deploying to a cloud service with HTTPS). + +::: + +### Step 4: Configure Cursor IDE + +Configure Cursor IDE to use your LiteLLM proxy with the `/cursor/chat/completions` endpoint: + +1. Open Cursor IDE +2. Go to **Settings** → **Features** → **AI** +3. Enable **"Use Custom API"** or **"Bring Your Own Key"** +4. Set the following: + - **Base URL**: `https://your-proxy-domain.com/cursor` (āš ļø **Important**: Must use HTTPS and include `/cursor`) + - **API Key**: Your LiteLLM Proxy API key (e.g., `sk-1234567890`) + +:::warning HTTPS Required + +Cursor IDE **requires HTTPS** connections. HTTP (`http://`) will not work. You must: +- Use an HTTPS URL for your base URL (e.g., `https://your-proxy-domain.com/cursor`) +- Ensure your LiteLLM Proxy is accessible via HTTPS +- Have a valid SSL certificate configured + +::: + +**Example Configuration:** + +``` +Base URL: https://your-proxy-domain.com/cursor +API Key: sk-1234567890 +``` + +Replace `your-proxy-domain.com` with your actual HTTPS domain where LiteLLM Proxy is running. + +:::info Why `/cursor` in the base URL? + +Cursor automatically appends `/chat/completions` to the base URL you provide. By setting the base URL to `https://your-proxy-domain.com/cursor`, Cursor will send requests to `/cursor/chat/completions`, which is the special endpoint that handles Cursor's Responses API input format and transforms it to Chat Completions output format. + +If you set the base URL to just `https://your-proxy-domain.com`, Cursor would send requests to `/chat/completions`, which won't work correctly with Cursor's request format. + + +::: + +### Step 5: Test the Integration + +1. Restart Cursor IDE to apply the settings +2. Open a code file and try using Cursor's AI features (completions, chat, etc.) +3. Your requests will now be routed through LiteLLM Proxy + +You can verify it's working by: +- Checking the LiteLLM Proxy logs for incoming requests +- Using Cursor's chat feature and seeing responses stream correctly +- Checking your LiteLLM dashboard for request logs and cost tracking + +## How It Works + +The `/cursor/chat/completions` endpoint is specifically designed to handle Cursor's unique request format: + +1. **Input**: Cursor sends requests in OpenAI Responses API format (with `input` field) +2. **Processing**: LiteLLM processes the request through its internal `/responses` flow +3. **Output**: The response is transformed to OpenAI Chat Completions format (with `choices` field) that Cursor expects + +This transformation happens automatically for both streaming and non-streaming responses. + +## Advanced Configuration + +### Using Different Models + +You can configure Cursor to use different models by updating your `config.yaml`: + +```yaml showLineNumbers title="config.yaml" +model_list: + - model_name: gpt-4o + litellm_params: + model: gpt-4o + api_key: os.environ/OPENAI_API_KEY + + - model_name: claude-3-5-sonnet + litellm_params: + model: anthropic/claude-3-5-sonnet-20241022 + api_key: os.environ/ANTHROPIC_API_KEY + + - model_name: gemini-pro + litellm_params: + model: gemini/gemini-1.5-pro + api_key: os.environ/GEMINI_API_KEY +``` + +Then in Cursor, you can specify which model to use in your requests. + +### Rate Limiting and Budgets + +Set up rate limits and budgets in your `config.yaml`: + +```yaml showLineNumbers title="config.yaml" +general_settings: + master_key: sk-1234567890 + +litellm_settings: + # Set max budget per user + max_budget: 100.0 + + # Set rate limits + rate_limit: 100 # requests per minute +``` + +### Request Logging + +All requests from Cursor will be logged by LiteLLM Proxy. You can: +- View logs in the LiteLLM Admin UI +- Export logs to your preferred logging service +- Track costs per user/team + +## Troubleshooting + +### Cursor shows no output + +- **Check base URL**: Ensure it uses HTTPS and includes `/cursor` (e.g., `https://your-proxy-domain.com/cursor`, not `http://` or without `/cursor`) +- **Verify HTTPS**: Cursor requires HTTPS - HTTP connections will not work +- **Check API key**: Verify your LiteLLM Proxy API key is correct +- **Check proxy logs**: Look for errors in the LiteLLM Proxy logs + +### Requests failing + +- **Verify HTTPS is enabled**: Cursor requires HTTPS connections. Ensure your LiteLLM Proxy is accessible via HTTPS with a valid SSL certificate +- **Verify proxy is running**: Check that LiteLLM Proxy is accessible at your HTTPS base URL +- **Check SSL certificate**: Ensure your SSL certificate is valid and not expired +- **Check model configuration**: Ensure the model you're trying to use is configured in `config.yaml` +- **Check API keys**: Verify provider API keys are set correctly in environment variables + +### HTTP not working + +If you're trying to use HTTP (`http://`) and it's not working: +- **This is expected**: Cursor IDE requires HTTPS connections +- **Solution**: Deploy your LiteLLM Proxy with HTTPS enabled (use a reverse proxy like nginx, or deploy to a cloud service that provides HTTPS) + +### Streaming not working + +The `/cursor/chat/completions` endpoint automatically handles streaming. If streaming isn't working: +- Check that your model supports streaming +- Verify the proxy logs for any transformation errors +- Ensure Cursor IDE is up to date + +## Related Documentation + +- [Cursor Endpoint Documentation](/docs/proxy/cursor) - Detailed endpoint documentation +- [LiteLLM Proxy Setup](/docs/proxy/quick_start) - General proxy setup guide +- [Model Configuration](/docs/proxy/configs) - How to configure models + diff --git a/docs/my-website/sidebars.js b/docs/my-website/sidebars.js index a2f1339f1e3..0481e646f9e 100644 --- a/docs/my-website/sidebars.js +++ b/docs/my-website/sidebars.js @@ -105,6 +105,7 @@ const sidebars = { items: [ "tutorials/claude_responses_api", "tutorials/cost_tracking_coding", + "tutorials/cursor_integration", "tutorials/github_copilot_integration", "tutorials/litellm_gemini_cli", "tutorials/litellm_qwen_code_cli", @@ -129,16 +130,6 @@ const sidebars = { }, items: [ "proxy/docker_quick_start", - { - type: "link", - label: "A2A Agent Gateway", - href: "https://docs.litellm.ai/docs/a2a", - }, - { - type: "link", - label: "MCP Gateway", - href: "https://docs.litellm.ai/docs/mcp", - }, { "type": "category", "label": "Config.yaml", @@ -195,7 +186,6 @@ const sidebars = { label: "Architecture", items: [ "proxy/architecture", - "proxy/multi_tenant_architecture", "proxy/control_plane_and_data_plane", "proxy/db_deadlocks", "proxy/db_info", @@ -327,14 +317,6 @@ const sidebars = { slug: "/supported_endpoints", }, items: [ - { - type: "category", - label: "/a2a - A2A Agent Gateway", - items: [ - "a2a", - "a2a_agent_permissions", - ], - }, "assistants", { type: "category", @@ -448,7 +430,6 @@ const sidebars = { "realtime", "rerank", "response_api", - "proxy/cursor", { type: "category", label: "/search", @@ -491,11 +472,6 @@ const sidebars = { id: "provider_registration/index", label: "Integrate as a Model Provider", }, - { - type: "doc", - id: "contributing/adding_openai_compatible_providers", - label: "Add OpenAI-Compatible Provider (JSON)", - }, { type: "doc", id: "provider_registration/add_model_pricing", @@ -820,7 +796,6 @@ const sidebars = { type: "category", label: "Adding Providers", items: [ - "contributing/adding_openai_compatible_providers", "adding_provider/directory_structure", "adding_provider/new_rerank_provider", ] From 37bfe65bdd897d415674133123f3d78347d95b42 Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Thu, 4 Dec 2025 23:05:00 -0800 Subject: [PATCH 059/178] Adding screenshot to debug --- .../e2e_ui_tests/view_internal_user.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/proxy_admin_ui_tests/e2e_ui_tests/view_internal_user.spec.ts b/tests/proxy_admin_ui_tests/e2e_ui_tests/view_internal_user.spec.ts index 853b2155b8d..8be5ff0c540 100644 --- a/tests/proxy_admin_ui_tests/e2e_ui_tests/view_internal_user.spec.ts +++ b/tests/proxy_admin_ui_tests/e2e_ui_tests/view_internal_user.spec.ts @@ -40,7 +40,7 @@ test("view internal user page", async ({ page }) => { expect(rowCount).toBeGreaterThan(0); const userIdHeader = page.locator("th", { hasText: "User ID" }); - page.screenshot({ path: "user_id_header.png" }); + page.screenshot({ path: "test-results/user_id_header.png" }); await expect(userIdHeader).toBeVisible(); // test pagination From 3d6b7f0d3d9f5264a61f34ba05f38f83934d871c Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Fri, 5 Dec 2025 14:27:37 +0530 Subject: [PATCH 060/178] Add background health checks to db --- .../health_endpoints/_health_endpoints.py | 205 ++++++++++ litellm/proxy/proxy_server.py | 30 +- litellm/proxy/utils.py | 12 +- .../proxy/test_health_check_functions.py | 387 +++++++++++++++++- 4 files changed, 627 insertions(+), 7 deletions(-) diff --git a/litellm/proxy/health_endpoints/_health_endpoints.py b/litellm/proxy/health_endpoints/_health_endpoints.py index 2226e190901..5e4784d709e 100644 --- a/litellm/proxy/health_endpoints/_health_endpoints.py +++ b/litellm/proxy/health_endpoints/_health_endpoints.py @@ -397,6 +397,211 @@ async def _save_health_check_to_db( # Continue execution - don't let database save failure break health checks +def _build_model_param_to_info_mapping(model_list: list) -> dict: + """ + Build a mapping from model parameter to model info (model_name, model_id). + + Multiple models might share the same model parameter, so we use a list. + + Args: + model_list: List of model configurations + + Returns: + Dictionary mapping model parameter to list of model info dicts + """ + model_param_to_info = {} + for model in model_list: + model_info = model.get("model_info", {}) + model_name = model.get("model_name") + model_id = model_info.get("id") + litellm_params = model.get("litellm_params", {}) + model_param = litellm_params.get("model") + + if model_param and model_name: + if model_param not in model_param_to_info: + model_param_to_info[model_param] = [] + model_param_to_info[model_param].append({ + "model_name": model_name, + "model_id": model_id, + }) + return model_param_to_info + + +def _aggregate_health_check_results( + model_param_to_info: dict, + healthy_endpoints: list, + unhealthy_endpoints: list, +) -> dict: + """ + Aggregate health check results per unique model. + + Uses (model_id, model_name) as key, or (None, model_name) if model_id is None. + + Args: + model_param_to_info: Mapping from model parameter to model info + healthy_endpoints: List of healthy endpoint results + unhealthy_endpoints: List of unhealthy endpoint results + + Returns: + Dictionary mapping (model_id, model_name) to aggregated health check results + """ + model_results = {} + + # Process healthy endpoints + for endpoint in healthy_endpoints: + model_param = endpoint.get("model") + if model_param and model_param in model_param_to_info: + for model_info in model_param_to_info[model_param]: + key = (model_info["model_id"], model_info["model_name"]) + if key not in model_results: + model_results[key] = { + "model_name": model_info["model_name"], + "model_id": model_info["model_id"], + "healthy_count": 0, + "unhealthy_count": 0, + "error_message": None, + } + model_results[key]["healthy_count"] += 1 + + # Process unhealthy endpoints + for endpoint in unhealthy_endpoints: + model_param = endpoint.get("model") + error_message = endpoint.get("error") + if model_param and model_param in model_param_to_info: + for model_info in model_param_to_info[model_param]: + key = (model_info["model_id"], model_info["model_name"]) + if key not in model_results: + model_results[key] = { + "model_name": model_info["model_name"], + "model_id": model_info["model_id"], + "healthy_count": 0, + "unhealthy_count": 0, + "error_message": None, + } + model_results[key]["unhealthy_count"] += 1 + # Use the first error message encountered + if not model_results[key]["error_message"] and error_message: + model_results[key]["error_message"] = str(error_message)[:500] + + return model_results + + +async def _save_health_check_results_if_changed( + prisma_client, + model_results: dict, + latest_checks_map: dict, + start_time: float, + checked_by: Optional[str] = None, +): + """ + Save health check results to database, but only if status changed or >1 hour since last save. + + OPTIMIZATION: Only saves to database if the status has changed from the last saved check. + This dramatically reduces database writes when health status remains stable. + + - Stable systems: ~1 write/hour per model (instead of 12 writes/hour with 5-min intervals) + - Status changes: Immediate write (no delay) + - Result: ~92% reduction in DB writes for stable systems, while maintaining real-time updates on changes + + Args: + prisma_client: Database client + model_results: Dictionary of aggregated health check results per model + latest_checks_map: Dictionary mapping model_id/model_name to latest health check + start_time: Start time of health check for calculating response time + checked_by: Identifier for who/what performed the check + """ + for result in model_results.values(): + new_status = "healthy" if result["healthy_count"] > 0 else "unhealthy" + + # Check if we should save this result + should_save = True + lookup_key = result["model_id"] if result["model_id"] else result["model_name"] + if lookup_key in latest_checks_map: + last_check = latest_checks_map[lookup_key] + # Only save if status changed or if it's been a while since last check + if last_check.status == new_status: + # Check if last check was recent (within 1 hour) + if last_check.checked_at: + from datetime import datetime, timezone + time_since_last_check = ( + datetime.now(timezone.utc) - last_check.checked_at + ).total_seconds() + # Only skip if status unchanged AND checked recently (within 1 hour) + # This ensures we still get periodic updates even if status is stable + if time_since_last_check < 3600: # 1 hour threshold + should_save = False + + if should_save: + asyncio.create_task( + prisma_client.save_health_check_result( + model_name=result["model_name"], + model_id=result["model_id"], + status=new_status, + healthy_count=result["healthy_count"], + unhealthy_count=result["unhealthy_count"], + error_message=result["error_message"], + response_time_ms=(time.time() - start_time) * 1000, + details=None, + checked_by=checked_by, + ) + ) + + +async def _save_background_health_checks_to_db( + prisma_client, + model_list: list, + healthy_endpoints: list, + unhealthy_endpoints: list, + start_time: float, + checked_by: Optional[str] = None, +): + """ + Save background health check results to database for each model. + + Maps health check endpoints back to their original models to get model_name and model_id. + Aggregates results per unique model (by model_id if available, otherwise model_name). + + OPTIMIZATION: Only saves to database if the status has changed from the last saved check. + This dramatically reduces database writes when health status remains stable. + """ + if prisma_client is None: + return + + try: + # Step 1: Build mapping from model parameter to model info + model_param_to_info = _build_model_param_to_info_mapping(model_list) + + # Step 2: Aggregate health check results per unique model + model_results = _aggregate_health_check_results( + model_param_to_info, + healthy_endpoints, + unhealthy_endpoints, + ) + + # Step 3: Get latest health checks for all models in one query to compare status + latest_checks = await prisma_client.get_all_latest_health_checks() + latest_checks_map = {} + for check in latest_checks: + # Use model_id as primary key, fallback to model_name + key = check.model_id if check.model_id else check.model_name + if key not in latest_checks_map: + latest_checks_map[key] = check + + # Step 4: Save aggregated results, but only if status changed + await _save_health_check_results_if_changed( + prisma_client, + model_results, + latest_checks_map, + start_time, + checked_by, + ) + except Exception as db_error: + verbose_proxy_logger.warning( + f"Failed to save background health checks to database: {db_error}" + ) + # Continue execution - don't let database save failure break health checks + + async def _perform_health_check_and_save( model_list, target_model, diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index e1d5a90dc79..fe8e94d7747 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -1578,7 +1578,7 @@ async def _run_background_health_check(): Update health_check_results, based on this. Uses shared health check state when Redis is available to coordinate across pods. """ - global health_check_results, llm_model_list, health_check_interval, health_check_details, use_shared_health_check, redis_usage_cache + global health_check_results, llm_model_list, health_check_interval, health_check_details, use_shared_health_check, redis_usage_cache, prisma_client if ( health_check_interval is None @@ -1645,6 +1645,34 @@ async def _run_background_health_check(): health_check_results["healthy_count"] = len(healthy_endpoints) health_check_results["unhealthy_count"] = len(unhealthy_endpoints) + # Save background health checks to database (non-blocking) + if prisma_client is not None: + import time as time_module + + from litellm.proxy.health_endpoints._health_endpoints import ( + _save_background_health_checks_to_db, + ) + + # Use pod_id or a system identifier for checked_by if shared health check is enabled + checked_by = None + if shared_health_manager is not None: + checked_by = shared_health_manager.pod_id + else: + # Use a system identifier for background health checks + checked_by = "background_health_check" + + start_time = time_module.time() + asyncio.create_task( + _save_background_health_checks_to_db( + prisma_client, + _llm_model_list, + healthy_endpoints, + unhealthy_endpoints, + start_time, + checked_by=checked_by, + ) + ) + await asyncio.sleep(health_check_interval) diff --git a/litellm/proxy/utils.py b/litellm/proxy/utils.py index aca9bd96eb9..7f23345d26e 100644 --- a/litellm/proxy/utils.py +++ b/litellm/proxy/utils.py @@ -3094,8 +3094,16 @@ class PrismaClient: # Group by model_name and get the latest for each latest_checks = {} for check in all_checks: - if check.model_name not in latest_checks: - latest_checks[check.model_name] = check + # Create a unique key: prefer model_id if available, otherwise use model_name + # This ensures we get the latest check for each unique model + if check.model_id: + key = (check.model_id, check.model_name) + else: + key = (None, check.model_name) + + # Only add if we haven't seen this key yet (since checks are ordered by checked_at desc) + if key not in latest_checks: + latest_checks[key] = check return list(latest_checks.values()) except Exception as e: diff --git a/tests/test_litellm/proxy/test_health_check_functions.py b/tests/test_litellm/proxy/test_health_check_functions.py index 4f014ce1bee..ccae9fb5425 100644 --- a/tests/test_litellm/proxy/test_health_check_functions.py +++ b/tests/test_litellm/proxy/test_health_check_functions.py @@ -1,13 +1,22 @@ import asyncio -import pytest -from unittest.mock import AsyncMock, MagicMock -import sys import os +import sys +import time +from datetime import datetime, timedelta, timezone +from unittest.mock import AsyncMock, MagicMock, patch + +import pytest sys.path.insert(0, os.path.abspath("../../..")) +from litellm.proxy.health_endpoints._health_endpoints import ( + _aggregate_health_check_results, + _build_model_param_to_info_mapping, + _save_background_health_checks_to_db, + _save_health_check_results_if_changed, + _save_health_check_to_db, +) from litellm.proxy.utils import PrismaClient -from litellm.proxy.health_endpoints._health_endpoints import _save_health_check_to_db @pytest.fixture @@ -87,5 +96,375 @@ async def test_save_health_check_to_db_no_client(): assert result is None +# Tests for background health check functions + +def test_build_model_param_to_info_mapping(): + """Test building model parameter to info mapping""" + model_list = [ + { + "model_name": "gpt-3.5-turbo", + "model_info": {"id": "model-123"}, + "litellm_params": {"model": "gpt-3.5-turbo"}, + }, + { + "model_name": "gpt-4", + "model_info": {"id": "model-456"}, + "litellm_params": {"model": "gpt-4"}, + }, + { + "model_name": "gpt-3.5-turbo-alias", + "model_info": {"id": "model-789"}, + "litellm_params": {"model": "gpt-3.5-turbo"}, # Same model param + }, + ] + + result = _build_model_param_to_info_mapping(model_list) + + assert "gpt-3.5-turbo" in result + assert "gpt-4" in result + assert len(result["gpt-3.5-turbo"]) == 2 # Two models share same param + assert len(result["gpt-4"]) == 1 + assert result["gpt-3.5-turbo"][0]["model_name"] == "gpt-3.5-turbo" + assert result["gpt-3.5-turbo"][0]["model_id"] == "model-123" + assert result["gpt-3.5-turbo"][1]["model_name"] == "gpt-3.5-turbo-alias" + assert result["gpt-3.5-turbo"][1]["model_id"] == "model-789" + + +def test_build_model_param_to_info_mapping_no_model_name(): + """Test mapping skips models without model_name""" + model_list = [ + { + "model_info": {"id": "model-123"}, + "litellm_params": {"model": "gpt-3.5-turbo"}, + }, + ] + + result = _build_model_param_to_info_mapping(model_list) + assert len(result) == 0 + + +def test_aggregate_health_check_results(): + """Test aggregating health check results per model""" + model_param_to_info = { + "gpt-3.5-turbo": [ + {"model_name": "gpt-3.5-turbo", "model_id": "model-123"}, + ], + "gpt-4": [ + {"model_name": "gpt-4", "model_id": "model-456"}, + ], + } + + healthy_endpoints = [ + {"model": "gpt-3.5-turbo"}, + ] + unhealthy_endpoints = [ + {"model": "gpt-4", "error": "Rate limit exceeded"}, + ] + + result = _aggregate_health_check_results( + model_param_to_info, healthy_endpoints, unhealthy_endpoints + ) + + # Check gpt-3.5-turbo is healthy + gpt35_key = ("model-123", "gpt-3.5-turbo") + assert gpt35_key in result + assert result[gpt35_key]["healthy_count"] == 1 + assert result[gpt35_key]["unhealthy_count"] == 0 + assert result[gpt35_key]["error_message"] is None + + # Check gpt-4 is unhealthy + gpt4_key = ("model-456", "gpt-4") + assert gpt4_key in result + assert result[gpt4_key]["healthy_count"] == 0 + assert result[gpt4_key]["unhealthy_count"] == 1 + assert "Rate limit" in result[gpt4_key]["error_message"] + + +def test_aggregate_health_check_results_multiple_endpoints(): + """Test aggregation with multiple endpoints for same model""" + model_param_to_info = { + "gpt-3.5-turbo": [ + {"model_name": "gpt-3.5-turbo", "model_id": "model-123"}, + ], + } + + healthy_endpoints = [ + {"model": "gpt-3.5-turbo"}, + {"model": "gpt-3.5-turbo"}, + ] + unhealthy_endpoints = [] + + result = _aggregate_health_check_results( + model_param_to_info, healthy_endpoints, unhealthy_endpoints + ) + + key = ("model-123", "gpt-3.5-turbo") + assert result[key]["healthy_count"] == 2 + assert result[key]["unhealthy_count"] == 0 + + +@pytest.mark.asyncio +async def test_save_health_check_results_if_changed_status_changed(): + """Test saving when status changes""" + mock_prisma = MagicMock() + mock_prisma.save_health_check_result = AsyncMock() + + model_results = { + ("model-123", "gpt-3.5-turbo"): { + "model_name": "gpt-3.5-turbo", + "model_id": "model-123", + "healthy_count": 1, + "unhealthy_count": 0, + "error_message": None, + }, + } + + # Latest check shows unhealthy, new result is healthy (status changed) + latest_checks_map = { + "model-123": MagicMock( + status="unhealthy", + checked_at=datetime.now(timezone.utc) - timedelta(minutes=5), + ), + } + + start_time = 1234567890.0 + await _save_health_check_results_if_changed( + mock_prisma, model_results, latest_checks_map, start_time, "background_health_check" + ) + + # Should save because status changed + mock_prisma.save_health_check_result.assert_called_once() + call_kwargs = mock_prisma.save_health_check_result.call_args[1] + assert call_kwargs["status"] == "healthy" + assert call_kwargs["model_name"] == "gpt-3.5-turbo" + assert call_kwargs["checked_by"] == "background_health_check" + + +@pytest.mark.asyncio +async def test_save_health_check_results_if_changed_status_unchanged_recent(): + """Test skipping save when status unchanged and checked recently""" + mock_prisma = MagicMock() + mock_prisma.save_health_check_result = AsyncMock() + + model_results = { + ("model-123", "gpt-3.5-turbo"): { + "model_name": "gpt-3.5-turbo", + "model_id": "model-123", + "healthy_count": 1, + "unhealthy_count": 0, + "error_message": None, + }, + } + + # Latest check shows healthy, new result is healthy (status unchanged) + # And checked recently (within 1 hour) + latest_checks_map = { + "model-123": MagicMock( + status="healthy", + checked_at=datetime.now(timezone.utc) - timedelta(minutes=30), + ), + } + + start_time = 1234567890.0 + await _save_health_check_results_if_changed( + mock_prisma, model_results, latest_checks_map, start_time, "background_health_check" + ) + + # Should NOT save because status unchanged and checked recently + mock_prisma.save_health_check_result.assert_not_called() + + +@pytest.mark.asyncio +async def test_save_health_check_results_if_changed_status_unchanged_old(): + """Test saving when status unchanged but last check is old (>1 hour)""" + mock_prisma = MagicMock() + mock_prisma.save_health_check_result = AsyncMock() + + model_results = { + ("model-123", "gpt-3.5-turbo"): { + "model_name": "gpt-3.5-turbo", + "model_id": "model-123", + "healthy_count": 1, + "unhealthy_count": 0, + "error_message": None, + }, + } + + # Latest check shows healthy, new result is healthy (status unchanged) + # But checked >1 hour ago + latest_checks_map = { + "model-123": MagicMock( + status="healthy", + checked_at=datetime.now(timezone.utc) - timedelta(hours=2), + ), + } + + start_time = 1234567890.0 + await _save_health_check_results_if_changed( + mock_prisma, model_results, latest_checks_map, start_time, "background_health_check" + ) + + # Should save because last check is old (>1 hour) + mock_prisma.save_health_check_result.assert_called_once() + + +@pytest.mark.asyncio +async def test_save_health_check_results_if_changed_no_previous_check(): + """Test saving when there's no previous check""" + mock_prisma = MagicMock() + mock_prisma.save_health_check_result = AsyncMock() + + model_results = { + ("model-123", "gpt-3.5-turbo"): { + "model_name": "gpt-3.5-turbo", + "model_id": "model-123", + "healthy_count": 1, + "unhealthy_count": 0, + "error_message": None, + }, + } + + # No previous check + latest_checks_map = {} + + start_time = 1234567890.0 + await _save_health_check_results_if_changed( + mock_prisma, model_results, latest_checks_map, start_time, "background_health_check" + ) + + # Should save because no previous check + mock_prisma.save_health_check_result.assert_called_once() + + +@pytest.mark.asyncio +async def test_save_background_health_checks_to_db(): + """Test the main background health check save function""" + mock_prisma = MagicMock() + mock_prisma.save_health_check_result = AsyncMock() + mock_prisma.get_all_latest_health_checks = AsyncMock(return_value=[]) + + model_list = [ + { + "model_name": "gpt-3.5-turbo", + "model_info": {"id": "model-123"}, + "litellm_params": {"model": "gpt-3.5-turbo"}, + }, + ] + + healthy_endpoints = [{"model": "gpt-3.5-turbo"}] + unhealthy_endpoints = [] + + start_time = 1234567890.0 + + await _save_background_health_checks_to_db( + mock_prisma, model_list, healthy_endpoints, unhealthy_endpoints, start_time, "background_health_check" + ) + + # Should call get_all_latest_health_checks and save_health_check_result + mock_prisma.get_all_latest_health_checks.assert_called_once() + mock_prisma.save_health_check_result.assert_called_once() + + call_kwargs = mock_prisma.save_health_check_result.call_args[1] + assert call_kwargs["model_name"] == "gpt-3.5-turbo" + assert call_kwargs["model_id"] == "model-123" + assert call_kwargs["status"] == "healthy" + assert call_kwargs["checked_by"] == "background_health_check" + + +@pytest.mark.asyncio +async def test_save_background_health_checks_to_db_no_prisma(): + """Test graceful handling when no prisma client""" + result = await _save_background_health_checks_to_db( + None, [], [], [], 0.0, "background_health_check" + ) + assert result is None + + +@pytest.mark.asyncio +async def test_save_background_health_checks_to_db_exception_handling(): + """Test exception handling in background health check save""" + mock_prisma = MagicMock() + mock_prisma.get_all_latest_health_checks = AsyncMock(side_effect=Exception("DB Error")) + + model_list = [ + { + "model_name": "gpt-3.5-turbo", + "model_info": {"id": "model-123"}, + "litellm_params": {"model": "gpt-3.5-turbo"}, + }, + ] + + # Should not raise exception, should handle gracefully + await _save_background_health_checks_to_db( + mock_prisma, model_list, [], [], 0.0, "background_health_check" + ) + + # Function should complete without raising + + +@pytest.mark.asyncio +async def test_get_all_latest_health_checks_with_model_id(mock_prisma): + """Test get_all_latest_health_checks properly groups by model_id""" + # Create mock checks with same model_name but different model_id + mock_check1 = MagicMock() + mock_check1.model_id = "model-123" + mock_check1.model_name = "gpt-3.5-turbo" + mock_check1.checked_at = datetime.now(timezone.utc) - timedelta(minutes=10) + + mock_check2 = MagicMock() + mock_check2.model_id = "model-456" + mock_check2.model_name = "gpt-3.5-turbo" + mock_check2.checked_at = datetime.now(timezone.utc) - timedelta(minutes=5) + + mock_check3 = MagicMock() + mock_check3.model_id = "model-123" + mock_check3.model_name = "gpt-3.5-turbo" + mock_check3.checked_at = datetime.now(timezone.utc) - timedelta(minutes=1) # Latest for model-123 + + # Order by checked_at desc + mock_prisma.db.litellm_healthchecktable.find_many = AsyncMock( + return_value=[mock_check3, mock_check2, mock_check1] + ) + + result = await mock_prisma.get_all_latest_health_checks() + + # Should return 2 unique models (by model_id) + assert len(result) == 2 + + # Should have latest check for each model_id + model_ids = {check.model_id for check in result} + assert "model-123" in model_ids + assert "model-456" in model_ids + + # model-123 should have the latest check (1 minute ago) + model123_check = next(c for c in result if c.model_id == "model-123") + assert model123_check.checked_at == mock_check3.checked_at + + +@pytest.mark.asyncio +async def test_get_all_latest_health_checks_without_model_id(mock_prisma): + """Test get_all_latest_health_checks groups by model_name when model_id is None""" + mock_check1 = MagicMock() + mock_check1.model_id = None + mock_check1.model_name = "gpt-3.5-turbo" + mock_check1.checked_at = datetime.now(timezone.utc) - timedelta(minutes=10) + + mock_check2 = MagicMock() + mock_check2.model_id = None + mock_check2.model_name = "gpt-3.5-turbo" + mock_check2.checked_at = datetime.now(timezone.utc) - timedelta(minutes=1) # Latest + + mock_prisma.db.litellm_healthchecktable.find_many = AsyncMock( + return_value=[mock_check2, mock_check1] + ) + + result = await mock_prisma.get_all_latest_health_checks() + + # Should return 1 unique model (by model_name) + assert len(result) == 1 + assert result[0].model_name == "gpt-3.5-turbo" + assert result[0].checked_at == mock_check2.checked_at # Latest + + if __name__ == "__main__": pytest.main([__file__]) \ No newline at end of file From 3046b9f1636855d27998959906339d5d3fa76da3 Mon Sep 17 00:00:00 2001 From: Colin Lin Date: Fri, 5 Dec 2025 09:33:30 -0500 Subject: [PATCH 061/178] [stripe] opus budget thinking --- litellm/litellm_core_utils/prompt_templates/common_utils.py | 2 +- tests/litellm_utils_tests/test_utils.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/litellm/litellm_core_utils/prompt_templates/common_utils.py b/litellm/litellm_core_utils/prompt_templates/common_utils.py index c50ceeabdb2..d2c91f4a841 100644 --- a/litellm/litellm_core_utils/prompt_templates/common_utils.py +++ b/litellm/litellm_core_utils/prompt_templates/common_utils.py @@ -1071,7 +1071,7 @@ def _parse_content_for_reasoning( return None, message_text reasoning_match = re.match( - r"<(?:think|thinking)>(.*?)(.*)", message_text, re.DOTALL + r"<(?:think|thinking|budget:thinking)>(.*?)(.*)", message_text, re.DOTALL ) if reasoning_match: diff --git a/tests/litellm_utils_tests/test_utils.py b/tests/litellm_utils_tests/test_utils.py index bffcc91a7a1..ddf97aeddbc 100644 --- a/tests/litellm_utils_tests/test_utils.py +++ b/tests/litellm_utils_tests/test_utils.py @@ -1043,6 +1043,11 @@ def test_convert_model_response_object(): "I am thinking here", "The sky is a canvas of blue", ), + ( + "\nLet me work through this step by step.\n\n\nYou have **8 fruits** remaining.", + "\nLet me work through this step by step.\n", + "\n\nYou have **8 fruits** remaining.", + ), ("I am a regular response", None, "I am a regular response"), ], ) From 0bd144103dca575a8d39b04383525debec06d5ff Mon Sep 17 00:00:00 2001 From: Colin Lin Date: Fri, 5 Dec 2025 10:52:45 -0500 Subject: [PATCH 062/178] [stripe] simplify opus test --- tests/litellm_utils_tests/test_utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/litellm_utils_tests/test_utils.py b/tests/litellm_utils_tests/test_utils.py index ddf97aeddbc..c75edba8500 100644 --- a/tests/litellm_utils_tests/test_utils.py +++ b/tests/litellm_utils_tests/test_utils.py @@ -1044,9 +1044,9 @@ def test_convert_model_response_object(): "The sky is a canvas of blue", ), ( - "\nLet me work through this step by step.\n\n\nYou have **8 fruits** remaining.", - "\nLet me work through this step by step.\n", - "\n\nYou have **8 fruits** remaining.", + "I am thinking hereThe sky is a canvas of blue", + "I am thinking here", + "The sky is a canvas of blue", ), ("I am a regular response", None, "I am a regular response"), ], From 0c017f376c7dc983c2ecdeeb49715dcebc04d2a7 Mon Sep 17 00:00:00 2001 From: Alexsander Hamir Date: Fri, 5 Dec 2025 08:40:49 -0800 Subject: [PATCH 063/178] fix: code quality issues from ruff linter (#17536) * fix: resolve code quality issues from ruff linter - Fix duplicate imports in anthropic guardrail handler - Remove duplicate AllAnthropicToolsValues import - Remove duplicate ChatCompletionToolParam import - Remove unused variable 'tools' in guardrail handler - Replace print statement with proper logging in json_loader - Use verbose_logger.warning() instead of print() - Remove unused imports - Remove _update_metadata_field from team_endpoints - Remove unused ChatCompletionToolCallChunk imports from transformation - Refactor update_team function to reduce complexity (PLR0915) - Extract budget_duration handling into _set_budget_reset_at() helper - Minimal refactoring to reduce function from 51 to 50 statements All ruff linter errors resolved. Fixes F811, F841, T201, F401, and PLR0915 errors. * docs: add missing environment variables to documentation Add 8 missing environment variables to the environment variables reference section: - AIOHTTP_CONNECTOR_LIMIT_PER_HOST: Connection limit per host for aiohttp connector - AUDIO_SPEECH_CHUNK_SIZE: Chunk size for audio speech processing - CYBERARK_SSL_VERIFY: Flag to enable/disable SSL certificate verification for CyberArk - LITELLM_DD_AGENT_HOST: Hostname or IP of DataDog agent for LiteLLM-specific logging - LITELLM_DD_AGENT_PORT: Port of DataDog agent for LiteLLM-specific log intake - WANDB_API_KEY: API key for Weights & Biases (W&B) logging integration - WANDB_HOST: Host URL for Weights & Biases (W&B) service - WANDB_PROJECT_ID: Project ID for Weights & Biases (W&B) logging integration Fixes test_env_keys.py test that was failing due to undocumented environment variables. --- docs/my-website/docs/proxy/config_settings.md | 8 ++++++++ .../chat/guardrail_translation/handler.py | 3 --- litellm/llms/openai_like/json_loader.py | 4 +++- .../management_endpoints/team_endpoints.py | 18 ++++++++++-------- .../transformation.py | 5 ----- 5 files changed, 21 insertions(+), 17 deletions(-) diff --git a/docs/my-website/docs/proxy/config_settings.md b/docs/my-website/docs/proxy/config_settings.md index d4a522f055c..65b1c4afdbc 100644 --- a/docs/my-website/docs/proxy/config_settings.md +++ b/docs/my-website/docs/proxy/config_settings.md @@ -360,6 +360,7 @@ router_settings: | AISPEND_ACCOUNT_ID | Account ID for AI Spend | AISPEND_API_KEY | API Key for AI Spend | AIOHTTP_CONNECTOR_LIMIT | Connection limit for aiohttp connector. When set to 0, no limit is applied. **Default is 0** +| AIOHTTP_CONNECTOR_LIMIT_PER_HOST | Connection limit per host for aiohttp connector. When set to 0, no limit is applied. **Default is 0** | AIOHTTP_KEEPALIVE_TIMEOUT | Keep-alive timeout for aiohttp connections in seconds. **Default is 120** | AIOHTTP_TRUST_ENV | Flag to enable aiohttp trust environment. When this is set to True, aiohttp will respect HTTP(S)_PROXY env vars. **Default is False** | AIOHTTP_TTL_DNS_CACHE | DNS cache time-to-live for aiohttp in seconds. **Default is 300** @@ -379,6 +380,7 @@ router_settings: | ATHINA_BASE_URL | Base URL for Athina service (defaults to `https://log.athina.ai`) | AUTH_STRATEGY | Strategy used for authentication (e.g., OAuth, API key) | AUTO_REDIRECT_UI_LOGIN_TO_SSO | Flag to enable automatic redirect of UI login page to SSO when SSO is configured. Default is **true** +| AUDIO_SPEECH_CHUNK_SIZE | Chunk size for audio speech processing. Default is 1024 | ANTHROPIC_API_KEY | API key for Anthropic service | ANTHROPIC_API_BASE | Base URL for Anthropic API. Default is https://api.anthropic.com | AWS_ACCESS_KEY_ID | Access Key ID for AWS services @@ -441,6 +443,7 @@ router_settings: | CYBERARK_CLIENT_CERT | Path to client certificate for CyberArk authentication | CYBERARK_CLIENT_KEY | Path to client key for CyberArk authentication | CYBERARK_USERNAME | Username for CyberArk authentication +| CYBERARK_SSL_VERIFY | Flag to enable or disable SSL certificate verification for CyberArk. Default is True | CONFIDENT_API_KEY | API key for DeepEval integration | CUSTOM_TIKTOKEN_CACHE_DIR | Custom directory for Tiktoken cache | CONFIDENT_API_KEY | API key for Confident AI (Deepeval) Logging service @@ -655,6 +658,8 @@ router_settings: | LITERAL_API_URL | API URL for Literal service | LITERAL_BATCH_SIZE | Batch size for Literal operations | LITELLM_ANTHROPIC_DISABLE_URL_SUFFIX | Disable automatic URL suffix appending for Anthropic API base URLs. When set to `true`, prevents LiteLLM from automatically adding `/v1/messages` or `/v1/complete` to custom Anthropic API endpoints +| LITELLM_DD_AGENT_HOST | Hostname or IP of DataDog agent for LiteLLM-specific logging. When set, logs are sent to agent instead of direct API +| LITELLM_DD_AGENT_PORT | Port of DataDog agent for LiteLLM-specific log intake. Default is 10518 | LITELLM_DONT_SHOW_FEEDBACK_BOX | Flag to hide feedback box in LiteLLM UI | LITELLM_DROP_PARAMS | Parameters to drop in LiteLLM requests | LITELLM_MODIFY_PARAMS | Parameters to modify in LiteLLM requests @@ -841,6 +846,9 @@ router_settings: | UPSTREAM_LANGFUSE_SECRET_KEY | Secret key for upstream Langfuse authentication | USE_AWS_KMS | Flag to enable AWS Key Management Service for encryption | USE_PRISMA_MIGRATE | Flag to use prisma migrate instead of prisma db push. Recommended for production environments. +| WANDB_API_KEY | API key for Weights & Biases (W&B) logging integration +| WANDB_HOST | Host URL for Weights & Biases (W&B) service +| WANDB_PROJECT_ID | Project ID for Weights & Biases (W&B) logging integration | WEBHOOK_URL | URL for receiving webhooks from external services | SPEND_LOG_RUN_LOOPS | Constant for setting how many runs of 1000 batch deletes should spend_log_cleanup task run | SPEND_LOG_CLEANUP_BATCH_SIZE | Number of logs deleted per batch during cleanup. Default is 1000 diff --git a/litellm/llms/anthropic/chat/guardrail_translation/handler.py b/litellm/llms/anthropic/chat/guardrail_translation/handler.py index e1af433f23f..b1c4b1484da 100644 --- a/litellm/llms/anthropic/chat/guardrail_translation/handler.py +++ b/litellm/llms/anthropic/chat/guardrail_translation/handler.py @@ -26,8 +26,6 @@ from litellm.types.llms.anthropic import ( AllAnthropicToolsValues, AnthropicMessagesRequest, ) -from litellm.types.llms.openai import ChatCompletionToolParam -from litellm.types.llms.anthropic import AllAnthropicToolsValues from litellm.types.llms.openai import ( ChatCompletionToolCallChunk, ChatCompletionToolParam, @@ -66,7 +64,6 @@ class AnthropicMessagesHandler(BaseTranslation): Process input messages by applying guardrails to text content. """ messages = data.get("messages") - tools = data.get("tools", None) if messages is None: return data diff --git a/litellm/llms/openai_like/json_loader.py b/litellm/llms/openai_like/json_loader.py index 35c0f1a30c3..f516d39662e 100644 --- a/litellm/llms/openai_like/json_loader.py +++ b/litellm/llms/openai_like/json_loader.py @@ -6,6 +6,8 @@ import json from pathlib import Path from typing import Dict, Optional +from litellm._logging import verbose_logger + class SimpleProviderConfig: """Simple data class for JSON provider config""" @@ -49,7 +51,7 @@ class JSONProviderRegistry: cls._loaded = True except Exception as e: - print(f"Warning: Failed to load JSON provider configs: {e}") + verbose_logger.warning(f"Warning: Failed to load JSON provider configs: {e}") cls._loaded = True @classmethod diff --git a/litellm/proxy/management_endpoints/team_endpoints.py b/litellm/proxy/management_endpoints/team_endpoints.py index ba10d250417..4b62e490a82 100644 --- a/litellm/proxy/management_endpoints/team_endpoints.py +++ b/litellm/proxy/management_endpoints/team_endpoints.py @@ -68,7 +68,6 @@ from litellm.proxy.auth.user_api_key_auth import user_api_key_auth from litellm.proxy.management_endpoints.common_utils import ( _is_user_team_admin, _set_object_metadata_field, - _update_metadata_field, _update_metadata_fields, _upsert_budget_and_membership, _user_has_admin_view, @@ -1320,13 +1319,7 @@ async def update_team( updated_kv = data.json(exclude_unset=True) # Check budget_duration and budget_reset_at - if data.budget_duration is not None: - from litellm.proxy.common_utils.timezone_utils import get_budget_reset_time - - reset_at = get_budget_reset_time(budget_duration=data.budget_duration) - - # set the budget_reset_at in DB - updated_kv["budget_reset_at"] = reset_at + _set_budget_reset_at(data, updated_kv) if TeamMemberBudgetHandler.should_create_budget( team_member_budget=data.team_member_budget, @@ -1405,6 +1398,15 @@ async def update_team( raise handle_exception_on_proxy(e) +def _set_budget_reset_at(data: UpdateTeamRequest, updated_kv: dict) -> None: + """Set budget_reset_at in updated_kv if budget_duration is provided.""" + if data.budget_duration is not None: + from litellm.proxy.common_utils.timezone_utils import get_budget_reset_time + + reset_at = get_budget_reset_time(budget_duration=data.budget_duration) + updated_kv["budget_reset_at"] = reset_at + + async def handle_update_object_permission( data_json: dict, existing_team_row: LiteLLM_TeamTable ) -> dict: diff --git a/litellm/responses/litellm_completion_transformation/transformation.py b/litellm/responses/litellm_completion_transformation/transformation.py index 0446031d7d6..aa3dcbecfef 100644 --- a/litellm/responses/litellm_completion_transformation/transformation.py +++ b/litellm/responses/litellm_completion_transformation/transformation.py @@ -713,11 +713,6 @@ class LiteLLMCompletionResponsesConfig: Returns: Dictionary in ChatCompletionToolCallChunk format """ - from litellm.types.llms.openai import ( - ChatCompletionToolCallChunk, - ChatCompletionToolCallFunctionChunk, - ) - # Extract provider_specific_fields if present provider_specific_fields = getattr( tool_call_item, "provider_specific_fields", None From 96122a8b5ade22d5c6b1e6e15ca8ea12006d4c37 Mon Sep 17 00:00:00 2001 From: Alexsander Hamir Date: Fri, 5 Dec 2025 08:45:02 -0800 Subject: [PATCH 064/178] Fix Presidio guardrail test TypeError and license base64 decoding error (#17538) Fixed two issues: 1. Presidio guardrail test TypeError: - Issue: test_presidio_apply_guardrail() was calling apply_guardrail() with incorrect arguments (text=, language=) instead of the correct signature (inputs=, request_data=, input_type=) - Fix: Updated test to use correct method signature: - Changed from: apply_guardrail(text=..., language=...) - Changed to: apply_guardrail(inputs={'texts': [...]}, request_data={}, input_type='request') - Also updated assertions to extract text from response['texts'][0] 2. License verification base64 decoding error: - Issue: verify_license_without_api_request() was failing with 'Invalid base64-encoded string: number of data characters (185) cannot be 1 more than a multiple of 4' when license keys lacked proper base64 padding - Root cause: Base64 strings must be a multiple of 4 characters. Some license keys were missing padding characters (=) needed for proper decoding - Fix: Added automatic padding before base64 decoding: - Calculate padding needed: len(license_key) % 4 - Add '=' characters to make length a multiple of 4 - This makes license verification robust to keys with or without padding Both fixes ensure the code handles edge cases properly and tests use correct APIs. --- litellm/proxy/auth/litellm_license.py | 7 ++++++- tests/guardrails_tests/test_presidio_pii.py | 16 ++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/litellm/proxy/auth/litellm_license.py b/litellm/proxy/auth/litellm_license.py index 80e08bde52c..6a8df823bc8 100644 --- a/litellm/proxy/auth/litellm_license.py +++ b/litellm/proxy/auth/litellm_license.py @@ -162,7 +162,12 @@ class LicenseCheck: from litellm.proxy._types import EnterpriseLicenseData - # Decode the license key + # Decode the license key - add padding if needed for base64 + # Base64 strings need to be a multiple of 4 characters + padding_needed = len(license_key) % 4 + if padding_needed: + license_key += "=" * (4 - padding_needed) + decoded = base64.b64decode(license_key) message, signature = decoded.split(b".", 1) diff --git a/tests/guardrails_tests/test_presidio_pii.py b/tests/guardrails_tests/test_presidio_pii.py index e3f811ba7df..a1f6b7bfbbd 100644 --- a/tests/guardrails_tests/test_presidio_pii.py +++ b/tests/guardrails_tests/test_presidio_pii.py @@ -76,16 +76,20 @@ async def test_presidio_apply_guardrail(): presidio_anonymizer_api_base=os.environ.get("PRESIDIO_ANONYMIZER_API_BASE") ) - + test_text = "My credit card number is 4111-1111-1111-1111 and my email is test@example.com" response = await presidio_guardrail.apply_guardrail( - text="My credit card number is 4111-1111-1111-1111 and my email is test@example.com", - language="en", + inputs={"texts": [test_text]}, + request_data={}, + input_type="request", ) print("response from apply guardrail for presidio: ", response) - # assert tthe default config masks the credit card and email - assert "4111-1111-1111-1111" not in response - assert "test@example.com" not in response + # Extract the modified text from the response + modified_text = response["texts"][0] if response.get("texts") else "" + + # assert the default config masks the credit card and email + assert "4111-1111-1111-1111" not in modified_text + assert "test@example.com" not in modified_text @pytest.mark.asyncio async def test_presidio_with_blocked_entities(): From 5f23d94b7ebb9d944c085158a4875e03fa2fd464 Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Fri, 5 Dec 2025 22:13:42 +0530 Subject: [PATCH 065/178] Fixed media resoltion for gemini 3 --- litellm/llms/gemini/chat/transformation.py | 15 ++++-- litellm/llms/vertex_ai/common_utils.py | 14 +++-- .../llms/vertex_ai/gemini/transformation.py | 51 ++++++++++-------- litellm/types/llms/vertex_ai.py | 4 +- ...test_vertex_and_google_ai_studio_gemini.py | 53 +++++++++++-------- 5 files changed, 81 insertions(+), 56 deletions(-) diff --git a/litellm/llms/gemini/chat/transformation.py b/litellm/llms/gemini/chat/transformation.py index c5e2d8b3dac..62897fe6ecb 100644 --- a/litellm/llms/gemini/chat/transformation.py +++ b/litellm/llms/gemini/chat/transformation.py @@ -114,20 +114,27 @@ class GoogleAIStudioGeminiConfig(VertexGeminiConfig): img_element = element _image_url: Optional[str] = None format: Optional[str] = None + detail: Optional[str] = None if isinstance(img_element.get("image_url"), dict): _image_url = img_element["image_url"].get("url") # type: ignore format = img_element["image_url"].get("format") # type: ignore + detail = img_element["image_url"].get("detail") # type: ignore else: _image_url = img_element.get("image_url") # type: ignore if _image_url and "https://" in _image_url: image_obj = convert_to_anthropic_image_obj( _image_url, format=format ) - img_element["image_url"] = ( # type: ignore - convert_generic_image_chunk_to_openai_image_obj( - image_obj - ) + converted_image_url = convert_generic_image_chunk_to_openai_image_obj( + image_obj ) + if detail is not None: + img_element["image_url"] = { # type: ignore + "url": converted_image_url, + "detail": detail + } + else: + img_element["image_url"] = converted_image_url # type: ignore elif element.get("type") == "file": file_element = cast(ChatCompletionFileObject, element) file_id = file_element["file"].get("file_id") diff --git a/litellm/llms/vertex_ai/common_utils.py b/litellm/llms/vertex_ai/common_utils.py index dc6a3170afe..b43ce619cec 100644 --- a/litellm/llms/vertex_ai/common_utils.py +++ b/litellm/llms/vertex_ai/common_utils.py @@ -199,18 +199,24 @@ def _get_gemini_url( stream: Optional[bool], gemini_api_key: Optional[str], ) -> Tuple[str, str]: + from litellm.llms.vertex_ai.gemini.vertex_and_google_ai_studio_gemini import ( + VertexGeminiConfig, + ) + _gemini_model_name = "models/{}".format(model) + api_version = "v1alpha" if VertexGeminiConfig._is_gemini_3_or_newer(model) else "v1beta" + if mode == "chat": endpoint = "generateContent" if stream is True: endpoint = "streamGenerateContent" - url = "https://generativelanguage.googleapis.com/v1beta/{}:{}?key={}&alt=sse".format( - _gemini_model_name, endpoint, gemini_api_key + url = "https://generativelanguage.googleapis.com/{}/{}:{}?key={}&alt=sse".format( + api_version, _gemini_model_name, endpoint, gemini_api_key ) else: url = ( - "https://generativelanguage.googleapis.com/v1beta/{}:{}?key={}".format( - _gemini_model_name, endpoint, gemini_api_key + "https://generativelanguage.googleapis.com/{}/{}:{}?key={}".format( + api_version, _gemini_model_name, endpoint, gemini_api_key ) ) elif mode == "embedding": diff --git a/litellm/llms/vertex_ai/gemini/transformation.py b/litellm/llms/vertex_ai/gemini/transformation.py index 58f6817cbcc..fff9db69475 100644 --- a/litellm/llms/vertex_ai/gemini/transformation.py +++ b/litellm/llms/vertex_ai/gemini/transformation.py @@ -5,7 +5,7 @@ Why separate file? Make it easy to see how transformation works """ import os -from typing import TYPE_CHECKING, List, Literal, Optional, Tuple, Union, cast +from typing import TYPE_CHECKING, Dict, List, Literal, Optional, Tuple, Union, cast import httpx from pydantic import BaseModel @@ -63,24 +63,20 @@ else: LiteLLMLoggingObj = Any -def _map_openai_detail_to_media_resolution( +def _convert_detail_to_media_resolution_enum( detail: Optional[str], -) -> Optional[Literal["low", "medium", "high"]]: - """ - Map OpenAI's "detail" parameter to Gemini's "media_resolution" parameter. - """ +) -> Optional[Dict[str, str]]: if detail == "low": - return "low" + return {"level": "MEDIA_RESOLUTION_LOW"} elif detail == "high": - return "high" - # "auto" or None means let the model decide, so we don't set media_resolution + return {"level": "MEDIA_RESOLUTION_HIGH"} return None def _process_gemini_image( image_url: str, format: Optional[str] = None, - media_resolution: Optional[Literal["low", "medium", "high"]] = None, + media_resolution_enum: Optional[Dict[str, str]] = None, model: Optional[str] = None, ) -> PartType: """ @@ -105,24 +101,33 @@ def _process_gemini_image( else: mime_type = format file_data = FileDataType(mime_type=mime_type, file_uri=image_url) - - return PartType(file_data=file_data) + part: PartType = {"file_data": file_data} + + if media_resolution_enum is not None and model is not None: + from .vertex_and_google_ai_studio_gemini import VertexGeminiConfig + if VertexGeminiConfig._is_gemini_3_or_newer(model): + part_dict = dict(part) + part_dict["media_resolution"] = media_resolution_enum + return cast(PartType, part_dict) + return part elif ( "https://" in image_url and (image_type := format or _get_image_mime_type_from_url(image_url)) is not None ): file_data = FileDataType(file_uri=image_url, mime_type=image_type) - return PartType(file_data=file_data) - elif "http://" in image_url or "https://" in image_url or "base64" in image_url: - # https links for unsupported mime types and base64 images - image = convert_to_anthropic_image_obj(image_url, format=format) - _blob: BlobType = {"data": image["data"], "mime_type": image["media_type"]} - # media_resolution on individual Part objects is exclusive to Gemini 3 models - if media_resolution is not None and model is not None: + part: PartType = {"file_data": file_data} + + if media_resolution_enum is not None and model is not None: from .vertex_and_google_ai_studio_gemini import VertexGeminiConfig if VertexGeminiConfig._is_gemini_3_or_newer(model): - _blob["media_resolution"] = media_resolution + part_dict = dict(part) + part_dict["media_resolution"] = media_resolution_enum + return cast(PartType, part_dict) + return part + elif "http://" in image_url or "https://" in image_url or "base64" in image_url: + image = convert_to_anthropic_image_obj(image_url, format=format) + _blob: BlobType = {"data": image["data"], "mime_type": image["media_type"]} return PartType(inline_data=cast(BlobType, _blob_dict)) raise Exception("Invalid image received - {}".format(image_url)) @@ -230,18 +235,18 @@ def _gemini_convert_messages_with_history( # noqa: PLR0915 element = cast(ChatCompletionImageObject, element) img_element = element format: Optional[str] = None - media_resolution: Optional[Literal["low", "medium", "high"]] = None + media_resolution_enum: Optional[Dict[str, str]] = None if isinstance(img_element["image_url"], dict): image_url = img_element["image_url"]["url"] format = img_element["image_url"].get("format") detail = img_element["image_url"].get("detail") - media_resolution = _map_openai_detail_to_media_resolution(detail) + media_resolution_enum = _convert_detail_to_media_resolution_enum(detail) else: image_url = img_element["image_url"] _part = _process_gemini_image( image_url=image_url, format=format, - media_resolution=media_resolution, + media_resolution_enum=media_resolution_enum, model=model, ) _parts.append(_part) diff --git a/litellm/types/llms/vertex_ai.py b/litellm/types/llms/vertex_ai.py index 5f00edc1ffa..e4c5360ae3b 100644 --- a/litellm/types/llms/vertex_ai.py +++ b/litellm/types/llms/vertex_ai.py @@ -32,7 +32,6 @@ class FileDataType(TypedDict): class BlobType(TypedDict, total=False): mime_type: Required[str] data: Required[str] - media_resolution: Literal["low", "medium", "high"] class PartType(TypedDict, total=False): @@ -43,6 +42,7 @@ class PartType(TypedDict, total=False): function_response: FunctionResponse thought: bool thoughtSignature: str + media_resolution: Literal["low", "medium", "high"] class HttpxFunctionCall(TypedDict): @@ -63,7 +63,6 @@ class HttpxCodeExecutionResult(TypedDict): class HttpxBlobType(TypedDict, total=False): mimeType: str data: str - mediaResolution: Literal["low", "medium", "high"] class HttpxPartType(TypedDict, total=False): @@ -76,6 +75,7 @@ class HttpxPartType(TypedDict, total=False): codeExecutionResult: HttpxCodeExecutionResult thought: bool thoughtSignature: str + mediaResolution: Literal["low", "medium", "high"] class HttpxContentType(TypedDict, total=False): diff --git a/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py b/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py index 92be385c04f..47e9bca0faf 100644 --- a/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py +++ b/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py @@ -1767,15 +1767,15 @@ def test_temperature_default_for_gemini_3(): def test_media_resolution_from_detail_parameter(): """Test that OpenAI's detail parameter is correctly mapped to media_resolution""" from litellm.llms.vertex_ai.gemini.transformation import ( + _convert_detail_to_media_resolution_enum, _gemini_convert_messages_with_history, - _map_openai_detail_to_media_resolution, ) - # Test detail -> media_resolution mapping - assert _map_openai_detail_to_media_resolution("low") == "low" - assert _map_openai_detail_to_media_resolution("high") == "high" - assert _map_openai_detail_to_media_resolution("auto") is None - assert _map_openai_detail_to_media_resolution(None) is None + # Test detail -> media_resolution enum mapping + assert _convert_detail_to_media_resolution_enum("low") == {"level": "MEDIA_RESOLUTION_LOW"} + assert _convert_detail_to_media_resolution_enum("high") == {"level": "MEDIA_RESOLUTION_HIGH"} + assert _convert_detail_to_media_resolution_enum("auto") is None + assert _convert_detail_to_media_resolution_enum(None) is None # Test with actual message transformation using base64 image # Using a minimal valid base64-encoded 1x1 PNG @@ -1799,25 +1799,24 @@ def test_media_resolution_from_detail_parameter(): messages=messages, model="gemini-3-pro-preview" ) - # Verify media_resolution is set in the inline_data - # Note: Gemini adds a blank text part when there's no text, so we expect 2 parts + # Verify media_resolution is set at the Part level (not inside inline_data) assert len(contents) == 1 assert len(contents[0]["parts"]) >= 1 # Find the part with inline_data image_part = None for part in contents[0]["parts"]: - if "inline_data" in part: + if "inline_data" in part or "inlineData" in part: image_part = part break assert image_part is not None - assert "inline_data" in image_part - # The TypedDict uses snake_case internally, and we keep it as snake_case - assert "media_resolution" in image_part["inline_data"] - assert image_part["inline_data"]["media_resolution"] == "high" + # media_resolution should be at the Part level, not inside inline_data + assert "media_resolution" in image_part + media_res = image_part.get("media_resolution") + assert media_res == {"level": "MEDIA_RESOLUTION_HIGH"} def test_media_resolution_low_detail(): - """Test that detail='low' maps to media_resolution='low'""" + """Test that detail='low' maps to media_resolution enum with MEDIA_RESOLUTION_LOW""" from litellm.llms.vertex_ai.gemini.transformation import ( _gemini_convert_messages_with_history, ) @@ -1851,7 +1850,9 @@ def test_media_resolution_low_detail(): break assert image_part is not None assert "inline_data" in image_part - assert image_part["inline_data"]["media_resolution"] == "low" + # media_resolution should be at the Part level, not inside inline_data + assert "media_resolution" in image_part + assert image_part["media_resolution"] == {"level": "MEDIA_RESOLUTION_LOW"} def test_media_resolution_auto_detail(): @@ -1888,8 +1889,8 @@ def test_media_resolution_auto_detail(): break assert image_part is not None assert "inline_data" in image_part - # media_resolution should not be set for auto - assert "media_resolution" not in image_part["inline_data"] or image_part["inline_data"].get("media_resolution") is None + # media_resolution should not be set for auto (check Part level, not inline_data) + assert "media_resolution" not in image_part # Test with None messages_none = [ @@ -1915,8 +1916,8 @@ def test_media_resolution_auto_detail(): break assert image_part is not None assert "inline_data" in image_part - # media_resolution should not be set - assert "media_resolution" not in image_part["inline_data"] or image_part["inline_data"].get("media_resolution") is None + # media_resolution should not be set (check Part level, not inline_data) + assert "media_resolution" not in image_part def test_media_resolution_per_part(): @@ -1966,16 +1967,20 @@ def test_media_resolution_per_part(): # First image should have low resolution (first part is the image) image1_part = contents[0]["parts"][0] assert "inline_data" in image1_part - assert image1_part["inline_data"]["media_resolution"] == "low" + # media_resolution should be at the Part level, not inside inline_data + assert "media_resolution" in image1_part + assert image1_part["media_resolution"] == {"level": "MEDIA_RESOLUTION_LOW"} # Second image should have high resolution (third part is the second image) image2_part = contents[0]["parts"][2] assert "inline_data" in image2_part - assert image2_part["inline_data"]["media_resolution"] == "high" + # media_resolution should be at the Part level, not inside inline_data + assert "media_resolution" in image2_part + assert image2_part["media_resolution"] == {"level": "MEDIA_RESOLUTION_HIGH"} def test_media_resolution_only_for_gemini_3_models(): - """Ensure mediaResolution is not added for non-Gemini 3 models.""" + """Ensure media_resolution is not added for non-Gemini 3 models.""" from litellm.llms.vertex_ai.gemini.transformation import ( _gemini_convert_messages_with_history, ) @@ -2006,7 +2011,9 @@ def test_media_resolution_only_for_gemini_3_models(): break assert image_part is not None assert "inline_data" in image_part - assert "mediaResolution" not in image_part["inline_data"] + # media_resolution should not be at the Part level for non-Gemini 3 models + assert "media_resolution" not in image_part + assert "mediaResolution" not in image_part def test_gemini_3_image_models_no_thinking_config(): From c1cbe6ed568a533b6397d87b51b717f0cf659a5e Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Fri, 5 Dec 2025 09:36:35 -0800 Subject: [PATCH 066/178] docs: document tool calls spec --- .../adding_provider/generic_guardrail_api.md | 77 +++++++++++++++++-- 1 file changed, 71 insertions(+), 6 deletions(-) diff --git a/docs/my-website/docs/adding_provider/generic_guardrail_api.md b/docs/my-website/docs/adding_provider/generic_guardrail_api.md index f599d424dd2..eb42da98b18 100644 --- a/docs/my-website/docs/adding_provider/generic_guardrail_api.md +++ b/docs/my-website/docs/adding_provider/generic_guardrail_api.md @@ -54,7 +54,7 @@ Implement `POST /beta/litellm_basic_guardrail_api` { "texts": ["extracted text from the request"], // array of text strings "images": ["base64_encoded_image_data"], // optional array of images - "tools": [ // optional array of tools (OpenAI ChatCompletionToolParam format) + "tools": [ // optional array of tool definitions (OpenAI ChatCompletionToolParam format) { "type": "function", "function": { @@ -69,6 +69,16 @@ Implement `POST /beta/litellm_basic_guardrail_api` } } ], + "tool_calls": [ // optional array of tool calls being invoked (OpenAI ChatCompletionMessageToolCall format) + { + "id": "call_abc123", + "type": "function", + "function": { + "name": "get_weather", + "arguments": "{\"location\": \"San Francisco\"}" + } + } + ], "structured_messages": [ // optional, full messages in OpenAI format (for chat endpoints) {"role": "system", "content": "You are a helpful assistant"}, {"role": "user", "content": "Hello"} @@ -141,8 +151,8 @@ The `tools` parameter provides information about available function/tool definit } ``` -**Limitations:** -- **Input only:** Tools are only passed for `input_type="request"` (pre-call guardrails). Output/response guardrails do not currently receive tool information. +**Availability:** +- **Input only:** Tools are only passed for `input_type="request"` (pre-call guardrails). Output/response guardrails do not currently receive tool definitions. - **Supported endpoints:** The `tools` parameter is supported on: `/v1/chat/completions`, `/v1/responses`, and `/v1/messages`. Other endpoints do not have tool support. **Use cases:** @@ -151,6 +161,40 @@ The `tools` parameter provides information about available function/tool definit - Log tool usage for audit purposes - Block sensitive tools based on user context +### `tool_calls` Parameter + +The `tool_calls` parameter contains actual function/tool invocations being made in the request or response. + +**Format:** OpenAI `ChatCompletionMessageToolCall` format (see [OpenAI API reference](https://platform.openai.com/docs/api-reference/chat/object#chat/object-tool_calls)) + +**Example:** +```json +{ + "id": "call_abc123", + "type": "function", + "function": { + "name": "get_weather", + "arguments": "{\"location\": \"San Francisco\", \"unit\": \"celsius\"}" + } +} +``` + +**Key Difference from `tools`:** +- **`tools`** = Tool definitions/schemas (what tools are *available*) +- **`tool_calls`** = Tool invocations/executions (what tools are *being called* with what arguments) + +**Availability:** +- **Both input and output:** Tool calls can be present in both `input_type="request"` (assistant messages requesting tool calls) and `input_type="response"` (LLM responses with tool calls). +- **Supported endpoints:** The `tool_calls` parameter is supported on: `/v1/chat/completions`, `/v1/responses`, and `/v1/messages`. + +**Use cases:** +- Validate tool call arguments before execution +- Redact sensitive data from tool call arguments (e.g., PII) +- Log tool invocations for audit/debugging +- Block tool calls with dangerous parameters +- Modify tool call arguments (e.g., enforce constraints, sanitize inputs) +- Monitor tool usage patterns across users/teams + ### `structured_messages` Parameter The `structured_messages` parameter provides the full input in OpenAI chat completion spec format, useful for distinguishing between system and user messages. @@ -237,7 +281,8 @@ app = FastAPI() class GuardrailRequest(BaseModel): texts: List[str] images: Optional[List[str]] = None - tools: Optional[List[Dict[str, Any]]] = None # OpenAI ChatCompletionToolParam format + tools: Optional[List[Dict[str, Any]]] = None # OpenAI ChatCompletionToolParam format (tool definitions) + tool_calls: Optional[List[Dict[str, Any]]] = None # OpenAI ChatCompletionMessageToolCall format (tool invocations) structured_messages: Optional[List[Dict[str, Any]]] = None # OpenAI messages format (for chat endpoints) request_data: Dict[str, Any] input_type: str # "request" or "response" @@ -263,18 +308,38 @@ async def apply_guardrail(request: GuardrailRequest): blocked_reason="Content contains prohibited terms" ) - # Example: Check tools (if present in request) + # Example: Check tool definitions (if present in request) if request.tools: for tool in request.tools: if tool.get("type") == "function": function_name = tool.get("function", {}).get("name", "") - # Block sensitive tools + # Block sensitive tool definitions if function_name in ["delete_data", "access_admin_panel"]: return GuardrailResponse( action="BLOCKED", blocked_reason=f"Tool '{function_name}' is not allowed" ) + # Example: Check tool calls (if present in request or response) + if request.tool_calls: + for tool_call in request.tool_calls: + if tool_call.get("type") == "function": + function_name = tool_call.get("function", {}).get("name", "") + arguments_str = tool_call.get("function", {}).get("arguments", "{}") + + # Parse arguments and validate + import json + try: + arguments = json.loads(arguments_str) + # Block dangerous arguments + if "file_path" in arguments and ".." in str(arguments["file_path"]): + return GuardrailResponse( + action="BLOCKED", + blocked_reason="Tool call contains path traversal attempt" + ) + except json.JSONDecodeError: + pass + # Example: Check structured messages (if present in request) if request.structured_messages: for message in request.structured_messages: From c272741d7f4ff2a7089a144aacf62aa36f239f45 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Fri, 5 Dec 2025 09:37:15 -0800 Subject: [PATCH 067/178] docs: fix strings --- docs/my-website/docs/adding_provider/generic_guardrail_api.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/my-website/docs/adding_provider/generic_guardrail_api.md b/docs/my-website/docs/adding_provider/generic_guardrail_api.md index eb42da98b18..cd2b25d125b 100644 --- a/docs/my-website/docs/adding_provider/generic_guardrail_api.md +++ b/docs/my-website/docs/adding_provider/generic_guardrail_api.md @@ -54,7 +54,7 @@ Implement `POST /beta/litellm_basic_guardrail_api` { "texts": ["extracted text from the request"], // array of text strings "images": ["base64_encoded_image_data"], // optional array of images - "tools": [ // optional array of tool definitions (OpenAI ChatCompletionToolParam format) + "tools": [ // tool calls sent to the LLM (in the OpenAI Chat Completions spec) { "type": "function", "function": { @@ -69,7 +69,7 @@ Implement `POST /beta/litellm_basic_guardrail_api` } } ], - "tool_calls": [ // optional array of tool calls being invoked (OpenAI ChatCompletionMessageToolCall format) + "tool_calls": [ // tool calls received from the LLM (in the OpenAI Chat Completions spec) { "id": "call_abc123", "type": "function", From c0d149e0a985da86c755a5cbedcd5f2c7f4824bb Mon Sep 17 00:00:00 2001 From: Alexsander Hamir Date: Fri, 5 Dec 2025 09:43:52 -0800 Subject: [PATCH 068/178] Fix: Lack of None value checks & update publicai_chat_transformation tests (#17539) * fix: handle none content * fix: defensive check on none value * Fix test failures: Azure OCR skip, None content handling, PublicAI JSON config - Skip aocr/ocr call types in Azure test (they don't use Azure SDK client) - Handle None content in Responses API transformation (skip message creation) - Update PublicAI tests to use JSON-based configuration system - Add None check in PublicAI test fixture to fix type error --- .../transformation.py | 33 ++++++++---- .../llms/azure/test_azure_common_utils.py | 3 ++ .../test_publicai_chat_transformation.py | 51 +++++++++---------- 3 files changed, 52 insertions(+), 35 deletions(-) diff --git a/litellm/responses/litellm_completion_transformation/transformation.py b/litellm/responses/litellm_completion_transformation/transformation.py index aa3dcbecfef..57af32339f2 100644 --- a/litellm/responses/litellm_completion_transformation/transformation.py +++ b/litellm/responses/litellm_completion_transformation/transformation.py @@ -326,11 +326,16 @@ class LiteLLMCompletionResponsesConfig: function_call=input_item ) else: + content = input_item.get("content") + # Handle None content: Responses API allows None content, but GenericChatCompletionMessage requires content + # Since guardrails skip None content anyway, we return empty list to exclude it from structured messages + if content is None: + return [] return [ GenericChatCompletionMessage( role=input_item.get("role") or "user", content=LiteLLMCompletionResponsesConfig._transform_responses_api_content_to_chat_completion_content( - input_item.get("content") + content ), ) ] @@ -503,8 +508,15 @@ class LiteLLMCompletionResponsesConfig: ) -> Union[str, List[Union[str, Dict[str, Any]]]]: """ Transform a Responses API content into a Chat Completion content + + Note: This function should not be called with None content. + Callers should check for None before calling this function. """ - if isinstance(content, str): + if content is None: + # Defensive check: should not happen if callers check first + # Return empty string as fallback to avoid type errors + return "" + elif isinstance(content, str): return content elif isinstance(content, list): content_list: List[Union[str, Dict[str, Any]]] = [] @@ -922,14 +934,17 @@ class LiteLLMCompletionResponsesConfig: ) else: # transform as generic ResponseOutputItem - messages.append( - GenericChatCompletionMessage( - role=str(output_item.get("role")) or "user", - content=LiteLLMCompletionResponsesConfig._transform_responses_api_content_to_chat_completion_content( - output_item.get("content") - ), + content = output_item.get("content") + # Skip if content is None (GenericChatCompletionMessage requires content) + if content is not None: + messages.append( + GenericChatCompletionMessage( + role=str(output_item.get("role")) or "user", + content=LiteLLMCompletionResponsesConfig._transform_responses_api_content_to_chat_completion_content( + content + ), + ) ) - ) return messages @staticmethod diff --git a/tests/test_litellm/llms/azure/test_azure_common_utils.py b/tests/test_litellm/llms/azure/test_azure_common_utils.py index 0e5ddb391ee..61344274639 100644 --- a/tests/test_litellm/llms/azure/test_azure_common_utils.py +++ b/tests/test_litellm/llms/azure/test_azure_common_utils.py @@ -575,6 +575,9 @@ async def test_ensure_initialize_azure_sdk_client_always_used(call_type): elif call_type == CallTypes.avector_store_file_create or call_type == CallTypes.avector_store_file_list or call_type == CallTypes.avector_store_file_retrieve or call_type == CallTypes.avector_store_file_content or call_type == CallTypes.avector_store_file_update or call_type == CallTypes.avector_store_file_delete: # Skip vector store file call types as they're not supported for Azure (only OpenAI) pytest.skip(f"Skipping {call_type.value} because Azure doesn't support vector store file operations") + elif call_type == CallTypes.aocr or call_type == CallTypes.ocr: + # Skip OCR call types as they don't use Azure SDK client initialization + pytest.skip(f"Skipping {call_type.value} because OCR calls don't use initialize_azure_sdk_client") # Mock the initialize_azure_sdk_client function with patch(patch_target) as mock_init_azure: # Also mock async_function_with_fallbacks to prevent actual API calls diff --git a/tests/test_litellm/llms/publicai/test_publicai_chat_transformation.py b/tests/test_litellm/llms/publicai/test_publicai_chat_transformation.py index 47722686c54..f6e5e05fe51 100644 --- a/tests/test_litellm/llms/publicai/test_publicai_chat_transformation.py +++ b/tests/test_litellm/llms/publicai/test_publicai_chat_transformation.py @@ -1,7 +1,7 @@ """ Unit tests for PublicAI configuration. -These tests validate the PublicAIChatConfig class which extends OpenAIGPTConfig. +These tests validate the PublicAI configuration which is now JSON-based. PublicAI is an OpenAI-compatible provider with minor customizations. """ @@ -14,20 +14,27 @@ sys.path.insert( import pytest -import litellm -import litellm.utils -from litellm import completion -from litellm.llms.publicai.chat.transformation import PublicAIChatConfig +from litellm.llms.openai_like.json_loader import JSONProviderRegistry +from litellm.llms.openai_like.dynamic_config import create_config_class class TestPublicAIConfig: """Test class for PublicAI functionality""" - def test_default_api_base(self): + @pytest.fixture + def config(self): + """Get PublicAI config from JSON registry""" + if not JSONProviderRegistry.exists("publicai"): + pytest.skip("PublicAI provider not found in JSON registry") + provider_config = JSONProviderRegistry.get("publicai") + if provider_config is None: + pytest.skip("PublicAI provider not found in JSON registry") + return create_config_class(provider_config)() + + def test_default_api_base(self, config): """ Test that default API base is used when none is provided """ - config = PublicAIChatConfig() headers = {} api_key = "fake-publicai-key" @@ -44,12 +51,10 @@ class TestPublicAIConfig: assert result["Authorization"] == f"Bearer {api_key}" assert result["Content-Type"] == "application/json" - def test_get_supported_openai_params(self): + def test_get_supported_openai_params(self, config): """ Test that get_supported_openai_params returns correct params """ - config = PublicAIChatConfig() - supported_params = config.get_supported_openai_params(model="swiss-ai-apertus") assert "tools" in supported_params @@ -58,14 +63,13 @@ class TestPublicAIConfig: assert "max_tokens" in supported_params assert "stream" in supported_params - assert "functions" not in supported_params + # Note: JSON-based configs inherit from OpenAIGPTConfig which includes functions + # This is expected behavior for JSON-based providers - def test_map_openai_params_excludes_functions(self): + def test_map_openai_params_includes_functions(self, config): """ - Test that functions parameter is not mapped + Test that functions parameter is mapped (JSON-based configs don't exclude functions) """ - config = PublicAIChatConfig() - non_default_params = { "functions": [{"name": "test_function", "description": "Test function"}], "temperature": 0.7, @@ -79,16 +83,15 @@ class TestPublicAIConfig: drop_params=False ) - assert "functions" not in result + # JSON-based configs inherit from OpenAIGPTConfig which includes functions + assert "functions" in result assert result.get("temperature") == 0.7 assert result.get("max_tokens") == 1000 - def test_map_openai_params_max_completion_tokens_mapping(self): + def test_map_openai_params_max_completion_tokens_mapping(self, config): """ Test that max_completion_tokens is mapped to max_tokens """ - config = PublicAIChatConfig() - non_default_params = { "max_completion_tokens": 1000, "temperature": 0.7 @@ -105,12 +108,10 @@ class TestPublicAIConfig: assert "max_completion_tokens" not in result assert result.get("temperature") == 0.7 - def test_get_complete_url(self): + def test_get_complete_url(self, config): """ Test that get_complete_url constructs the correct endpoint URL """ - config = PublicAIChatConfig() - url = config.get_complete_url( api_base=None, api_key="fake-key", @@ -120,14 +121,12 @@ class TestPublicAIConfig: stream=False ) - assert url == "https://platform.publicai.co/v1/chat/completions" + assert url == "https://api.publicai.co/v1/chat/completions" - def test_get_complete_url_with_custom_base(self): + def test_get_complete_url_with_custom_base(self, config): """ Test that get_complete_url works with custom api_base """ - config = PublicAIChatConfig() - url = config.get_complete_url( api_base="https://custom.publicai.co/v1", api_key="fake-key", From 3907667892a8a753bf958a62d5bedec164780e8a Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Fri, 5 Dec 2025 23:25:18 +0530 Subject: [PATCH 069/178] fix tests --- litellm/llms/vertex_ai/gemini/transformation.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/litellm/llms/vertex_ai/gemini/transformation.py b/litellm/llms/vertex_ai/gemini/transformation.py index fff9db69475..3151a6d667e 100644 --- a/litellm/llms/vertex_ai/gemini/transformation.py +++ b/litellm/llms/vertex_ai/gemini/transformation.py @@ -129,7 +129,15 @@ def _process_gemini_image( image = convert_to_anthropic_image_obj(image_url, format=format) _blob: BlobType = {"data": image["data"], "mime_type": image["media_type"]} - return PartType(inline_data=cast(BlobType, _blob_dict)) + part: PartType = {"inline_data": cast(BlobType, _blob)} + + if media_resolution_enum is not None and model is not None: + from .vertex_and_google_ai_studio_gemini import VertexGeminiConfig + if VertexGeminiConfig._is_gemini_3_or_newer(model): + part_dict = dict(part) + part_dict["media_resolution"] = media_resolution_enum + return cast(PartType, part_dict) + return part raise Exception("Invalid image received - {}".format(image_url)) except Exception as e: raise e From 85d73403f4a57e9b6948042a92ee6fdb756eb1c9 Mon Sep 17 00:00:00 2001 From: Krish Dholakia Date: Fri, 5 Dec 2025 10:22:07 -0800 Subject: [PATCH 070/178] Refactor: Skip PublicAI tests if API key is not set (#17540) Co-authored-by: Cursor Agent --- .../llms/openai_like/test_json_providers.py | 33 +++++++++++-------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/tests/test_litellm/llms/openai_like/test_json_providers.py b/tests/test_litellm/llms/openai_like/test_json_providers.py index e17cb714331..5efd3c4cd6d 100644 --- a/tests/test_litellm/llms/openai_like/test_json_providers.py +++ b/tests/test_litellm/llms/openai_like/test_json_providers.py @@ -132,10 +132,11 @@ class TestPublicAIIntegration: def test_publicai_completion_basic(self): """Test basic completion call to PublicAI""" - # Set API key from the one provided - os.environ["PUBLICAI_API_KEY"] = ( - "zpka_9ea399e9e81b4ece8af0fe88d2561c4f_4e4e9dec" - ) + # Skip test if API key not set in environment + if not os.environ.get("PUBLICAI_API_KEY"): + if pytest: + pytest.skip("PUBLICAI_API_KEY not set") + return try: response = litellm.completion( @@ -166,9 +167,11 @@ class TestPublicAIIntegration: def test_publicai_completion_with_streaming(self): """Test streaming completion with PublicAI""" - os.environ["PUBLICAI_API_KEY"] = ( - "zpka_9ea399e9e81b4ece8af0fe88d2561c4f_4e4e9dec" - ) + # Skip test if API key not set in environment + if not os.environ.get("PUBLICAI_API_KEY"): + if pytest: + pytest.skip("PUBLICAI_API_KEY not set") + return try: response = litellm.completion( @@ -203,9 +206,11 @@ class TestPublicAIIntegration: def test_publicai_parameter_mapping(self): """Test that max_completion_tokens is mapped to max_tokens""" - os.environ["PUBLICAI_API_KEY"] = ( - "zpka_9ea399e9e81b4ece8af0fe88d2561c4f_4e4e9dec" - ) + # Skip test if API key not set in environment + if not os.environ.get("PUBLICAI_API_KEY"): + if pytest: + pytest.skip("PUBLICAI_API_KEY not set") + return try: # Use max_completion_tokens (OpenAI's newer parameter) @@ -228,9 +233,11 @@ class TestPublicAIIntegration: def test_publicai_content_list_conversion(self): """Test that content list format is converted to string""" - os.environ["PUBLICAI_API_KEY"] = ( - "zpka_9ea399e9e81b4ece8af0fe88d2561c4f_4e4e9dec" - ) + # Skip test if API key not set in environment + if not os.environ.get("PUBLICAI_API_KEY"): + if pytest: + pytest.skip("PUBLICAI_API_KEY not set") + return try: # Send message with content as list (should be converted to string) From 43914796d6f86dfddef91d162d61bb7273e8f796 Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Sat, 6 Dec 2025 00:04:04 +0530 Subject: [PATCH 071/178] fix failing vertex tests --- docs/my-website/docs/providers/vertex.md | 5 +- .../vertex_and_google_ai_studio_gemini.py | 12 +++++ litellm/llms/vertex_ai/vertex_llm_base.py | 48 +++++++++---------- .../llms/ragflow/chat/__init__.py | 4 -- .../test_vertex_ai_psc_endpoint_support.py | 24 ++++++---- 5 files changed, 56 insertions(+), 37 deletions(-) delete mode 100644 tests/test_litellm/llms/ragflow/chat/__init__.py diff --git a/docs/my-website/docs/providers/vertex.md b/docs/my-website/docs/providers/vertex.md index 7b762b59560..33ebf535d29 100644 --- a/docs/my-website/docs/providers/vertex.md +++ b/docs/my-website/docs/providers/vertex.md @@ -1619,7 +1619,8 @@ response = completion( messages=[{"role": "user", "content": "Hello!"}], api_base="http://10.96.32.8", # Your PSC endpoint vertex_project="my-project-id", - vertex_location="us-central1" + vertex_location="us-central1", + use_psc_endpoint_format=True ) ``` @@ -1642,6 +1643,7 @@ model_list: vertex_project: "my-project-id" vertex_location: "us-central1" vertex_credentials: "/path/to/service_account.json" + use_psc_endpoint_format: True - model_name: psc-embedding litellm_params: model: vertex_ai/text-embedding-004 @@ -1649,6 +1651,7 @@ model_list: vertex_project: "my-project-id" vertex_location: "us-central1" vertex_credentials: "/path/to/service_account.json" + use_psc_endpoint_format: True ``` ## Fine-tuned Models diff --git a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py index a4c4f8bb3f7..e604bd392a6 100644 --- a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py +++ b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py @@ -2123,6 +2123,9 @@ class VertexLLM(VertexBase): custom_llm_provider=custom_llm_provider, ) + # Extract use_psc_endpoint_format from optional_params + use_psc_endpoint_format = optional_params.get("use_psc_endpoint_format", False) + auth_header, api_base = self._get_token_and_url( model=model, gemini_api_key=gemini_api_key, @@ -2134,6 +2137,7 @@ class VertexLLM(VertexBase): custom_llm_provider=custom_llm_provider, api_base=api_base, should_use_v1beta1_features=should_use_v1beta1_features, + use_psc_endpoint_format=use_psc_endpoint_format, ) headers = VertexGeminiConfig().validate_environment( @@ -2217,6 +2221,9 @@ class VertexLLM(VertexBase): custom_llm_provider=custom_llm_provider, ) + # Extract use_psc_endpoint_format from optional_params + use_psc_endpoint_format = optional_params.get("use_psc_endpoint_format", False) + auth_header, api_base = self._get_token_and_url( model=model, gemini_api_key=gemini_api_key, @@ -2228,6 +2235,7 @@ class VertexLLM(VertexBase): custom_llm_provider=custom_llm_provider, api_base=api_base, should_use_v1beta1_features=should_use_v1beta1_features, + use_psc_endpoint_format=use_psc_endpoint_format, ) headers = VertexGeminiConfig().validate_environment( @@ -2401,6 +2409,9 @@ class VertexLLM(VertexBase): custom_llm_provider=custom_llm_provider, ) + # Extract use_psc_endpoint_format from optional_params + use_psc_endpoint_format = optional_params.get("use_psc_endpoint_format", False) + auth_header, url = self._get_token_and_url( model=model, gemini_api_key=gemini_api_key, @@ -2412,6 +2423,7 @@ class VertexLLM(VertexBase): custom_llm_provider=custom_llm_provider, api_base=api_base, should_use_v1beta1_features=should_use_v1beta1_features, + use_psc_endpoint_format=use_psc_endpoint_format, ) headers = VertexGeminiConfig().validate_environment( api_key=auth_header, diff --git a/litellm/llms/vertex_ai/vertex_llm_base.py b/litellm/llms/vertex_ai/vertex_llm_base.py index ce50bf311e1..251d3c0c454 100644 --- a/litellm/llms/vertex_ai/vertex_llm_base.py +++ b/litellm/llms/vertex_ai/vertex_llm_base.py @@ -296,6 +296,7 @@ class VertexBase: vertex_project: Optional[str] = None, vertex_location: Optional[str] = None, vertex_api_version: Optional[Literal["v1", "v1beta1"]] = None, + use_psc_endpoint_format: bool = False, ) -> Tuple[Optional[str], str]: """ for cloudflare ai gateway - https://github.com/BerriAI/litellm/issues/4317 @@ -305,6 +306,11 @@ class VertexBase: 2. Vertex AI with standard proxies - constructs {api_base}:{endpoint} 3. Vertex AI with PSC endpoints - constructs full path structure {api_base}/v1/projects/{project}/locations/{location}/endpoints/{model}:{endpoint} + (only when use_psc_endpoint_format=True) + + Args: + use_psc_endpoint_format: If True, constructs PSC endpoint URL format. + If False (default), uses api_base as-is and appends :{endpoint} ## Returns - (auth_header, url) - Tuple[Optional[str], str] @@ -325,33 +331,25 @@ class VertexBase: auth_header = {"x-goog-api-key": gemini_api_key} # type: ignore[assignment] else: # For Vertex AI - # Check if this is a PSC endpoint or custom deployment - # PSC/custom endpoints need the full path structure - if vertex_project and vertex_location and model: + if use_psc_endpoint_format: + # User explicitly specified PSC endpoint format + # Construct full PSC/custom endpoint URL + if not (vertex_project and vertex_location and model): + raise ValueError( + "vertex_project, vertex_location, and model are required when use_psc_endpoint_format=True" + ) # Strip routing prefixes (bge/, gemma/, etc.) for endpoint URL construction model_for_url = get_vertex_base_model_name(model=model) - - # Check if model is numeric (endpoint ID) or if api_base doesn't contain googleapis.com - # These are indicators of PSC/custom endpoints - is_psc_or_custom = ( - "googleapis.com" not in api_base.lower() or model_for_url.isdigit() + # Format: {api_base}/v1/projects/{project}/locations/{location}/endpoints/{model}:{endpoint} + version = vertex_api_version or "v1" + url = "{}/{}/projects/{}/locations/{}/endpoints/{}:{}".format( + api_base.rstrip("/"), + version, + vertex_project, + vertex_location, + model_for_url, + endpoint, ) - - if is_psc_or_custom: - # Construct full PSC/custom endpoint URL - # Format: {api_base}/v1/projects/{project}/locations/{location}/endpoints/{model}:{endpoint} - version = vertex_api_version or "v1" - url = "{}/{}/projects/{}/locations/{}/endpoints/{}:{}".format( - api_base.rstrip("/"), - version, - vertex_project, - vertex_location, - model_for_url, - endpoint, - ) - else: - # Standard proxy - just append endpoint - url = "{}:{}".format(api_base, endpoint) else: # Fallback to simple format if we don't have all parameters url = "{}:{}".format(api_base, endpoint) @@ -372,6 +370,7 @@ class VertexBase: api_base: Optional[str], should_use_v1beta1_features: Optional[bool] = False, mode: all_gemini_url_modes = "chat", + use_psc_endpoint_format: bool = False, ) -> Tuple[Optional[str], str]: """ Internal function. Returns the token and url for the call. @@ -421,6 +420,7 @@ class VertexBase: vertex_project=vertex_project, vertex_location=vertex_location, vertex_api_version=version, + use_psc_endpoint_format=use_psc_endpoint_format, ) def _handle_reauthentication( diff --git a/tests/test_litellm/llms/ragflow/chat/__init__.py b/tests/test_litellm/llms/ragflow/chat/__init__.py deleted file mode 100644 index 4e074b84150..00000000000 --- a/tests/test_litellm/llms/ragflow/chat/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -""" -RAGFlow chat transformation tests. -""" - diff --git a/tests/test_litellm/llms/vertex_ai/test_vertex_ai_psc_endpoint_support.py b/tests/test_litellm/llms/vertex_ai/test_vertex_ai_psc_endpoint_support.py index c158c93be9d..5e15aa2336e 100644 --- a/tests/test_litellm/llms/vertex_ai/test_vertex_ai_psc_endpoint_support.py +++ b/tests/test_litellm/llms/vertex_ai/test_vertex_ai_psc_endpoint_support.py @@ -26,6 +26,7 @@ class TestVertexAIPSCEndpointSupport: endpoint_id = "1234567890" project_id = "test-project" location = "us-central1" + use_psc_endpoint_format = True auth_header, url = vertex_base._check_custom_proxy( api_base=psc_api_base, @@ -39,6 +40,7 @@ class TestVertexAIPSCEndpointSupport: vertex_project=project_id, vertex_location=location, vertex_api_version="v1", + use_psc_endpoint_format=use_psc_endpoint_format, ) expected_url = f"{psc_api_base}/v1/projects/{project_id}/locations/{location}/endpoints/{endpoint_id}:predict" @@ -53,7 +55,7 @@ class TestVertexAIPSCEndpointSupport: endpoint_id = "1234567890" project_id = "test-project" location = "us-central1" - + use_psc_endpoint_format = True auth_header, url = vertex_base._check_custom_proxy( api_base=psc_api_base, custom_llm_provider="vertex_ai", @@ -66,6 +68,7 @@ class TestVertexAIPSCEndpointSupport: vertex_project=project_id, vertex_location=location, vertex_api_version="v1", + use_psc_endpoint_format=use_psc_endpoint_format, ) expected_url = f"{psc_api_base}/v1/projects/{project_id}/locations/{location}/endpoints/{endpoint_id}:streamGenerateContent?alt=sse" @@ -80,7 +83,7 @@ class TestVertexAIPSCEndpointSupport: endpoint_id = "1234567890" project_id = "test-project" location = "us-central1" - + use_psc_endpoint_format = True auth_header, url = vertex_base._check_custom_proxy( api_base=psc_api_base, custom_llm_provider="vertex_ai", @@ -93,6 +96,7 @@ class TestVertexAIPSCEndpointSupport: vertex_project=project_id, vertex_location=location, vertex_api_version="v1beta1", + use_psc_endpoint_format=use_psc_endpoint_format, ) expected_url = f"{psc_api_base}/v1beta1/projects/{project_id}/locations/{location}/endpoints/{endpoint_id}:predict" @@ -107,7 +111,7 @@ class TestVertexAIPSCEndpointSupport: endpoint_id = "1234567890" project_id = "test-project" location = "us-central1" - + use_psc_endpoint_format = True auth_header, url = vertex_base._check_custom_proxy( api_base=psc_api_base, custom_llm_provider="vertex_ai", @@ -120,6 +124,7 @@ class TestVertexAIPSCEndpointSupport: vertex_project=project_id, vertex_location=location, vertex_api_version="v1", + use_psc_endpoint_format=use_psc_endpoint_format, ) expected_url = f"{psc_api_base}/v1/projects/{project_id}/locations/{location}/endpoints/{endpoint_id}:predict" @@ -134,7 +139,7 @@ class TestVertexAIPSCEndpointSupport: endpoint_id = "1234567890" project_id = "test-project" location = "us-central1" - + use_psc_endpoint_format = True auth_header, url = vertex_base._check_custom_proxy( api_base=psc_api_base, custom_llm_provider="vertex_ai", @@ -147,6 +152,7 @@ class TestVertexAIPSCEndpointSupport: vertex_project=project_id, vertex_location=location, vertex_api_version="v1", + use_psc_endpoint_format=use_psc_endpoint_format, ) # rstrip('/') should remove the trailing slash @@ -162,7 +168,6 @@ class TestVertexAIPSCEndpointSupport: endpoint_id = "gemini-pro" # Not numeric project_id = "test-project" location = "us-central1" - auth_header, url = vertex_base._check_custom_proxy( api_base=proxy_api_base, custom_llm_provider="vertex_ai", @@ -190,7 +195,7 @@ class TestVertexAIPSCEndpointSupport: endpoint_id = "9876543210" # Numeric endpoint ID project_id = "test-project" location = "us-central1" - + use_psc_endpoint_format = True auth_header, url = vertex_base._check_custom_proxy( api_base=proxy_api_base, custom_llm_provider="vertex_ai", @@ -203,6 +208,7 @@ class TestVertexAIPSCEndpointSupport: vertex_project=project_id, vertex_location=location, vertex_api_version="v1", + use_psc_endpoint_format=use_psc_endpoint_format, ) # Numeric model should trigger full path construction @@ -215,7 +221,7 @@ class TestVertexAIPSCEndpointSupport: """Test that when api_base is None, the original URL is returned""" vertex_base = VertexBase() original_url = "https://us-central1-aiplatform.googleapis.com/v1/projects/test/locations/us-central1/publishers/google/models/gemini-pro:generateContent" - + use_psc_endpoint_format = True auth_header, url = vertex_base._check_custom_proxy( api_base=None, custom_llm_provider="vertex_ai", @@ -228,6 +234,7 @@ class TestVertexAIPSCEndpointSupport: vertex_project="test-project", vertex_location="us-central1", vertex_api_version="v1", + use_psc_endpoint_format=use_psc_endpoint_format, ) # When api_base is None, original URL should be returned unchanged @@ -238,7 +245,7 @@ class TestVertexAIPSCEndpointSupport: vertex_base = VertexBase() psc_api_base = "http://10.96.32.8" test_auth_header = "Bearer test-token-12345" - + use_psc_endpoint_format = True auth_header, url = vertex_base._check_custom_proxy( api_base=psc_api_base, custom_llm_provider="vertex_ai", @@ -251,6 +258,7 @@ class TestVertexAIPSCEndpointSupport: vertex_project="test-project", vertex_location="us-central1", vertex_api_version="v1", + use_psc_endpoint_format=use_psc_endpoint_format, ) assert ( From 64c001255d9e51e46cdff2cadedec1c9c2982d59 Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Sat, 6 Dec 2025 00:20:30 +0530 Subject: [PATCH 072/178] Add embedding pcs support --- .../llms/vertex_ai/vertex_embeddings/embedding_handler.py | 8 ++++++++ tests/test_litellm/llms/vertex_ai/test_bge_embedding.py | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/litellm/llms/vertex_ai/vertex_embeddings/embedding_handler.py b/litellm/llms/vertex_ai/vertex_embeddings/embedding_handler.py index aaa6a0bb95f..8a03738ad78 100644 --- a/litellm/llms/vertex_ai/vertex_embeddings/embedding_handler.py +++ b/litellm/llms/vertex_ai/vertex_embeddings/embedding_handler.py @@ -72,6 +72,9 @@ class VertexEmbedding(VertexBase): project_id=vertex_project, custom_llm_provider=custom_llm_provider, ) + # Extract use_psc_endpoint_format from optional_params + use_psc_endpoint_format = optional_params.get("use_psc_endpoint_format", False) + auth_header, api_base = self._get_token_and_url( model=model, gemini_api_key=gemini_api_key, @@ -84,6 +87,7 @@ class VertexEmbedding(VertexBase): api_base=api_base, should_use_v1beta1_features=should_use_v1beta1_features, mode="embedding", + use_psc_endpoint_format=use_psc_endpoint_format, ) headers = self.set_headers(auth_header=auth_header, extra_headers=extra_headers) vertex_request: VertexEmbeddingRequest = ( @@ -164,6 +168,9 @@ class VertexEmbedding(VertexBase): project_id=vertex_project, custom_llm_provider=custom_llm_provider, ) + # Extract use_psc_endpoint_format from optional_params + use_psc_endpoint_format = optional_params.get("use_psc_endpoint_format", False) + auth_header, api_base = self._get_token_and_url( model=model, gemini_api_key=gemini_api_key, @@ -176,6 +183,7 @@ class VertexEmbedding(VertexBase): api_base=api_base, should_use_v1beta1_features=should_use_v1beta1_features, mode="embedding", + use_psc_endpoint_format=use_psc_endpoint_format, ) headers = self.set_headers(auth_header=auth_header, extra_headers=extra_headers) vertex_request: VertexEmbeddingRequest = ( diff --git a/tests/test_litellm/llms/vertex_ai/test_bge_embedding.py b/tests/test_litellm/llms/vertex_ai/test_bge_embedding.py index 156ab95184a..4a06e9ea1aa 100644 --- a/tests/test_litellm/llms/vertex_ai/test_bge_embedding.py +++ b/tests/test_litellm/llms/vertex_ai/test_bge_embedding.py @@ -214,7 +214,8 @@ def test_vertex_ai_bge_psc_endpoint_url_construction(): api_base="http://10.128.16.2", vertex_project="gen-lang-client-0682925754", vertex_location="us-central1", - client=client + client=client, + use_psc_endpoint_format=True # Enable PSC endpoint format for this test ) mock_post.assert_called_once() From 77cce4202ed75f9977192348f56cf9916483bb70 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Fri, 5 Dec 2025 10:56:15 -0800 Subject: [PATCH 073/178] [Bug fix] WatsonX audio transcriptions, don't force content type in request headers (#17546) * fix watsonx content type * watsonx content type --- .../audio_transcription/transformation.py | 34 ++++++++++++++++++- ...sonx_audio_transcription_transformation.py | 3 ++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/litellm/llms/watsonx/audio_transcription/transformation.py b/litellm/llms/watsonx/audio_transcription/transformation.py index 8fe8b4a4248..368d755777c 100644 --- a/litellm/llms/watsonx/audio_transcription/transformation.py +++ b/litellm/llms/watsonx/audio_transcription/transformation.py @@ -8,7 +8,10 @@ from typing import Any, Dict, List, Optional import litellm from litellm.litellm_core_utils.audio_utils.utils import process_audio_file -from litellm.types.llms.openai import OpenAIAudioTranscriptionOptionalParams +from litellm.types.llms.openai import ( + AllMessageValues, + OpenAIAudioTranscriptionOptionalParams, +) from litellm.types.llms.watsonx import WatsonXAudioTranscriptionRequestBody from litellm.types.utils import FileTypes @@ -32,6 +35,35 @@ class IBMWatsonXAudioTranscriptionConfig( for authentication and URL construction. """ + def validate_environment( + self, + headers: Dict, + model: str, + messages: List[AllMessageValues], + optional_params: Dict, + litellm_params: dict, + api_key: Optional[str] = None, + api_base: Optional[str] = None, + ) -> Dict: + """ + Validate environment for audio transcription. + + Removes Content-Type header so httpx can set multipart/form-data automatically. + """ + result = IBMWatsonXMixin.validate_environment( + self, + headers=headers, + model=model, + messages=messages, + optional_params=optional_params, + litellm_params=litellm_params, + api_key=api_key, + api_base=api_base, + ) + # Remove Content-Type so httpx sets multipart/form-data automatically + result.pop("Content-Type", None) + return result + def get_supported_openai_params( self, model: str ) -> List[OpenAIAudioTranscriptionOptionalParams]: diff --git a/tests/test_litellm/llms/watsonx/audio_transcription/test_watsonx_audio_transcription_transformation.py b/tests/test_litellm/llms/watsonx/audio_transcription/test_watsonx_audio_transcription_transformation.py index 1286c2d4fe6..049285343d4 100644 --- a/tests/test_litellm/llms/watsonx/audio_transcription/test_watsonx_audio_transcription_transformation.py +++ b/tests/test_litellm/llms/watsonx/audio_transcription/test_watsonx_audio_transcription_transformation.py @@ -63,6 +63,9 @@ class TestWatsonXAudioTranscription: assert "Authorization" in captured_request["headers"] assert "Bearer test-bearer-token" in captured_request["headers"]["Authorization"] + # Validate Content-Type is NOT set (httpx sets multipart/form-data automatically) + assert "Content-Type" not in captured_request["headers"] + # Validate project_id is in form data, not URL assert captured_request["data"].get("project_id") == "test-project-123" From a750f5ca69a9594c7726243872be03584fc464d5 Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Fri, 5 Dec 2025 11:08:04 -0800 Subject: [PATCH 074/178] =?UTF-8?q?bump:=20version=200.1.22=20=E2=86=92=20?= =?UTF-8?q?0.1.23?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- enterprise/pyproject.toml | 4 ++-- pyproject.toml | 2 +- requirements.txt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/enterprise/pyproject.toml b/enterprise/pyproject.toml index 2c1fa9945bb..2305a5e635c 100644 --- a/enterprise/pyproject.toml +++ b/enterprise/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "litellm-enterprise" -version = "0.1.22" +version = "0.1.23" description = "Package for LiteLLM Enterprise features" authors = ["BerriAI"] readme = "README.md" @@ -22,7 +22,7 @@ requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" [tool.commitizen] -version = "0.1.22" +version = "0.1.23" version_files = [ "pyproject.toml:version", "../requirements.txt:litellm-enterprise==", diff --git a/pyproject.toml b/pyproject.toml index 81e31a5ea81..cb2003dab2d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -61,7 +61,7 @@ redisvl = {version = "^0.4.1", optional = true, markers = "python_version >= '3. mcp = {version = "^1.21.2", optional = true, python = ">=3.10"} litellm-proxy-extras = {version = "0.4.9", optional = true} rich = {version = "13.7.1", optional = true} -litellm-enterprise = {version = "0.1.22", optional = true} +litellm-enterprise = {version = "0.1.23", optional = true} diskcache = {version = "^5.6.1", optional = true} polars = {version = "^1.31.0", optional = true, python = ">=3.10"} semantic-router = {version = ">=0.1.12", optional = true, python = ">=3.9,<3.14"} diff --git a/requirements.txt b/requirements.txt index b61428588d7..7c9d10481a0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -64,4 +64,4 @@ soundfile==0.12.1 # for audio file processing ######################## # LITELLM ENTERPRISE DEPENDENCIES ######################## -litellm-enterprise==0.1.22 +litellm-enterprise==0.1.23 From 6a60c950fec9487ef982911e0964407a1845abab Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Fri, 5 Dec 2025 11:14:00 -0800 Subject: [PATCH 075/178] bumping enterprise build --- .../litellm_enterprise-0.1.23-py3-none-any.whl | Bin 0 -> 103376 bytes .../dist/litellm_enterprise-0.1.23.tar.gz | Bin 0 -> 42994 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 enterprise/dist/litellm_enterprise-0.1.23-py3-none-any.whl create mode 100644 enterprise/dist/litellm_enterprise-0.1.23.tar.gz diff --git a/enterprise/dist/litellm_enterprise-0.1.23-py3-none-any.whl b/enterprise/dist/litellm_enterprise-0.1.23-py3-none-any.whl new file mode 100644 index 0000000000000000000000000000000000000000..c061e793bc2bde78a69ad9b86af10eb989aea3a0 GIT binary patch literal 103376 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

s>RhoQNz!X1zqWZfYZa8HCXCHGjt+Ph#YkIX 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�c4R~ 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⁣v(zU>%oa|HZZee zYdCva@_YaQMgibq#Z?YF0T6!Nv^qYRL|Ot^Gyho4a)tjs%MM~?YvFR7_6XTEK#=2X z7-+l0V~=#?NqES`^DpNWrpuOD$a&?Tb|KN@lYo&%upL-a{+rUua<-N>iK%hqHq=K@*@tc6mgo~Ot)NbDXSg}S1Oc}5olV?erpUCI z$Ml?D=Q%?|z>fj^!*-L~)8FTVJvdt{^M4&Bp1vz;NCEIIP~p;tx~;^slfd0foM2$x zb&R-dDI%3tfQVGF!{W+3KLODLVPyyV*L6pQ&J2+q4dmIz&!PjO72QI0TT=#AdK-Zhp!?73Q`O}t^@Dk=GA&}0IA?IK=FyOIsqh z6=4lPMSx~Lye0Q69`7jS^q%G=lnhz*^R+6=+_%Yl#Whu zo&ehp#u2F>G9%5ql-v`bL1?d^%*x*`kE~MyAaaN3a5eknpA2Z>WM%ftYPOlaC_o3W zBtWqb&rqm^Cqsi%Sa1;fOE`|+RugjBX$jzm*GQp7CxRoK{?!=3C{YGC=0NKL_TfQH zzW4-eODhM5Uu##GLmWaJfP;W`T|1;*Z%a-BhC2Wg=olO1Z8|KP76^&JIJ(5PE;|9w z7R0MNhL&U`*N9vT-Uh_OQ~ylG3262n;N0RDTVm?zwpd8#lzf2II8>?0RVTnYxXtK4-=Lf^;Y_1oXqb z*Rk;gbT=ym)bf{#R`p0tHw}POFpu_L*5;Fe!K(3?{uD)%r;czj}h}JWFg<%*gF9Gcb_=@6{hqs(_3OAe|i1iiv3UJJ3GToEWxk+{GayC?P|(9QR0GcU|5ClbZ=`VlsXBlEhshuHbX*P5H1psrP@ zZ>s+b%wH6Z+-r2^{xj{9nTfd-I6yt7dXA>1`>Xs^|6#BI`ssHcmrd$d8hSKe+~1fS z-~{l$Vg5KkJ2rdV(e8FMYu4XXTE_pCid3=Vq&}ujk0yBf8@s^t3+#~yu}6hDnqcVf zQfpa$QR8CCH^VBd$0Y^iK{|y-7 zKNj#`2NXX_IvS+;Z_CjFPi9usTzDCB5N#2*k;wQK*~xBnR-QB4U0 USP3X7{@{<=6<}o{Z=az2A1}upr2qf` literal 0 HcmV?d00001 diff --git a/enterprise/dist/litellm_enterprise-0.1.23.tar.gz b/enterprise/dist/litellm_enterprise-0.1.23.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..b84c2ba0f2188297d98328715b2d2d5b30694520 GIT binary patch literal 42994 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 Date: Fri, 5 Dec 2025 11:45:23 -0800 Subject: [PATCH 076/178] Fix: Allow null max_budget in budget update endpoint (#17545) Co-authored-by: Cursor Agent Co-authored-by: ishaan --- .../budget_management_endpoints.py | 2 +- .../test_budget_endpoints.py | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/litellm/proxy/management_endpoints/budget_management_endpoints.py b/litellm/proxy/management_endpoints/budget_management_endpoints.py index 804fe274cc9..2d86f74a41c 100644 --- a/litellm/proxy/management_endpoints/budget_management_endpoints.py +++ b/litellm/proxy/management_endpoints/budget_management_endpoints.py @@ -110,7 +110,7 @@ async def update_budget( response = await prisma_client.db.litellm_budgettable.update( where={"budget_id": budget_obj.budget_id}, data={ - **budget_obj.model_dump(exclude_none=True), # type: ignore + **budget_obj.model_dump(exclude_unset=True), # type: ignore "updated_by": user_api_key_dict.user_id or litellm_proxy_admin_name, }, # type: ignore ) diff --git a/tests/test_litellm/proxy/management_endpoints/test_budget_endpoints.py b/tests/test_litellm/proxy/management_endpoints/test_budget_endpoints.py index 5dab71a1679..b4dcc33c747 100644 --- a/tests/test_litellm/proxy/management_endpoints/test_budget_endpoints.py +++ b/tests/test_litellm/proxy/management_endpoints/test_budget_endpoints.py @@ -130,3 +130,36 @@ async def test_update_budget_db_not_connected(client_and_mocks, monkeypatch): assert resp.status_code == 500 detail = resp.json()["detail"] assert detail["error"] == CommonProxyErrors.db_not_connected_error.value + + +@pytest.mark.asyncio +async def test_update_budget_allows_null_max_budget(client_and_mocks): + """ + Test that /budget/update allows setting max_budget to null. + + Previously, using exclude_none=True would drop null values, + making it impossible to remove a budget limit. With exclude_unset=True, + explicitly setting max_budget to null should include it in the update. + """ + client, _, mock_table = client_and_mocks + + captured_data = {} + + async def capture_update(*, where, data): + captured_data.update(data) + return {**where, **data} + + mock_table.update = AsyncMock(side_effect=capture_update) + + payload = { + "budget_id": "budget_789", + "max_budget": None, # Explicitly setting to null to remove budget limit + } + resp = client.post("/budget/update", json=payload) + assert resp.status_code == 200, resp.text + + # Verify that max_budget=None was included in the update data + assert "max_budget" in captured_data, "max_budget should be included when explicitly set to null" + assert captured_data["max_budget"] is None, "max_budget should be None" + + mock_table.update.assert_awaited_once() From 6b74e8223bf74daada1412882d107dccc774b777 Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Fri, 5 Dec 2025 12:23:25 -0800 Subject: [PATCH 077/178] change useAuthorized Hook to redirect to new login page --- .../(dashboard)/hooks/useAuthorized.test.ts | 80 +++++++++++++++++++ .../app/(dashboard)/hooks/useAuthorized.ts | 5 +- 2 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 ui/litellm-dashboard/src/app/(dashboard)/hooks/useAuthorized.test.ts diff --git a/ui/litellm-dashboard/src/app/(dashboard)/hooks/useAuthorized.test.ts b/ui/litellm-dashboard/src/app/(dashboard)/hooks/useAuthorized.test.ts new file mode 100644 index 00000000000..5059d5d69d1 --- /dev/null +++ b/ui/litellm-dashboard/src/app/(dashboard)/hooks/useAuthorized.test.ts @@ -0,0 +1,80 @@ +/* @vitest-environment jsdom */ +import { renderHook } from "@testing-library/react"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import useAuthorized from "./useAuthorized"; + +const replaceMock = vi.fn(); +const clearTokenCookiesMock = vi.fn(); +const getProxyBaseUrlMock = vi.fn(() => "http://proxy.example"); + +vi.mock("next/navigation", () => ({ + useRouter: () => ({ + replace: replaceMock, + }), +})); + +vi.mock("@/components/networking", () => ({ + getProxyBaseUrl: getProxyBaseUrlMock, +})); + +vi.mock("@/utils/cookieUtils", async (importOriginal) => { + const actual = await importOriginal(); + return { + ...actual, + clearTokenCookies: clearTokenCookiesMock, + }; +}); + +const createJwt = (payload: Record) => { + const base64Url = btoa(JSON.stringify(payload)).replace(/=+$/, "").replace(/\+/g, "-").replace(/\//g, "_"); + return `eyJhbGciOiJub25lIn0.${base64Url}.signature`; +}; + +const clearCookie = () => { + document.cookie = "token=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; +}; + +describe("useAuthorized", () => { + afterEach(() => { + replaceMock.mockReset(); + clearTokenCookiesMock.mockReset(); + getProxyBaseUrlMock.mockClear(); + clearCookie(); + }); + + it("should decode the token and expose user details", () => { + const token = createJwt({ + key: "api-key-123", + user_id: "user-1", + user_email: "user@example.com", + user_role: "app_admin", + premium_user: true, + disabled_non_admin_personal_key_creation: false, + login_method: "username_password", + }); + document.cookie = `token=${token}; path=/;`; + + const { result } = renderHook(() => useAuthorized()); + + expect(result.current.token).toBe(token); + expect(result.current.accessToken).toBe("api-key-123"); + expect(result.current.userId).toBe("user-1"); + expect(result.current.userEmail).toBe("user@example.com"); + expect(result.current.userRole).toBe("Admin"); + expect(result.current.premiumUser).toBe(true); + expect(result.current.disabledPersonalKeyCreation).toBe(false); + expect(result.current.showSSOBanner).toBe(true); + expect(replaceMock).not.toHaveBeenCalled(); + }); + + it("should clear cookies and redirect on an invalid token", () => { + document.cookie = "token=invalid-token; path=/;"; + + const { result } = renderHook(() => useAuthorized()); + + expect(clearTokenCookiesMock).toHaveBeenCalled(); + expect(replaceMock).toHaveBeenCalledWith("http://proxy.example/ui/login"); + expect(result.current.accessToken).toBeNull(); + expect(result.current.userRole).toBe("Unknown Role"); + }); +}); diff --git a/ui/litellm-dashboard/src/app/(dashboard)/hooks/useAuthorized.ts b/ui/litellm-dashboard/src/app/(dashboard)/hooks/useAuthorized.ts index cba7c1a3dc8..7610c6346be 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/hooks/useAuthorized.ts +++ b/ui/litellm-dashboard/src/app/(dashboard)/hooks/useAuthorized.ts @@ -4,6 +4,7 @@ import { useEffect, useMemo } from "react"; import { useRouter } from "next/navigation"; import { jwtDecode } from "jwt-decode"; import { clearTokenCookies, getCookie } from "@/utils/cookieUtils"; +import { getProxyBaseUrl } from "@/components/networking"; function formatUserRole(userRole: string) { if (!userRole) { @@ -42,7 +43,7 @@ const useAuthorized = () => { // Redirect after mount if missing/invalid token useEffect(() => { if (!token) { - router.replace("/sso/key/generate"); + router.replace(`${getProxyBaseUrl()}/ui/login`); } }, [token, router]); @@ -54,7 +55,7 @@ const useAuthorized = () => { } catch { // Bad token in cookie — clear and bounce clearTokenCookies(); - router.replace("/sso/key/generate"); + router.replace(`${getProxyBaseUrl()}/ui/login`); return null; } }, [token, router]); From ac9ce4390221da0ee7ee16c55ea96f00ab499ab3 Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Fri, 5 Dec 2025 12:24:22 -0800 Subject: [PATCH 078/178] Fixing test --- .../src/app/(dashboard)/hooks/useAuthorized.test.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ui/litellm-dashboard/src/app/(dashboard)/hooks/useAuthorized.test.ts b/ui/litellm-dashboard/src/app/(dashboard)/hooks/useAuthorized.test.ts index 5059d5d69d1..9198450a63d 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/hooks/useAuthorized.test.ts +++ b/ui/litellm-dashboard/src/app/(dashboard)/hooks/useAuthorized.test.ts @@ -3,9 +3,11 @@ import { renderHook } from "@testing-library/react"; import { afterEach, describe, expect, it, vi } from "vitest"; import useAuthorized from "./useAuthorized"; -const replaceMock = vi.fn(); -const clearTokenCookiesMock = vi.fn(); -const getProxyBaseUrlMock = vi.fn(() => "http://proxy.example"); +const { replaceMock, clearTokenCookiesMock, getProxyBaseUrlMock } = vi.hoisted(() => ({ + replaceMock: vi.fn(), + clearTokenCookiesMock: vi.fn(), + getProxyBaseUrlMock: vi.fn(() => "http://proxy.example"), +})); vi.mock("next/navigation", () => ({ useRouter: () => ({ @@ -75,6 +77,6 @@ describe("useAuthorized", () => { expect(clearTokenCookiesMock).toHaveBeenCalled(); expect(replaceMock).toHaveBeenCalledWith("http://proxy.example/ui/login"); expect(result.current.accessToken).toBeNull(); - expect(result.current.userRole).toBe("Unknown Role"); + expect(result.current.userRole).toBe("Undefined Role"); }); }); From e21bf1982cf687ace89b8bb1db8f34fb0eb9077f Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Fri, 5 Dec 2025 12:40:58 -0800 Subject: [PATCH 079/178] Fixing e2e --- .../e2e_ui_tests/view_internal_user.spec.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/proxy_admin_ui_tests/e2e_ui_tests/view_internal_user.spec.ts b/tests/proxy_admin_ui_tests/e2e_ui_tests/view_internal_user.spec.ts index 8be5ff0c540..832832d8ae8 100644 --- a/tests/proxy_admin_ui_tests/e2e_ui_tests/view_internal_user.spec.ts +++ b/tests/proxy_admin_ui_tests/e2e_ui_tests/view_internal_user.spec.ts @@ -39,9 +39,8 @@ test("view internal user page", async ({ page }) => { const rowCount = await page.locator("tbody tr").count(); expect(rowCount).toBeGreaterThan(0); - const userIdHeader = page.locator("th", { hasText: "User ID" }); - page.screenshot({ path: "test-results/user_id_header.png" }); - await expect(userIdHeader).toBeVisible(); + const userIdHeader = await page.locator("th", { hasText: "User ID" }); + await expect(userIdHeader).toBeVisible({ timeout: 10000 }); // test pagination // Wait for pagination controls to be visible From 1ea7803d3998ee45324538e6a57fc1b798677b6e Mon Sep 17 00:00:00 2001 From: rgshr <112012302+rgshr@users.noreply.github.com> Date: Fri, 5 Dec 2025 12:42:25 -0800 Subject: [PATCH 080/178] fix(github_copilot): preserve encrypted_content in reasoning items for multi-turn conversations (#17130) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(github_copilot): preserve encrypted_content in reasoning items for multi-turn conversations GitHub Copilot uses encrypted_content in reasoning items to maintain conversation state across turns. The parent class (OpenAIResponsesAPIConfig._handle_reasoning_item) strips this field when converting to OpenAI's ResponseReasoningItem model, causing "encrypted content could not be verified" errors on multi-turn requests. This override preserves encrypted_content while still filtering out status=None which OpenAI's API rejects. šŸ¤– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude * chore: regenerate poetry.lock * Revert "chore: regenerate poetry.lock" This reverts commit 8796dc8f960571f57945f951709f4eba3c6fc8b2. --------- Co-authored-by: Claude --- .../responses/transformation.py | 38 ++++++++++ ...github_copilot_responses_transformation.py | 69 +++++++++++++++++++ 2 files changed, 107 insertions(+) diff --git a/litellm/llms/github_copilot/responses/transformation.py b/litellm/llms/github_copilot/responses/transformation.py index b3f70b406cd..e19fabc17c7 100644 --- a/litellm/llms/github_copilot/responses/transformation.py +++ b/litellm/llms/github_copilot/responses/transformation.py @@ -177,6 +177,44 @@ class GithubCopilotResponsesAPIConfig(OpenAIResponsesAPIConfig): # Return the responses endpoint return f"{api_base}/responses" + def _handle_reasoning_item(self, item: Dict[str, Any]) -> Dict[str, Any]: + """ + Handle reasoning items for GitHub Copilot, preserving encrypted_content. + + GitHub Copilot uses encrypted_content in reasoning items to maintain + conversation state across turns. The parent class strips this field + when converting to OpenAI's ResponseReasoningItem model, which causes + "encrypted content could not be verified" errors on multi-turn requests. + + This override preserves encrypted_content while still filtering out + status=None which OpenAI's API rejects. + """ + if item.get("type") == "reasoning": + # Preserve encrypted_content before parent processing + encrypted_content = item.get("encrypted_content") + + # Filter out None values for known problematic fields, + # but preserve encrypted_content even if it exists + filtered_item: Dict[str, Any] = {} + for k, v in item.items(): + # Always include encrypted_content if present (even if None) + if k == "encrypted_content": + if encrypted_content is not None: + filtered_item[k] = v + continue + # Filter out status=None which OpenAI API rejects + if k == "status" and v is None: + continue + # Include all other non-None values + if v is not None: + filtered_item[k] = v + + verbose_logger.debug( + f"GitHub Copilot reasoning item processed, encrypted_content preserved: {encrypted_content is not None}" + ) + return filtered_item + return item + # ==================== Helper Methods ==================== def _get_input_from_params( diff --git a/tests/test_litellm/llms/github_copilot/responses/test_github_copilot_responses_transformation.py b/tests/test_litellm/llms/github_copilot/responses/test_github_copilot_responses_transformation.py index d6032c61c60..1feb0244dbb 100644 --- a/tests/test_litellm/llms/github_copilot/responses/test_github_copilot_responses_transformation.py +++ b/tests/test_litellm/llms/github_copilot/responses/test_github_copilot_responses_transformation.py @@ -301,3 +301,72 @@ class TestGithubCopilotResponsesAPITransformation: for param in expected_params: assert param in supported, f"{param} should be in supported params" + + def test_handle_reasoning_item_preserves_encrypted_content(self): + """Test that _handle_reasoning_item preserves encrypted_content for GitHub Copilot. + + GitHub Copilot uses encrypted_content in reasoning items to maintain + conversation state across turns. This field must be preserved for + multi-turn conversations to work. + """ + config = GithubCopilotResponsesAPIConfig() + + reasoning_item = { + "type": "reasoning", + "id": "reasoning-123", + "summary": ["Step 1", "Step 2"], + "encrypted_content": "encrypted-blob-abc123", + "status": None, # Should be filtered out + "content": None, # Should be filtered out + } + + result = config._handle_reasoning_item(reasoning_item) + + # encrypted_content should be preserved + assert result.get("encrypted_content") == "encrypted-blob-abc123", ( + "encrypted_content must be preserved for GitHub Copilot multi-turn conversations" + ) + # status=None should be filtered out + assert "status" not in result, "status=None should be filtered out" + # content=None should be filtered out + assert "content" not in result, "content=None should be filtered out" + # Other fields should be preserved + assert result.get("type") == "reasoning" + assert result.get("id") == "reasoning-123" + assert result.get("summary") == ["Step 1", "Step 2"] + + def test_handle_reasoning_item_without_encrypted_content(self): + """Test _handle_reasoning_item when encrypted_content is not present""" + config = GithubCopilotResponsesAPIConfig() + + reasoning_item = { + "type": "reasoning", + "id": "reasoning-456", + "summary": ["Thinking..."], + "status": None, + } + + result = config._handle_reasoning_item(reasoning_item) + + # Should not have encrypted_content key at all + assert "encrypted_content" not in result + # status=None should be filtered out + assert "status" not in result + # Other fields preserved + assert result.get("type") == "reasoning" + assert result.get("id") == "reasoning-456" + + def test_handle_reasoning_item_non_reasoning_passthrough(self): + """Test _handle_reasoning_item passes through non-reasoning items unchanged""" + config = GithubCopilotResponsesAPIConfig() + + message_item = { + "type": "message", + "role": "assistant", + "content": [{"type": "output_text", "text": "Hello"}], + } + + result = config._handle_reasoning_item(message_item) + + # Non-reasoning items should pass through unchanged + assert result == message_item From 4eb9f8036f16a286618f0783f8bef075daf64246 Mon Sep 17 00:00:00 2001 From: Cesar Garcia <128240629+Chesars@users.noreply.github.com> Date: Fri, 5 Dec 2025 17:46:14 -0300 Subject: [PATCH 081/178] Add gpt-5.1-codex-max model pricing and configuration (#17541) Add support for OpenAI's gpt-5.1-codex-max model, their most intelligent coding model optimized for long-horizon agentic coding tasks. - 400k context window, 128k max output tokens - $1.25/1M input, $10/1M output, $0.125/1M cached input - Only available via /v1/responses endpoint - Supports vision, function calling, reasoning, prompt caching --- ...odel_prices_and_context_window_backup.json | 60 +++++++++++++++++++ model_prices_and_context_window.json | 60 +++++++++++++++++++ .../llms/openai/test_gpt5_transformation.py | 1 + 3 files changed, 121 insertions(+) diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json index d02a01e3a67..634ea6dc48a 100644 --- a/litellm/model_prices_and_context_window_backup.json +++ b/litellm/model_prices_and_context_window_backup.json @@ -3316,6 +3316,36 @@ "supports_tool_choice": true, "supports_vision": true }, + "azure/gpt-5.1-codex-max": { + "cache_read_input_token_cost": 1.25e-07, + "input_cost_per_token": 1.25e-06, + "litellm_provider": "azure", + "max_input_tokens": 400000, + "max_output_tokens": 128000, + "max_tokens": 128000, + "mode": "responses", + "output_cost_per_token": 1e-05, + "supported_endpoints": [ + "/v1/responses" + ], + "supported_modalities": [ + "text", + "image" + ], + "supported_output_modalities": [ + "text" + ], + "supports_function_calling": true, + "supports_native_streaming": true, + "supports_parallel_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_system_messages": false, + "supports_tool_choice": true, + "supports_vision": true + }, "azure/gpt-5.1-codex-mini": { "cache_read_input_token_cost": 2.5e-08, "input_cost_per_token": 2.5e-07, @@ -16345,6 +16375,36 @@ "supports_tool_choice": true, "supports_vision": true }, + "gpt-5.1-codex-max": { + "cache_read_input_token_cost": 1.25e-07, + "input_cost_per_token": 1.25e-06, + "litellm_provider": "openai", + "max_input_tokens": 400000, + "max_output_tokens": 128000, + "max_tokens": 128000, + "mode": "responses", + "output_cost_per_token": 1e-05, + "supported_endpoints": [ + "/v1/responses" + ], + "supported_modalities": [ + "text", + "image" + ], + "supported_output_modalities": [ + "text" + ], + "supports_function_calling": true, + "supports_native_streaming": true, + "supports_parallel_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_system_messages": false, + "supports_tool_choice": true, + "supports_vision": true + }, "gpt-5.1-codex-mini": { "cache_read_input_token_cost": 2.5e-08, "cache_read_input_token_cost_priority": 4.5e-08, diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json index d02a01e3a67..634ea6dc48a 100644 --- a/model_prices_and_context_window.json +++ b/model_prices_and_context_window.json @@ -3316,6 +3316,36 @@ "supports_tool_choice": true, "supports_vision": true }, + "azure/gpt-5.1-codex-max": { + "cache_read_input_token_cost": 1.25e-07, + "input_cost_per_token": 1.25e-06, + "litellm_provider": "azure", + "max_input_tokens": 400000, + "max_output_tokens": 128000, + "max_tokens": 128000, + "mode": "responses", + "output_cost_per_token": 1e-05, + "supported_endpoints": [ + "/v1/responses" + ], + "supported_modalities": [ + "text", + "image" + ], + "supported_output_modalities": [ + "text" + ], + "supports_function_calling": true, + "supports_native_streaming": true, + "supports_parallel_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_system_messages": false, + "supports_tool_choice": true, + "supports_vision": true + }, "azure/gpt-5.1-codex-mini": { "cache_read_input_token_cost": 2.5e-08, "input_cost_per_token": 2.5e-07, @@ -16345,6 +16375,36 @@ "supports_tool_choice": true, "supports_vision": true }, + "gpt-5.1-codex-max": { + "cache_read_input_token_cost": 1.25e-07, + "input_cost_per_token": 1.25e-06, + "litellm_provider": "openai", + "max_input_tokens": 400000, + "max_output_tokens": 128000, + "max_tokens": 128000, + "mode": "responses", + "output_cost_per_token": 1e-05, + "supported_endpoints": [ + "/v1/responses" + ], + "supported_modalities": [ + "text", + "image" + ], + "supported_output_modalities": [ + "text" + ], + "supports_function_calling": true, + "supports_native_streaming": true, + "supports_parallel_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_system_messages": false, + "supports_tool_choice": true, + "supports_vision": true + }, "gpt-5.1-codex-mini": { "cache_read_input_token_cost": 2.5e-08, "cache_read_input_token_cost_priority": 4.5e-08, diff --git a/tests/test_litellm/llms/openai/test_gpt5_transformation.py b/tests/test_litellm/llms/openai/test_gpt5_transformation.py index 5080a7a7c59..98d4ba9c10f 100644 --- a/tests/test_litellm/llms/openai/test_gpt5_transformation.py +++ b/tests/test_litellm/llms/openai/test_gpt5_transformation.py @@ -216,6 +216,7 @@ def test_gpt5_1_model_detection(gpt5_config: OpenAIGPT5Config): """Test that GPT-5.1 models are correctly detected.""" assert gpt5_config.is_model_gpt_5_1_model("gpt-5.1") assert gpt5_config.is_model_gpt_5_1_model("gpt-5.1-codex") + assert gpt5_config.is_model_gpt_5_1_model("gpt-5.1-codex-max") assert gpt5_config.is_model_gpt_5_1_model("gpt-5.1-chat") assert not gpt5_config.is_model_gpt_5_1_model("gpt-5") assert not gpt5_config.is_model_gpt_5_1_model("gpt-5-mini") From 655e04f16cd7255850d30275e631e2275dbd47b9 Mon Sep 17 00:00:00 2001 From: Alexsander Hamir Date: Fri, 5 Dec 2025 12:59:35 -0800 Subject: [PATCH 082/178] Fix: apply_guardrail method and improve test isolation (#17555) * Fix Bedrock guardrail apply_guardrail method and test mocks Fixed 4 failing tests in the guardrail test suite: 1. BedrockGuardrail.apply_guardrail now returns original texts when guardrail allows content but doesn't provide output/outputs fields. Previously returned empty list, causing test_bedrock_apply_guardrail_success to fail. 2. Updated test mocks to use correct Bedrock API response format: - Changed from 'content' field to 'output' field - Fixed nested structure from {'text': {'text': '...'}} to {'text': '...'} - Added missing 'output' field in filter test 3. Fixed endpoint test mocks to return GenericGuardrailAPIInputs format: - Changed from tuple (List[str], Optional[List[str]]) to dict {'texts': [...]} - Updated method call assertions to use 'inputs' parameter correctly All 12 guardrail tests now pass successfully. * fix: remove python3-dev from Dockerfile.build_from_pip to avoid Python version conflict The base image cgr.dev/chainguard/python:latest-dev already includes Python 3.14 and its development tools. Installing python3-dev pulls Python 3.13 packages which conflict with the existing Python 3.14 installation, causing file ownership errors during apk install. * fix: disable callbacks in vertex fine-tuning tests to prevent Datadog logging interference The test was failing because Datadog logging was making an HTTP POST request that was being caught by the mock, causing assert_called_once() to fail. By disabling callbacks during the test, we prevent Datadog from making any HTTP calls, allowing the mock to only see the Vertex AI API call. * fix: ensure test isolation in test_logging_non_streaming_request Add proper cleanup to restore original litellm.callbacks after test execution. This prevents test interference when running as part of a larger test suite, where global state pollution was causing async_log_success_event to be called multiple times instead of once. Fixes test failure where the test expected async_log_success_event to be called once but was being called twice due to callbacks from previous tests not being cleaned up. --- .../build_from_pip/Dockerfile.build_from_pip | 5 +- .../guardrail_hooks/bedrock_guardrails.py | 5 + tests/batches_tests/test_fine_tuning_api.py | 196 ++++++++++-------- .../test_apply_guardrail_endpoint.py | 21 +- .../test_bedrock_apply_guardrail.py | 4 +- .../test_litellm_logging.py | 53 +++-- 6 files changed, 158 insertions(+), 126 deletions(-) diff --git a/docker/build_from_pip/Dockerfile.build_from_pip b/docker/build_from_pip/Dockerfile.build_from_pip index aeb19bce21f..dda6e50cbb7 100644 --- a/docker/build_from_pip/Dockerfile.build_from_pip +++ b/docker/build_from_pip/Dockerfile.build_from_pip @@ -7,8 +7,11 @@ ENV HOME=/home/litellm ENV PATH="${HOME}/venv/bin:$PATH" # Install runtime dependencies +# Note: The base image has Python 3.14, but python3-dev installs Python 3.13 which conflicts. +# The -dev variant should include Python headers, but if compilation fails, we may need +# to install python-3.14-dev specifically (if available in the repo) RUN apk update && \ - apk add --no-cache gcc python3-dev openssl openssl-dev + apk add --no-cache gcc openssl openssl-dev RUN python -m venv ${HOME}/venv RUN ${HOME}/venv/bin/pip install --no-cache-dir --upgrade pip diff --git a/litellm/proxy/guardrails/guardrail_hooks/bedrock_guardrails.py b/litellm/proxy/guardrails/guardrail_hooks/bedrock_guardrails.py index e0fb3192401..9d0211e2a0b 100644 --- a/litellm/proxy/guardrails/guardrail_hooks/bedrock_guardrails.py +++ b/litellm/proxy/guardrails/guardrail_hooks/bedrock_guardrails.py @@ -1318,6 +1318,11 @@ class BedrockGuardrail(CustomGuardrail, BaseAWSLLM): masked_text = str(text_content) masked_texts.append(masked_text) + # If no output/outputs were provided, use the original texts + # This happens when the guardrail allows content without modification + if not masked_texts: + masked_texts = texts + verbose_proxy_logger.debug( "Bedrock Guardrail: Successfully applied guardrail" ) diff --git a/tests/batches_tests/test_fine_tuning_api.py b/tests/batches_tests/test_fine_tuning_api.py index 3561d99d0f6..de952cfe29c 100644 --- a/tests/batches_tests/test_fine_tuning_api.py +++ b/tests/batches_tests/test_fine_tuning_api.py @@ -208,48 +208,57 @@ async def test_create_vertex_fine_tune_jobs_mocked(): } ) - with patch( - "litellm.llms.custom_httpx.http_handler.AsyncHTTPHandler.post", - return_value=mock_response, - ) as mock_post: - create_fine_tuning_response = await litellm.acreate_fine_tuning_job( - model=base_model, - custom_llm_provider="vertex_ai", - training_file=training_file, - vertex_project=project_id, - vertex_location=location, - ) + # Save original callbacks to restore later + original_callbacks = litellm.callbacks + # Disable callbacks to avoid Datadog logging interfering with the mock + litellm.callbacks = [] + + try: + with patch( + "litellm.llms.custom_httpx.http_handler.AsyncHTTPHandler.post", + return_value=mock_response, + ) as mock_post: + create_fine_tuning_response = await litellm.acreate_fine_tuning_job( + model=base_model, + custom_llm_provider="vertex_ai", + training_file=training_file, + vertex_project=project_id, + vertex_location=location, + ) - # Verify the request - mock_post.assert_called_once() + # Verify the request + mock_post.assert_called_once() - # Validate the request - assert mock_post.call_args.kwargs["json"] == { - "baseModel": base_model, - "supervisedTuningSpec": {"training_dataset_uri": training_file}, - "tunedModelDisplayName": None, - } + # Validate the request + assert mock_post.call_args.kwargs["json"] == { + "baseModel": base_model, + "supervisedTuningSpec": {"training_dataset_uri": training_file}, + "tunedModelDisplayName": None, + } - # Verify the response - response_json = json.loads(create_fine_tuning_response.model_dump_json()) - assert ( - response_json["id"] - == f"projects/{project_id}/locations/{location}/tuningJobs/{job_id}" - ) - assert response_json["model"] == base_model - assert response_json["object"] == "fine_tuning.job" - assert response_json["fine_tuned_model"] == tuned_model_name - assert response_json["status"] == "queued" - assert response_json["training_file"] == training_file - assert ( - response_json["created_at"] == 1735684820 - ) # Unix timestamp for create_time - assert response_json["error"] is None - assert response_json["finished_at"] is None - assert response_json["validation_file"] is None - assert response_json["trained_tokens"] is None - assert response_json["estimated_finish"] is None - assert response_json["integrations"] == [] + # Verify the response + response_json = json.loads(create_fine_tuning_response.model_dump_json()) + assert ( + response_json["id"] + == f"projects/{project_id}/locations/{location}/tuningJobs/{job_id}" + ) + assert response_json["model"] == base_model + assert response_json["object"] == "fine_tuning.job" + assert response_json["fine_tuned_model"] == tuned_model_name + assert response_json["status"] == "queued" + assert response_json["training_file"] == training_file + assert ( + response_json["created_at"] == 1735684820 + ) # Unix timestamp for create_time + assert response_json["error"] is None + assert response_json["finished_at"] is None + assert response_json["validation_file"] is None + assert response_json["trained_tokens"] is None + assert response_json["estimated_finish"] is None + assert response_json["integrations"] == [] + finally: + # Restore original callbacks + litellm.callbacks = original_callbacks @pytest.mark.asyncio() @@ -280,60 +289,69 @@ async def test_create_vertex_fine_tune_jobs_mocked_with_hyperparameters(): } ) - with patch( - "litellm.llms.custom_httpx.http_handler.AsyncHTTPHandler.post", - return_value=mock_response, - ) as mock_post: - create_fine_tuning_response = await litellm.acreate_fine_tuning_job( - model=base_model, - custom_llm_provider="vertex_ai", - training_file=training_file, - vertex_project=project_id, - vertex_location=location, - hyperparameters={ - "n_epochs": 5, - "learning_rate_multiplier": 0.2, - "adapter_size": "SMALL", - }, - ) - - # Verify the request - mock_post.assert_called_once() - - # Validate the request - assert mock_post.call_args.kwargs["json"] == { - "baseModel": base_model, - "supervisedTuningSpec": { - "training_dataset_uri": training_file, - "hyperParameters": { - "epoch_count": 5, + # Save original callbacks to restore later + original_callbacks = litellm.callbacks + # Disable callbacks to avoid Datadog logging interfering with the mock + litellm.callbacks = [] + + try: + with patch( + "litellm.llms.custom_httpx.http_handler.AsyncHTTPHandler.post", + return_value=mock_response, + ) as mock_post: + create_fine_tuning_response = await litellm.acreate_fine_tuning_job( + model=base_model, + custom_llm_provider="vertex_ai", + training_file=training_file, + vertex_project=project_id, + vertex_location=location, + hyperparameters={ + "n_epochs": 5, "learning_rate_multiplier": 0.2, "adapter_size": "SMALL", }, - }, - "tunedModelDisplayName": None, - } + ) - # Verify the response - response_json = json.loads(create_fine_tuning_response.model_dump_json()) - assert ( - response_json["id"] - == f"projects/{project_id}/locations/{location}/tuningJobs/{job_id}" - ) - assert response_json["model"] == base_model - assert response_json["object"] == "fine_tuning.job" - assert response_json["fine_tuned_model"] == tuned_model_name - assert response_json["status"] == "queued" - assert response_json["training_file"] == training_file - assert ( - response_json["created_at"] == 1735684820 - ) # Unix timestamp for create_time - assert response_json["error"] is None - assert response_json["finished_at"] is None - assert response_json["validation_file"] is None - assert response_json["trained_tokens"] is None - assert response_json["estimated_finish"] is None - assert response_json["integrations"] == [] + # Verify the request + mock_post.assert_called_once() + + # Validate the request + assert mock_post.call_args.kwargs["json"] == { + "baseModel": base_model, + "supervisedTuningSpec": { + "training_dataset_uri": training_file, + "hyperParameters": { + "epoch_count": 5, + "learning_rate_multiplier": 0.2, + "adapter_size": "SMALL", + }, + }, + "tunedModelDisplayName": None, + } + + # Verify the response + response_json = json.loads(create_fine_tuning_response.model_dump_json()) + assert ( + response_json["id"] + == f"projects/{project_id}/locations/{location}/tuningJobs/{job_id}" + ) + assert response_json["model"] == base_model + assert response_json["object"] == "fine_tuning.job" + assert response_json["fine_tuned_model"] == tuned_model_name + assert response_json["status"] == "queued" + assert response_json["training_file"] == training_file + assert ( + response_json["created_at"] == 1735684820 + ) # Unix timestamp for create_time + assert response_json["error"] is None + assert response_json["finished_at"] is None + assert response_json["validation_file"] is None + assert response_json["trained_tokens"] is None + assert response_json["estimated_finish"] is None + assert response_json["integrations"] == [] + finally: + # Restore original callbacks + litellm.callbacks = original_callbacks # Testing OpenAI -> Vertex AI param mapping diff --git a/tests/enterprise/litellm_enterprise/proxy/guardrails/test_apply_guardrail_endpoint.py b/tests/enterprise/litellm_enterprise/proxy/guardrails/test_apply_guardrail_endpoint.py index 7ce99abdd15..0d27df50d15 100644 --- a/tests/enterprise/litellm_enterprise/proxy/guardrails/test_apply_guardrail_endpoint.py +++ b/tests/enterprise/litellm_enterprise/proxy/guardrails/test_apply_guardrail_endpoint.py @@ -28,9 +28,9 @@ async def test_apply_guardrail_endpoint_returns_correct_response(): ) as mock_registry: # Create a mock guardrail mock_guardrail = Mock(spec=CustomGuardrail) - # Apply guardrail now returns a tuple (List[str], Optional[List[str]]) + # Apply guardrail returns GenericGuardrailAPIInputs (dict with texts key) mock_guardrail.apply_guardrail = AsyncMock( - return_value=(["Redacted text: [REDACTED] and [REDACTED]"], None) + return_value={"texts": ["Redacted text: [REDACTED] and [REDACTED]"]} ) # Configure the registry to return our mock guardrail @@ -56,12 +56,11 @@ async def test_apply_guardrail_endpoint_returns_correct_response(): assert isinstance(response, ApplyGuardrailResponse) assert response.response_text == "Redacted text: [REDACTED] and [REDACTED]" - # Verify the guardrail was called with correct parameters (new signature) + # Verify the guardrail was called with correct parameters mock_guardrail.apply_guardrail.assert_called_once_with( - texts=["Test text with PII"], + inputs={"texts": ["Test text with PII"]}, request_data={}, input_type="request", - images=None, ) @@ -104,9 +103,9 @@ async def test_apply_guardrail_endpoint_with_presidio_guardrail(): ) as mock_registry: # Create a mock guardrail that simulates Presidio behavior mock_guardrail = Mock(spec=CustomGuardrail) - # Simulate masking PII entities - returns tuple (List[str], Optional[List[str]]) + # Simulate masking PII entities - returns GenericGuardrailAPIInputs (dict with texts key) mock_guardrail.apply_guardrail = AsyncMock( - return_value=(["My name is [PERSON] and my email is [EMAIL_ADDRESS]"], None) + return_value={"texts": ["My name is [PERSON] and my email is [EMAIL_ADDRESS]"]} ) # Configure the registry to return our mock guardrail @@ -149,9 +148,9 @@ async def test_apply_guardrail_endpoint_without_optional_params(): ) as mock_registry: # Create a mock guardrail mock_guardrail = Mock(spec=CustomGuardrail) - # Returns tuple (List[str], Optional[List[str]]) + # Returns GenericGuardrailAPIInputs (dict with texts key) mock_guardrail.apply_guardrail = AsyncMock( - return_value=(["Processed text"], None) + return_value={"texts": ["Processed text"]} ) # Configure the registry to return our mock guardrail @@ -174,7 +173,7 @@ async def test_apply_guardrail_endpoint_without_optional_params(): assert isinstance(response, ApplyGuardrailResponse) assert response.response_text == "Processed text" - # Verify the guardrail was called with new signature + # Verify the guardrail was called with correct parameters mock_guardrail.apply_guardrail.assert_called_once_with( - texts=["Test text"], request_data={}, input_type="request", images=None + inputs={"texts": ["Test text"]}, request_data={}, input_type="request" ) diff --git a/tests/enterprise/litellm_enterprise/proxy/guardrails/test_bedrock_apply_guardrail.py b/tests/enterprise/litellm_enterprise/proxy/guardrails/test_bedrock_apply_guardrail.py index 8d98f56cd3a..9a96919da87 100644 --- a/tests/enterprise/litellm_enterprise/proxy/guardrails/test_bedrock_apply_guardrail.py +++ b/tests/enterprise/litellm_enterprise/proxy/guardrails/test_bedrock_apply_guardrail.py @@ -34,7 +34,7 @@ async def test_bedrock_apply_guardrail_success(): # Mock a successful response from Bedrock mock_response = { "action": "ALLOWED", - "content": [{"text": {"text": "This is a test message with some content"}}], + "output": [{"text": "This is a test message with some content"}], } mock_api_request.return_value = mock_response @@ -219,7 +219,7 @@ async def test_bedrock_apply_guardrail_filters_request_messages_when_flag_enable with patch.object( guardrail, "make_bedrock_api_request", new_callable=AsyncMock ) as mock_api: - mock_api.return_value = {"action": "ALLOWED"} + mock_api.return_value = {"action": "ALLOWED", "output": [{"text": "latest question"}]} guardrailed_inputs = await guardrail.apply_guardrail( inputs={"texts": ["latest question"]}, diff --git a/tests/test_litellm/litellm_core_utils/test_litellm_logging.py b/tests/test_litellm/litellm_core_utils/test_litellm_logging.py index 8065304fd64..95f900b95dc 100644 --- a/tests/test_litellm/litellm_core_utils/test_litellm_logging.py +++ b/tests/test_litellm/litellm_core_utils/test_litellm_logging.py @@ -196,31 +196,38 @@ async def test_logging_non_streaming_request(): import litellm - mock_logging_obj = MockPrometheusLogger() + # Save original callbacks to restore after test + original_callbacks = getattr(litellm, "callbacks", []) - litellm.callbacks = [mock_logging_obj] + try: + mock_logging_obj = MockPrometheusLogger() - with patch.object( - mock_logging_obj, - "async_log_success_event", - ) as mock_async_log_success_event: - await litellm.acompletion( - max_tokens=100, - messages=[{"role": "user", "content": "Hey"}], - model="openai/codex-mini-latest", - mock_response="Hello, world!", - ) - await asyncio.sleep(1) - mock_async_log_success_event.assert_called_once() - assert mock_async_log_success_event.call_count == 1 - print( - "mock_async_log_success_event.call_args.kwargs", - mock_async_log_success_event.call_args.kwargs, - ) - standard_logging_object = mock_async_log_success_event.call_args.kwargs[ - "kwargs" - ]["standard_logging_object"] - assert standard_logging_object["stream"] is not True + litellm.callbacks = [mock_logging_obj] + + with patch.object( + mock_logging_obj, + "async_log_success_event", + ) as mock_async_log_success_event: + await litellm.acompletion( + max_tokens=100, + messages=[{"role": "user", "content": "Hey"}], + model="openai/codex-mini-latest", + mock_response="Hello, world!", + ) + await asyncio.sleep(1) + mock_async_log_success_event.assert_called_once() + assert mock_async_log_success_event.call_count == 1 + print( + "mock_async_log_success_event.call_args.kwargs", + mock_async_log_success_event.call_args.kwargs, + ) + standard_logging_object = mock_async_log_success_event.call_args.kwargs[ + "kwargs" + ]["standard_logging_object"] + assert standard_logging_object["stream"] is not True + finally: + # Restore original callbacks to ensure test isolation + litellm.callbacks = original_callbacks def test_get_user_agent_tags(): From 4d39a1a18fefebe140979f20e81f342a2ce96909 Mon Sep 17 00:00:00 2001 From: YutaSaito <36355491+uc4w6c@users.noreply.github.com> Date: Sat, 6 Dec 2025 07:59:36 +0900 Subject: [PATCH 083/178] Fix: MLflow streaming spans for Anthropic passthrough (#17288) * Fix: MLflow streaming spans for Anthropic passthrough * fix: Revert "Handle MLflow chunk events without delta" --- litellm/integrations/mlflow.py | 11 +++- .../test_litellm/integrations/test_mlflow.py | 61 +++++++++++++++++++ 2 files changed, 69 insertions(+), 3 deletions(-) diff --git a/litellm/integrations/mlflow.py b/litellm/integrations/mlflow.py index b348737868d..6378e55f7e1 100644 --- a/litellm/integrations/mlflow.py +++ b/litellm/integrations/mlflow.py @@ -129,8 +129,11 @@ class MlflowLogger(CustomLogger): self._add_chunk_events(span, response_obj) # If this is the final chunk, end the span. The final chunk - # has complete_streaming_response that gathers the full response. - if final_response := kwargs.get("complete_streaming_response"): + # has the assembled streaming response (key differs between sync/async paths). + final_response = kwargs.get("complete_streaming_response") or kwargs.get( + "async_complete_streaming_response" + ) + if final_response: end_time_ns = int(end_time.timestamp() * 1e9) self._extract_and_set_chat_attributes(span, kwargs, final_response) @@ -153,7 +156,9 @@ class MlflowLogger(CustomLogger): span.add_event( SpanEvent( name="streaming_chunk", - attributes={"delta": json.dumps(choice.delta.model_dump())}, + attributes={ + "delta": json.dumps(choice.delta.model_dump, default=str) + }, ) ) except Exception: diff --git a/tests/test_litellm/integrations/test_mlflow.py b/tests/test_litellm/integrations/test_mlflow.py index b8894701e8a..dba181def7e 100644 --- a/tests/test_litellm/integrations/test_mlflow.py +++ b/tests/test_litellm/integrations/test_mlflow.py @@ -1,6 +1,8 @@ import asyncio +import json import os import sys +from datetime import datetime from unittest.mock import MagicMock, patch # Adds the grandparent directory to sys.path to allow importing project modules @@ -125,3 +127,62 @@ def test_mlflow_token_usage_attribute_structure(): "output_tokens": 7, "total_tokens": 12, } + + +def _mock_mlflow_modules(): + mock_tracking = MagicMock() + mock_tracking.MlflowClient = MagicMock() + + class DummySpanEvent: + def __init__(self, name, attributes): + self.name = name + self.attributes = attributes + + mock_entities = MagicMock() + mock_entities.SpanStatusCode.OK = "OK" + mock_entities.SpanEvent = DummySpanEvent + + return { + "mlflow": MagicMock(), + "mlflow.tracking": mock_tracking, + "mlflow.entities": mock_entities, + "mlflow.tracing.utils": MagicMock(), + } + + +def test_mlflow_stream_handler_uses_async_complete_response(): + modules = _mock_mlflow_modules() + with patch.dict("sys.modules", modules): + from litellm.integrations.mlflow import MlflowLogger + + mlflow_logger = MlflowLogger() + mlflow_logger._start_span_or_trace = MagicMock(return_value="mock_span") + mlflow_logger._end_span_or_trace = MagicMock() + mlflow_logger._extract_and_set_chat_attributes = MagicMock() + + class DummyDelta: + def model_dump(self, exclude_none=True): + return {"content": "chunk"} + + response_obj = MagicMock() + response_obj.choices = [MagicMock(delta=DummyDelta())] + + final_response = MagicMock() + kwargs = { + "litellm_call_id": "abc123", + "async_complete_streaming_response": final_response, + } + + mlflow_logger._handle_stream_event( + kwargs=kwargs, + response_obj=response_obj, + start_time=datetime.utcnow(), + end_time=datetime.utcnow(), + ) + + mlflow_logger._end_span_or_trace.assert_called_once() + assert ( + mlflow_logger._end_span_or_trace.call_args.kwargs["outputs"] + is final_response + ) + assert "abc123" not in mlflow_logger._stream_id_to_span From a78f40f75ab59eb6f66764afdbe46e2a0fe189ff Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Fri, 5 Dec 2025 15:25:45 -0800 Subject: [PATCH 084/178] [Fixes] Dynamic Rate Limiter - Dynamic rate limiting token count increases/decreases by 1 instead of actual count + Redis TTL (#17558) * fix async_log_success_event for _PROXY_DynamicRateLimitHandlerV3 * test_async_log_success_event_increments_by_actual_tokens * fix redis TTL * Potential fix for code scanning alert no. 3873: Clear-text logging of sensitive information Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- .../proxy/hooks/dynamic_rate_limiter_v3.py | 118 +++++++++++ .../hooks/parallel_request_limiter_v3.py | 6 + litellm/proxy/proxy_config.yaml | 65 +------ .../hooks/test_dynamic_rate_limiter_v3.py | 184 ++++++++++++++++++ 4 files changed, 315 insertions(+), 58 deletions(-) diff --git a/litellm/proxy/hooks/dynamic_rate_limiter_v3.py b/litellm/proxy/hooks/dynamic_rate_limiter_v3.py index 7e6ec1dc151..d091e348020 100644 --- a/litellm/proxy/hooks/dynamic_rate_limiter_v3.py +++ b/litellm/proxy/hooks/dynamic_rate_limiter_v3.py @@ -614,3 +614,121 @@ class _PROXY_DynamicRateLimitHandlerV3(CustomLogger): f"Error in dynamic rate limiter v3 post-call hook: {str(e)}" ) return response + + async def async_log_success_event(self, kwargs, response_obj, start_time, end_time): + """ + Update token usage for priority-based rate limiting after successful API calls. + + Increments token counters for: + - model_saturation_check: Model-wide token tracking + - priority_model: Priority-specific token tracking + """ + from litellm.litellm_core_utils.core_helpers import ( + _get_parent_otel_span_from_kwargs, + ) + from litellm.proxy.common_utils.callback_utils import ( + get_model_group_from_litellm_kwargs, + ) + from litellm.types.caching import RedisPipelineIncrementOperation + from litellm.types.utils import Usage + + try: + verbose_proxy_logger.debug( + "INSIDE dynamic rate limiter ASYNC SUCCESS LOGGING" + ) + + litellm_parent_otel_span = _get_parent_otel_span_from_kwargs(kwargs) + + # Get metadata from standard_logging_object + standard_logging_object = kwargs.get("standard_logging_object") or {} + standard_logging_metadata = standard_logging_object.get("metadata") or {} + + # Get model and priority + model_group = get_model_group_from_litellm_kwargs(kwargs) + if not model_group: + return + + # Get priority from user_api_key_auth_metadata in standard_logging_metadata + # This is where user_api_key_dict.metadata is stored during pre-call + user_api_key_auth_metadata = standard_logging_metadata.get("user_api_key_auth_metadata") or {} + key_priority: Optional[str] = user_api_key_auth_metadata.get("priority") + + # Get total tokens from response + total_tokens = 0 + rate_limit_type = self.v3_limiter.get_rate_limit_type() + + if isinstance(response_obj, ModelResponse): + _usage = getattr(response_obj, "usage", None) + if _usage and isinstance(_usage, Usage): + if rate_limit_type == "output": + total_tokens = _usage.completion_tokens + elif rate_limit_type == "input": + total_tokens = _usage.prompt_tokens + elif rate_limit_type == "total": + total_tokens = _usage.total_tokens + + if total_tokens == 0: + return + + # Create pipeline operations for token increments + pipeline_operations: List[RedisPipelineIncrementOperation] = [] + + # Model-wide token tracking (model_saturation_check) + model_token_key = self.v3_limiter.create_rate_limit_keys( + key="model_saturation_check", + value=model_group, + rate_limit_type="tokens", + ) + pipeline_operations.append( + RedisPipelineIncrementOperation( + key=model_token_key, + increment_value=total_tokens, + ttl=self.v3_limiter.window_size, + ) + ) + + # Priority-specific token tracking (priority_model) + # Determine priority key (same logic as _get_priority_allocation) + has_explicit_priority = ( + key_priority is not None + and litellm.priority_reservation is not None + and key_priority in litellm.priority_reservation + ) + + if has_explicit_priority and key_priority is not None: + priority_key = f"{model_group}:{key_priority}" + else: + priority_key = f"{model_group}:default_pool" + + priority_token_key = self.v3_limiter.create_rate_limit_keys( + key="priority_model", + value=priority_key, + rate_limit_type="tokens", + ) + pipeline_operations.append( + RedisPipelineIncrementOperation( + key=priority_token_key, + increment_value=total_tokens, + ttl=self.v3_limiter.window_size, + ) + ) + + # Execute token increments with TTL preservation + if pipeline_operations: + await self.v3_limiter.async_increment_tokens_with_ttl_preservation( + pipeline_operations=pipeline_operations, + parent_otel_span=litellm_parent_otel_span, + ) + + # Only log 'priority' if it's known safe; otherwise, redact. + SAFE_PRIORITIES = {"low", "medium", "high", "default"} + logged_priority = key_priority if key_priority in SAFE_PRIORITIES else "REDACTED" + verbose_proxy_logger.debug( + f"[Dynamic Rate Limiter] Incremented tokens by {total_tokens} for " + f"model={model_group}, priority={logged_priority}" + ) + + except Exception as e: + verbose_proxy_logger.exception( + f"Error in dynamic rate limiter success event: {str(e)}" + ) diff --git a/litellm/proxy/hooks/parallel_request_limiter_v3.py b/litellm/proxy/hooks/parallel_request_limiter_v3.py index c462493de6c..6ef281e5dcd 100644 --- a/litellm/proxy/hooks/parallel_request_limiter_v3.py +++ b/litellm/proxy/hooks/parallel_request_limiter_v3.py @@ -65,6 +65,12 @@ for i = 1, #KEYS, 2 do table.insert(results, increment_value) -- counter else local counter = redis.call('INCR', counter_key) + -- This happens when window_key exists but counter_key doesn't (e.g., tokens key + -- created after requests key when both share the same window_key) + local current_ttl = redis.call('TTL', counter_key) + if current_ttl == -1 then + redis.call('EXPIRE', counter_key, window_size) + end table.insert(results, window_start) -- window_start table.insert(results, counter) -- counter end diff --git a/litellm/proxy/proxy_config.yaml b/litellm/proxy/proxy_config.yaml index 098cdb80e04..a33f56b0327 100644 --- a/litellm/proxy/proxy_config.yaml +++ b/litellm/proxy/proxy_config.yaml @@ -1,67 +1,16 @@ model_list: - - model_name: qwen-25vl-72b + - model_name: openai/gpt-4o-mini litellm_params: - model: bedrock/openai/arn:aws:bedrock:us-east-1:046319184608:imported-model/0m2lasirsp6z + model: openai/gpt-4o-mini + tpm: 1000 -guardrails: - - guardrail_name: "bedrock-pre-guard" - litellm_params: - guardrail: bedrock - mode: "pre_call" - guardrailIdentifier: ff6ujrregl1q - guardrailVersion: "DRAFT" - - -# like MCPs/vector stores -search_tools: - - search_tool_name: litellm-search - litellm_params: - search_provider: perplexity - api_key: os.environ/PERPLEXITYAI_API_KEY - - search_tool_name: firecrawl-search - litellm_params: - search_provider: firecrawl - api_key: os.environ/FIRECRAWL_API_KEY - litellm_settings: - max_end_user_budget_id: "2f6634cd-c631-4d3b-96c7-ad510ea06eaf" - # Comprehensive logging settings - store_audit_logs: true - verbose: true - log_level: "DEBUG" # Options: DEBUG, INFO, WARNING, ERROR - callbacks: ["s3_v2", "smtp_email"] - s3_callback_params: - s3_endpoint_url: "https://localhost:443" # Replace with your Minio server URL and port - s3_aws_access_key_id: "minioadmin" - s3_aws_secret_access_key: "minioadmin" - s3_region_name: "minio" # This can be any value for Minio - s3_bucket_name: "litellm-test" # Replace with your bucket name - s3_use_ssl: False - s3_verify: False - cache: True - cache_params: - type: local - drop_params: True + callbacks: ["dynamic_rate_limiter_v3"] + priority_reservation: + "prod": 0.9 # 90% reserved for production + "dev": 0.1 # 10% reserved for development -general_settings: - store_prompts_in_spend_logs: True - pass_through_endpoints: - - path: "/special/rerank" - target: "https://api.cohere.com/v1/rerank" - headers: - Authorization: "Bearer os.environ/COHERE_API_KEY" - guardrails: - bedrock-pre-guard: - request_fields: ["documents[*].text"] -vector_store_registry: - - vector_store_name: "bedrock-litellm-website-knowledgebase" - litellm_params: - vector_store_id: "T37J8R4WTM" - custom_llm_provider: "bedrock" - vector_store_description: "Bedrock vector store for the Litellm website knowledgebase" - vector_store_metadata: - source: "https://www.litellm.com/docs" diff --git a/tests/test_litellm/proxy/hooks/test_dynamic_rate_limiter_v3.py b/tests/test_litellm/proxy/hooks/test_dynamic_rate_limiter_v3.py index 1f76013e237..d9e10e6f4b8 100644 --- a/tests/test_litellm/proxy/hooks/test_dynamic_rate_limiter_v3.py +++ b/tests/test_litellm/proxy/hooks/test_dynamic_rate_limiter_v3.py @@ -1323,3 +1323,187 @@ async def test_default_priority_shared_pool(): print(f" - 3 keys without priority share ONE pool: {desc_a[0]['value']}") print(f" - Shared pool limit: {desc_a[0]['rate_limit']['requests_per_unit']} RPM") print(f" - Explicit priority 'prod' uses separate pool: {desc_prod[0]['value']}") + + +@pytest.mark.asyncio +async def test_async_log_success_event_increments_by_actual_tokens(): + """ + Test that async_log_success_event increments token counters by actual token usage. + + This validates the fix for Bug 1: Token count was incrementing by 1 instead of actual usage. + The async_log_success_event should increment both model_saturation_check and priority_model + counters by the actual completion_tokens (when rate_limit_type=output). + """ + from unittest.mock import MagicMock + + from litellm.types.utils import ModelResponse, Usage + + os.environ["LITELLM_LICENSE"] = "test-license-key" + litellm.priority_reservation = {"dev": 0.1, "prod": 0.9} + + dual_cache = DualCache() + handler = DynamicRateLimitHandler(internal_usage_cache=dual_cache) + + model = "test-token-increment" + llm_router = Router( + model_list=[ + { + "model_name": model, + "litellm_params": { + "model": "gpt-3.5-turbo", + "api_key": "test-key", + "api_base": "test-base", + "tpm": 1000, + }, + } + ] + ) + handler.update_variables(llm_router=llm_router) + + # Track what gets incremented + increment_calls = [] + + async def mock_increment(pipeline_operations, parent_otel_span=None): + for op in pipeline_operations: + increment_calls.append({ + "key": op["key"], + "increment_value": op["increment_value"], + }) + + handler.v3_limiter.async_increment_tokens_with_ttl_preservation = mock_increment + + # Create mock response with 50 completion tokens + mock_response = MagicMock(spec=ModelResponse) + mock_response.usage = MagicMock(spec=Usage) + mock_response.usage.prompt_tokens = 10 + mock_response.usage.completion_tokens = 50 + mock_response.usage.total_tokens = 60 + + # Create kwargs with priority in user_api_key_auth_metadata + kwargs = { + "standard_logging_object": { + "metadata": { + "user_api_key_auth_metadata": {"priority": "dev"}, + }, + "model_group": model, + }, + "litellm_params": { + "metadata": {"model_group": model}, + }, + } + + with patch( + "litellm.proxy.common_utils.callback_utils.get_model_group_from_litellm_kwargs", + return_value=model, + ): + await handler.async_log_success_event( + kwargs=kwargs, + response_obj=mock_response, + start_time=None, + end_time=None, + ) + + # Verify increments happened with actual token count (50 completion tokens) + assert len(increment_calls) == 2, f"Expected 2 increment calls, got {len(increment_calls)}" + + # Both should increment by 50 (completion_tokens, since rate_limit_type defaults to 'output') + for call in increment_calls: + assert call["increment_value"] == 50, ( + f"Expected increment of 50 tokens, got {call['increment_value']} for key {call['key']}" + ) + + # Verify correct keys were used + keys = [call["key"] for call in increment_calls] + assert any("model_saturation_check" in k for k in keys), "Should increment model_saturation_check" + assert any("priority_model" in k and "dev" in k for k in keys), "Should increment priority_model with 'dev' priority" + + +@pytest.mark.asyncio +async def test_async_log_success_event_uses_team_priority_from_auth_metadata(): + """ + Test that async_log_success_event correctly retrieves priority from user_api_key_auth_metadata. + + This validates the fix where priority is retrieved from standard_logging_metadata.user_api_key_auth_metadata + instead of just standard_logging_metadata.priority. This is important for team-based priority inheritance. + """ + from unittest.mock import MagicMock + + from litellm.types.utils import ModelResponse, Usage + + os.environ["LITELLM_LICENSE"] = "test-license-key" + litellm.priority_reservation = {"team_priority": 0.8, "default": 0.2} + + dual_cache = DualCache() + handler = DynamicRateLimitHandler(internal_usage_cache=dual_cache) + + model = "test-team-priority" + llm_router = Router( + model_list=[ + { + "model_name": model, + "litellm_params": { + "model": "gpt-3.5-turbo", + "api_key": "test-key", + "api_base": "test-base", + "tpm": 1000, + }, + } + ] + ) + handler.update_variables(llm_router=llm_router) + + # Track incremented keys to verify priority is used correctly + incremented_keys = [] + + async def mock_increment(pipeline_operations, parent_otel_span=None): + for op in pipeline_operations: + incremented_keys.append(op["key"]) + + handler.v3_limiter.async_increment_tokens_with_ttl_preservation = mock_increment + + # Create mock response + mock_response = MagicMock(spec=ModelResponse) + mock_response.usage = MagicMock(spec=Usage) + mock_response.usage.prompt_tokens = 10 + mock_response.usage.completion_tokens = 20 + mock_response.usage.total_tokens = 30 + + # Simulate team metadata inheritance: priority is in user_api_key_auth_metadata + # This is how the proxy passes team metadata to the callback + kwargs = { + "standard_logging_object": { + "metadata": { + # Priority NOT at top level (this would fail before the fix) + # Priority IS in user_api_key_auth_metadata (team inheritance) + "user_api_key_auth_metadata": {"priority": "team_priority"}, + }, + "model_group": model, + }, + "litellm_params": { + "metadata": {"model_group": model}, + }, + } + + with patch( + "litellm.proxy.common_utils.callback_utils.get_model_group_from_litellm_kwargs", + return_value=model, + ): + await handler.async_log_success_event( + kwargs=kwargs, + response_obj=mock_response, + start_time=None, + end_time=None, + ) + + # Verify the priority_model key uses 'team_priority' (not 'default_pool') + priority_keys = [k for k in incremented_keys if "priority_model" in k] + assert len(priority_keys) == 1, f"Expected 1 priority_model key, got {len(priority_keys)}" + + # The key should contain 'team_priority', not 'default_pool' + assert "team_priority" in priority_keys[0], ( + f"Expected priority key to use 'team_priority' from user_api_key_auth_metadata, " + f"got key: {priority_keys[0]}" + ) + assert "default_pool" not in priority_keys[0], ( + f"Priority key should NOT use 'default_pool', should use team's priority. Got: {priority_keys[0]}" + ) From 769f3cc310a71be0b19f8b9c5aeb611578ee52f9 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Fri, 5 Dec 2025 15:26:00 -0800 Subject: [PATCH 085/178] [Bug fix] Secret Managers Integration - Make email and secret manager operations independent in key management hooks (#17551) * TestKeyManagementEventHooksIndependentOperations * KeyManagementEventHooks - make ops independant --- .../proxy/hooks/key_management_event_hooks.py | 216 ++++++++++++------ .../hooks/test_key_management_event_hooks.py | 130 +++++++++++ 2 files changed, 276 insertions(+), 70 deletions(-) create mode 100644 tests/test_litellm/proxy/hooks/test_key_management_event_hooks.py diff --git a/litellm/proxy/hooks/key_management_event_hooks.py b/litellm/proxy/hooks/key_management_event_hooks.py index 44be6bbe656..5cfc85ae7aa 100644 --- a/litellm/proxy/hooks/key_management_event_hooks.py +++ b/litellm/proxy/hooks/key_management_event_hooks.py @@ -45,9 +45,13 @@ class KeyManagementEventHooks: ) from litellm.proxy.proxy_server import litellm_proxy_admin_name - await KeyManagementEventHooks._send_key_created_email( - response.model_dump(exclude_none=True) - ) + # Send email notification - non-blocking, independent operation + try: + await KeyManagementEventHooks._send_key_created_email( + response.model_dump(exclude_none=True) + ) + except Exception as e: + verbose_proxy_logger.warning(f"Failed to send key created email: {e}") # Enterprise Feature - Audit Logging. Enable with litellm.store_audit_logs = True if litellm.store_audit_logs is True: @@ -69,11 +73,17 @@ class KeyManagementEventHooks: ) ) ) - # store the generated key in the secret manager - await KeyManagementEventHooks._store_virtual_key_in_secret_manager( - secret_name=data.key_alias or f"virtual-key-{response.token_id}", - secret_token=response.key, - ) + + # Store the generated key in the secret manager - non-blocking, independent operation + try: + await KeyManagementEventHooks._store_virtual_key_in_secret_manager( + secret_name=data.key_alias or f"virtual-key-{response.token_id}", + secret_token=response.key, + ) + except Exception as e: + verbose_proxy_logger.warning( + f"Failed to store virtual key in secret manager: {e}" + ) @staticmethod async def async_key_updated_hook( @@ -132,22 +142,31 @@ class KeyManagementEventHooks: ) from litellm.proxy.proxy_server import litellm_proxy_admin_name - # store the generated key in the secret manager + # Store the generated key in the secret manager - non-blocking, independent operation if data is not None and response.token_id is not None: - initial_secret_name = ( - existing_key_row.key_alias or f"virtual-key-{existing_key_row.token}" - ) - await KeyManagementEventHooks._rotate_virtual_key_in_secret_manager( - current_secret_name=initial_secret_name, - new_secret_name=data.key_alias or f"virtual-key-{response.token_id}", - new_secret_value=response.key, - ) + try: + initial_secret_name = ( + existing_key_row.key_alias + or f"virtual-key-{existing_key_row.token}" + ) + await KeyManagementEventHooks._rotate_virtual_key_in_secret_manager( + current_secret_name=initial_secret_name, + new_secret_name=data.key_alias or f"virtual-key-{response.token_id}", + new_secret_value=response.key, + ) + except Exception as e: + verbose_proxy_logger.warning( + f"Failed to rotate virtual key in secret manager: {e}" + ) - # send key rotated email if configured - await KeyManagementEventHooks._send_key_rotated_email( - response=response.model_dump(exclude_none=True), - existing_key_alias=existing_key_row.key_alias, - ) + # Send key rotated email if configured - non-blocking, independent operation + try: + await KeyManagementEventHooks._send_key_rotated_email( + response=response.model_dump(exclude_none=True), + existing_key_alias=existing_key_row.key_alias, + ) + except Exception as e: + verbose_proxy_logger.warning(f"Failed to send key rotated email: {e}") # store the audit log if litellm.store_audit_logs is True and existing_key_row.token is not None: @@ -324,66 +343,109 @@ class KeyManagementEventHooks: ) @staticmethod - async def _send_key_created_email(response: dict): + def _is_email_sending_enabled() -> bool: + """ + Check if email sending is enabled via v2 enterprise loggers or v0 alerting config. + + Returns True only if email is actually configured, preventing any email + processing when the user has not opted in. + """ + # Check v2 enterprise email loggers try: from litellm_enterprise.enterprise_callbacks.send_emails.base_email import ( BaseEmailLogger, ) - except ImportError: - raise Exception( - "Trying to use Email Hooks" - + CommonProxyErrors.missing_enterprise_package.value + + initialized_email_loggers = ( + litellm.logging_callback_manager.get_custom_loggers_for_type( + callback_type=BaseEmailLogger + ) ) + if len(initialized_email_loggers) > 0: + return True + except ImportError: + pass + + # Check v0 alerting config + from litellm.proxy.proxy_server import general_settings + + if "email" in general_settings.get("alerting", []): + return True + + return False + + @staticmethod + async def _send_key_created_email(response: dict): + """ + Send key created email if email sending is enabled. + + This method is non-blocking - it will return silently if email is not + configured, and will log warnings instead of raising exceptions on failure. + """ + # Early exit if email is not enabled + if not KeyManagementEventHooks._is_email_sending_enabled(): + verbose_proxy_logger.debug( + "Email sending not enabled, skipping key created email" + ) + return from litellm.proxy.proxy_server import general_settings, proxy_logging_obj + ########################## + # v2 integration for emails (enterprise) + ########################## try: + from litellm_enterprise.enterprise_callbacks.send_emails.base_email import ( + BaseEmailLogger, + ) from litellm_enterprise.types.enterprise_callbacks.send_emails import ( SendKeyCreatedEmailEvent, ) + + initialized_email_loggers = ( + litellm.logging_callback_manager.get_custom_loggers_for_type( + callback_type=BaseEmailLogger + ) + ) + if len(initialized_email_loggers) > 0: + event = SendKeyCreatedEmailEvent( + virtual_key=response.get("key", ""), + event="key_created", + event_group=Litellm_EntityType.KEY, + event_message="API Key Created", + token=response.get("token", ""), + spend=response.get("spend", 0.0), + max_budget=response.get("max_budget", 0.0), + user_id=response.get("user_id", None), + team_id=response.get("team_id", "Default Team"), + key_alias=response.get("key_alias", None), + ) + for email_logger in initialized_email_loggers: + if isinstance(email_logger, BaseEmailLogger): + await email_logger.send_key_created_email( + send_key_created_email_event=event, + ) + return except ImportError: - raise Exception( - "Trying to use Email Hooks" - + CommonProxyErrors.missing_enterprise_package.value - ) - - event = SendKeyCreatedEmailEvent( - virtual_key=response.get("key", ""), - event="key_created", - event_group=Litellm_EntityType.KEY, - event_message="API Key Created", - token=response.get("token", ""), - spend=response.get("spend", 0.0), - max_budget=response.get("max_budget", 0.0), - user_id=response.get("user_id", None), - team_id=response.get("team_id", "Default Team"), - key_alias=response.get("key_alias", None), - ) - - ########################## - # v2 integration for emails - ########################## - initialized_email_loggers = ( - litellm.logging_callback_manager.get_custom_loggers_for_type( - callback_type=BaseEmailLogger - ) - ) - if len(initialized_email_loggers) > 0: - for email_logger in initialized_email_loggers: - if isinstance(email_logger, BaseEmailLogger): - await email_logger.send_key_created_email( - send_key_created_email_event=event, - ) + pass ########################## # v0 integration for emails ########################## - else: - if "email" not in general_settings.get("alerting", []): - raise ValueError( - "Email alerting not setup on config.yaml. Please set `alerting=['email']. \nDocs: https://docs.litellm.ai/docs/proxy/email`" - ) + if "email" in general_settings.get("alerting", []): + from litellm.proxy._types import WebhookEvent + event = WebhookEvent( + event="key_created", + event_group=Litellm_EntityType.KEY, + event_message="API Key Created", + token=response.get("token", ""), + spend=response.get("spend", 0.0), + max_budget=response.get("max_budget", 0.0), + user_id=response.get("user_id", None), + team_id=response.get("team_id", "Default Team"), + key_alias=response.get("key_alias", None), + ) # If user configured email alerting - send an Email letting their end-user know the key was created asyncio.create_task( proxy_logging_obj.slack_alerting_instance.send_key_created_or_user_invited_email( @@ -393,25 +455,39 @@ class KeyManagementEventHooks: @staticmethod async def _send_key_rotated_email(response: dict, existing_key_alias: Optional[str]): + """ + Send key rotated email if email sending is enabled. + + This method is non-blocking - it will return silently if email is not + configured, and will log warnings instead of raising exceptions on failure. + """ + # Early exit if email is not enabled + if not KeyManagementEventHooks._is_email_sending_enabled(): + verbose_proxy_logger.debug( + "Email sending not enabled, skipping key rotated email" + ) + return + try: from litellm_enterprise.enterprise_callbacks.send_emails.base_email import ( BaseEmailLogger, ) except ImportError: - raise Exception( - "Trying to use Email Hooks" - + CommonProxyErrors.missing_enterprise_package.value + # Enterprise package not installed - v0 doesn't support key rotated email + verbose_proxy_logger.debug( + "Enterprise package not installed, skipping key rotated email" ) + return try: from litellm_enterprise.types.enterprise_callbacks.send_emails import ( SendKeyRotatedEmailEvent, ) except ImportError: - raise Exception( - "Trying to use Email Hooks" - + CommonProxyErrors.missing_enterprise_package.value + verbose_proxy_logger.debug( + "Enterprise types not available, skipping key rotated email" ) + return event = SendKeyRotatedEmailEvent( virtual_key=response.get("key", ""), diff --git a/tests/test_litellm/proxy/hooks/test_key_management_event_hooks.py b/tests/test_litellm/proxy/hooks/test_key_management_event_hooks.py new file mode 100644 index 00000000000..f731d9e298a --- /dev/null +++ b/tests/test_litellm/proxy/hooks/test_key_management_event_hooks.py @@ -0,0 +1,130 @@ +""" +Tests for KeyManagementEventHooks. + +Validates that email and secret manager operations are independent and non-blocking. +""" + +import os +import sys +from unittest.mock import AsyncMock, MagicMock, patch + +import pytest + +sys.path.insert(0, os.path.abspath("../../../..")) + +from litellm.proxy.hooks.key_management_event_hooks import KeyManagementEventHooks + + +class TestKeyManagementEventHooksIndependentOperations: + """Tests that email and secret manager operations are independent.""" + + @pytest.mark.asyncio + async def test_email_failure_does_not_block_secret_manager(self): + """ + Test that if email sending fails, secret manager operation still runs. + + This validates the independent operation design where one failure + does not block the other operation. + """ + secret_manager_called = {"called": False} + + # Mock the email method to raise an exception + async def mock_send_email_raises(*args, **kwargs): + raise Exception("Email service unavailable") + + # Mock the secret manager method to track if it was called + async def mock_store_secret(*args, **kwargs): + secret_manager_called["called"] = True + + # Create mock objects for the hook parameters + mock_data = MagicMock() + mock_data.key_alias = "test-key-alias" + + mock_response = MagicMock() + mock_response.model_dump.return_value = {"key": "sk-test", "token": "test-token"} + mock_response.model_dump_json.return_value = '{"key": "sk-test"}' + mock_response.token_id = "token-123" + mock_response.key = "sk-test-key" + + mock_user_api_key_dict = MagicMock() + mock_user_api_key_dict.user_id = "user-123" + mock_user_api_key_dict.api_key = "api-key-123" + + with patch.object( + KeyManagementEventHooks, + "_send_key_created_email", + side_effect=mock_send_email_raises, + ), patch.object( + KeyManagementEventHooks, + "_store_virtual_key_in_secret_manager", + side_effect=mock_store_secret, + ), patch( + "litellm.store_audit_logs", False + ), patch( + "litellm.proxy.hooks.key_management_event_hooks.verbose_proxy_logger" + ): + # Should not raise even though email fails + await KeyManagementEventHooks.async_key_generated_hook( + data=mock_data, + response=mock_response, + user_api_key_dict=mock_user_api_key_dict, + ) + + # Secret manager should have been called despite email failure + assert secret_manager_called["called"] is True + + @pytest.mark.asyncio + async def test_secret_manager_failure_does_not_block_email(self): + """ + Test that if secret manager fails, email operation still runs. + + This validates the independent operation design where one failure + does not block the other operation. + """ + email_called = {"called": False} + + # Mock the email method to track if it was called + async def mock_send_email(*args, **kwargs): + email_called["called"] = True + + # Mock the secret manager method to raise an exception + async def mock_store_secret_raises(*args, **kwargs): + raise Exception("Secret manager unavailable") + + # Create mock objects for the hook parameters + mock_data = MagicMock() + mock_data.key_alias = "test-key-alias" + + mock_response = MagicMock() + mock_response.model_dump.return_value = {"key": "sk-test", "token": "test-token"} + mock_response.model_dump_json.return_value = '{"key": "sk-test"}' + mock_response.token_id = "token-123" + mock_response.key = "sk-test-key" + + mock_user_api_key_dict = MagicMock() + mock_user_api_key_dict.user_id = "user-123" + mock_user_api_key_dict.api_key = "api-key-123" + + with patch.object( + KeyManagementEventHooks, + "_send_key_created_email", + side_effect=mock_send_email, + ), patch.object( + KeyManagementEventHooks, + "_store_virtual_key_in_secret_manager", + side_effect=mock_store_secret_raises, + ), patch( + "litellm.store_audit_logs", False + ), patch( + "litellm.proxy.hooks.key_management_event_hooks.verbose_proxy_logger" + ): + # Should not raise even though secret manager fails + await KeyManagementEventHooks.async_key_generated_hook( + data=mock_data, + response=mock_response, + user_api_key_dict=mock_user_api_key_dict, + ) + + # Email should have been called despite secret manager failure + assert email_called["called"] is True + From 7259de2f12360ef8040b95474368dd67f49d3855 Mon Sep 17 00:00:00 2001 From: Cesar Garcia <128240629+Chesars@users.noreply.github.com> Date: Fri, 5 Dec 2025 20:26:20 -0300 Subject: [PATCH 086/178] feat: add Mistral Large 3 model support (#17547) Add Mistral Large 3 (675B MoE) to model catalog for both providers: - mistral/mistral-large-3 - azure_ai/mistral-large-3 Specs: - 256k context window - $0.50/1M input, $1.50/1M output - Supports vision (multimodal) - Supports function calling Closes #17527 --- model_prices_and_context_window.json | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json index 634ea6dc48a..d4afde20e93 100644 --- a/model_prices_and_context_window.json +++ b/model_prices_and_context_window.json @@ -5164,6 +5164,19 @@ "supports_function_calling": true, "supports_tool_choice": true }, + "azure_ai/mistral-large-3": { + "input_cost_per_token": 5e-07, + "litellm_provider": "azure_ai", + "max_input_tokens": 256000, + "max_output_tokens": 8191, + "max_tokens": 8191, + "mode": "chat", + "output_cost_per_token": 1.5e-06, + "source": "https://azure.microsoft.com/en-us/blog/introducing-mistral-large-3-in-microsoft-foundry-open-capable-and-ready-for-production-workloads/", + "supports_function_calling": true, + "supports_tool_choice": true, + "supports_vision": true + }, "azure_ai/mistral-medium-2505": { "input_cost_per_token": 4e-07, "litellm_provider": "azure_ai", @@ -18745,6 +18758,21 @@ "supports_response_schema": true, "supports_tool_choice": true }, + "mistral/mistral-large-3": { + "input_cost_per_token": 5e-07, + "litellm_provider": "mistral", + "max_input_tokens": 256000, + "max_output_tokens": 8191, + "max_tokens": 8191, + "mode": "chat", + "output_cost_per_token": 1.5e-06, + "source": "https://docs.mistral.ai/models/mistral-large-3-25-12", + "supports_assistant_prefill": true, + "supports_function_calling": true, + "supports_response_schema": true, + "supports_tool_choice": true, + "supports_vision": true + }, "mistral/mistral-medium": { "input_cost_per_token": 2.7e-06, "litellm_provider": "mistral", From 6ff7ed14f693d1360546891ede68b519eea003fc Mon Sep 17 00:00:00 2001 From: Devaj Mody Date: Fri, 5 Dec 2025 18:30:59 -0500 Subject: [PATCH 087/178] fix(team): use organization.members instead of deprecated organization.users (#17557) Fixes #17552 - Change Prisma include from 'users' to 'members' - Use LiteLLM_OrganizationTableWithMembers type for membership validation - Access organization.members instead of organization.users - Add tests for membership validation --- .../management_endpoints/team_endpoints.py | 9 +- .../test_team_endpoints.py | 114 +++++++++++++++++- 2 files changed, 117 insertions(+), 6 deletions(-) diff --git a/litellm/proxy/management_endpoints/team_endpoints.py b/litellm/proxy/management_endpoints/team_endpoints.py index 4b62e490a82..9009ce8995b 100644 --- a/litellm/proxy/management_endpoints/team_endpoints.py +++ b/litellm/proxy/management_endpoints/team_endpoints.py @@ -31,6 +31,7 @@ from litellm.proxy._types import ( LiteLLM_ManagementEndpoint_MetadataFields_Premium, LiteLLM_ModelTable, LiteLLM_OrganizationTable, + LiteLLM_OrganizationTableWithMembers, LiteLLM_TeamMembership, LiteLLM_TeamTable, LiteLLM_TeamTableCachedObj, @@ -1051,7 +1052,7 @@ async def fetch_and_validate_organization( organization_row = await prisma_client.db.litellm_organizationtable.find_unique( where={"organization_id": organization_id}, - include={"litellm_budget_table": True, "users": True}, + include={"litellm_budget_table": True, "members": True}, ) if organization_row is None: @@ -1064,7 +1065,7 @@ async def fetch_and_validate_organization( validate_team_org_change( team=LiteLLM_TeamTable(**existing_team_row.model_dump()), - organization=LiteLLM_OrganizationTable(**organization_row.model_dump()), + organization=LiteLLM_OrganizationTableWithMembers(**organization_row.model_dump()), llm_router=llm_router, ) @@ -1072,7 +1073,7 @@ async def fetch_and_validate_organization( def validate_team_org_change( - team: LiteLLM_TeamTable, organization: LiteLLM_OrganizationTable, llm_router: Router + team: LiteLLM_TeamTable, organization: LiteLLM_OrganizationTableWithMembers, llm_router: Router ) -> bool: """ Validate that a team can be moved to an organization. @@ -1123,7 +1124,7 @@ def validate_team_org_change( # Check if the team's user_id is a member of the org team_members = [m.user_id for m in team.members_with_roles] - org_members = [m.user_id for m in organization.users] if organization.users else [] + org_members = [m.user_id for m in organization.members] if organization.members else [] not_in_org = [ m for m in team_members diff --git a/tests/test_litellm/proxy/management_endpoints/test_team_endpoints.py b/tests/test_litellm/proxy/management_endpoints/test_team_endpoints.py index 06ec71a84f8..d096b5515a0 100644 --- a/tests/test_litellm/proxy/management_endpoints/test_team_endpoints.py +++ b/tests/test_litellm/proxy/management_endpoints/test_team_endpoints.py @@ -16,7 +16,9 @@ sys.path.insert( ) # Adds the parent directory to the system path from litellm.proxy._types import UserAPIKeyAuth # Import UserAPIKeyAuth from litellm.proxy._types import ( + LiteLLM_OrganizationMembershipTable, LiteLLM_OrganizationTable, + LiteLLM_OrganizationTableWithMembers, LiteLLM_TeamTable, LitellmUserRoles, Member, @@ -95,7 +97,7 @@ async def test_validate_team_org_change_same_org_id(): team.members_with_roles = [] # Mock organization - organization = MagicMock(spec=LiteLLM_OrganizationTable) + organization = MagicMock(spec=LiteLLM_OrganizationTableWithMembers) organization.organization_id = org_id organization.models = [] organization.litellm_budget_table = MagicMock() @@ -108,7 +110,7 @@ async def test_validate_team_org_change_same_org_id(): organization.litellm_budget_table.rpm_limit = ( 50 # This would normally fail validation ) - organization.users = [] + organization.members = [] # Mock Router mock_router = MagicMock(spec=Router) @@ -126,6 +128,114 @@ async def test_validate_team_org_change_same_org_id(): mock_access_check.assert_not_called() # Ensure access check wasn't called +@pytest.mark.asyncio +async def test_validate_team_org_change_members_in_org(): + """ + Test that validate_team_org_change passes when team members are in organization.members. + + This tests the fix for issue #17552 where membership was incorrectly checked against + organization.users (deprecated) instead of organization.members (correct). + """ + team_org_id = "team-org-123" + new_org_id = "new-org-456" + user_id_1 = "user-123" + user_id_2 = "user-456" + + # Mock team with members + team = MagicMock(spec=LiteLLM_TeamTable) + team.organization_id = team_org_id + team.models = [] + team.max_budget = None + team.tpm_limit = None + team.rpm_limit = None + + # Create mock team members + team_member_1 = MagicMock() + team_member_1.user_id = user_id_1 + team_member_2 = MagicMock() + team_member_2.user_id = user_id_2 + team.members_with_roles = [team_member_1, team_member_2] + + # Mock organization with members (using LiteLLM_OrganizationMembershipTable structure) + organization = MagicMock(spec=LiteLLM_OrganizationTableWithMembers) + organization.organization_id = new_org_id + organization.models = [] + organization.litellm_budget_table = None + + # Create mock organization members - these should match team members + org_member_1 = MagicMock(spec=LiteLLM_OrganizationMembershipTable) + org_member_1.user_id = user_id_1 + org_member_2 = MagicMock(spec=LiteLLM_OrganizationMembershipTable) + org_member_2.user_id = user_id_2 + organization.members = [org_member_1, org_member_2] + + # Mock Router + mock_router = MagicMock(spec=Router) + + # Test should pass - all team members are in org members + result = validate_team_org_change( + team=team, organization=organization, llm_router=mock_router + ) + assert result is True + + +@pytest.mark.asyncio +async def test_validate_team_org_change_member_not_in_org(): + """ + Test that validate_team_org_change raises HTTPException when team members + are NOT in organization.members. + + This tests the fix for issue #17552 where membership was incorrectly checked against + organization.users (deprecated) instead of organization.members (correct). + """ + team_org_id = "team-org-123" + new_org_id = "new-org-456" + user_id_1 = "user-123" + user_id_2 = "user-456" + user_id_not_in_org = "user-not-in-org-789" + + # Mock team with members (including one not in org) + team = MagicMock(spec=LiteLLM_TeamTable) + team.organization_id = team_org_id + team.models = [] + team.max_budget = None + team.tpm_limit = None + team.rpm_limit = None + + # Create mock team members - user_id_not_in_org is not in the org + team_member_1 = MagicMock() + team_member_1.user_id = user_id_1 + team_member_2 = MagicMock() + team_member_2.user_id = user_id_not_in_org + team.members_with_roles = [team_member_1, team_member_2] + + # Mock organization with members (missing user_id_not_in_org) + organization = MagicMock(spec=LiteLLM_OrganizationTableWithMembers) + organization.organization_id = new_org_id + organization.models = [] + organization.litellm_budget_table = None + + # Create mock organization members - only user_id_1 and user_id_2 are members + org_member_1 = MagicMock(spec=LiteLLM_OrganizationMembershipTable) + org_member_1.user_id = user_id_1 + org_member_2 = MagicMock(spec=LiteLLM_OrganizationMembershipTable) + org_member_2.user_id = user_id_2 + organization.members = [org_member_1, org_member_2] + + # Mock Router + mock_router = MagicMock(spec=Router) + + # Test should fail - user_id_not_in_org is not in org members + with pytest.raises(HTTPException) as exc_info: + validate_team_org_change( + team=team, organization=organization, llm_router=mock_router + ) + + assert exc_info.value.status_code == 403 + assert "not a member of the organization" in str(exc_info.value.detail) + assert user_id_not_in_org in str(exc_info.value.detail) + + # Test for /team/permissions_list endpoint (GET) @pytest.mark.asyncio async def test_get_team_permissions_list_success(mock_db_client, mock_admin_auth): From f02df3035a331ca214080a08afd83a250d596491 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Fri, 5 Dec 2025 15:42:27 -0800 Subject: [PATCH 088/178] [Feat] Allow using dynamic rate limit/priority reservation on teams (#17061) * use helper to get key/team priority * test_team_metadata_priority * docs team priority --- .../docs/proxy/dynamic_rate_limit.md | 39 ++++++++++++- .../proxy/hooks/dynamic_rate_limiter_v3.py | 56 ++++++++++++++----- 2 files changed, 79 insertions(+), 16 deletions(-) diff --git a/docs/my-website/docs/proxy/dynamic_rate_limit.md b/docs/my-website/docs/proxy/dynamic_rate_limit.md index 9c875a51eba..f5438b5a6f5 100644 --- a/docs/my-website/docs/proxy/dynamic_rate_limit.md +++ b/docs/my-website/docs/proxy/dynamic_rate_limit.md @@ -175,7 +175,37 @@ general_settings: litellm --config /path/to/config.yaml ``` -#### 2. Create Keys with Priority Levels +### Set priority on either a team or a key + +Priority can be set at either the **team level** or **key level**. Team-level priority takes precedence over key-level priority. + +**Option A: Set Priority on Team (Recommended)** + +All keys within a team will inherit the team's priority. This is useful when you want all keys for a specific environment or project to have the same priority. + +```bash +curl -X POST 'http://0.0.0.0:4000/team/new' \ +-H 'Authorization: Bearer sk-1234' \ +-H 'Content-Type: application/json' \ +-d '{ + "team_alias": "production-team", + "metadata": {"priority": "prod"} +}' +``` + +Create a key for this team: +```bash +curl -X POST 'http://0.0.0.0:4000/key/generate' \ +-H 'Authorization: Bearer sk-1234' \ +-H 'Content-Type: application/json' \ +-d '{ + "team_id": "team-id-from-previous-response" +}' +``` + +**Option B: Set Priority on Individual Keys** + +Set priority directly on the key. This is useful when you need fine-grained control per key. **Production Key:** ```bash @@ -205,7 +235,7 @@ curl -X POST 'http://0.0.0.0:4000/key/generate' \ -d '{}' ``` -**Expected Response for both:** +**Expected Response:** ```json { "key": "sk-...", @@ -214,6 +244,11 @@ curl -X POST 'http://0.0.0.0:4000/key/generate' \ } ``` +**Priority Resolution Order:** +1. If key belongs to a team with `metadata.priority` set → use team priority +2. Else if key has `metadata.priority` set → use key priority +3. Else → use `default_priority` from config + #### 3. Test Priority Allocation **Test Production Key (should get 9 RPM):** diff --git a/litellm/proxy/hooks/dynamic_rate_limiter_v3.py b/litellm/proxy/hooks/dynamic_rate_limiter_v3.py index d091e348020..53419ef6ad7 100644 --- a/litellm/proxy/hooks/dynamic_rate_limiter_v3.py +++ b/litellm/proxy/hooks/dynamic_rate_limiter_v3.py @@ -80,6 +80,32 @@ class _PROXY_DynamicRateLimitHandlerV3(CustomLogger): weight = convert_priority_to_percent(value, model_info) return weight + def _get_priority_from_user_api_key_dict( + self, user_api_key_dict: UserAPIKeyAuth + ) -> Optional[str]: + """ + Get priority from user_api_key_dict. + + Checks team metadata first (takes precedence), then falls back to key metadata. + + Args: + user_api_key_dict: User authentication info + + Returns: + Priority string if found, None otherwise + """ + priority: Optional[str] = None + + # Check team metadata first (takes precedence) + if user_api_key_dict.team_metadata is not None: + priority = user_api_key_dict.team_metadata.get("priority", None) + + # Fall back to key metadata + if priority is None: + priority = user_api_key_dict.metadata.get("priority", None) + + return priority + def _normalize_priority_weights( self, model_info: ModelGroupInfo ) -> Dict[str, float]: @@ -328,7 +354,7 @@ class _PROXY_DynamicRateLimitHandlerV3(CustomLogger): model: str, model_group_info: ModelGroupInfo, user_api_key_dict: UserAPIKeyAuth, - key_priority: Optional[str], + priority: Optional[str], saturation: float, data: dict, ) -> None: @@ -355,7 +381,7 @@ class _PROXY_DynamicRateLimitHandlerV3(CustomLogger): model: Model name model_group_info: Model configuration user_api_key_dict: User authentication info - key_priority: User's priority level + priority: User's priority level saturation: Current saturation level data: Request data dictionary @@ -384,7 +410,7 @@ class _PROXY_DynamicRateLimitHandlerV3(CustomLogger): priority_descriptors = self._create_priority_based_descriptors( model=model, user_api_key_dict=user_api_key_dict, - priority=key_priority, + priority=priority, ) if priority_descriptors: descriptors_to_check.extend(priority_descriptors) @@ -412,14 +438,14 @@ class _PROXY_DynamicRateLimitHandlerV3(CustomLogger): status_code=429, detail={ "error": f"Model capacity reached for {model}. " - f"Priority: {key_priority}, " + f"Priority: {priority}, " f"Rate limit type: {status['rate_limit_type']}, " f"Remaining: {status['limit_remaining']}" }, headers={ "retry-after": str(self.v3_limiter.window_size), "rate_limit_type": str(status["rate_limit_type"]), - "x-litellm-priority": key_priority or "default", + "x-litellm-priority": priority or "default", }, ) @@ -427,13 +453,13 @@ class _PROXY_DynamicRateLimitHandlerV3(CustomLogger): elif descriptor_key == "priority_model" and should_enforce_priority: verbose_proxy_logger.debug( f"Enforcing priority limits for {model}, saturation: {saturation:.1%}, " - f"priority: {key_priority}" + f"priority: {priority}" ) raise HTTPException( status_code=429, detail={ "error": f"Priority-based rate limit exceeded. " - f"Priority: {key_priority}, " + f"Priority: {priority}, " f"Rate limit type: {status['rate_limit_type']}, " f"Remaining: {status['limit_remaining']}, " f"Model saturation: {saturation:.1%}" @@ -441,7 +467,7 @@ class _PROXY_DynamicRateLimitHandlerV3(CustomLogger): headers={ "retry-after": str(self.v3_limiter.window_size), "rate_limit_type": str(status["rate_limit_type"]), - "x-litellm-priority": key_priority or "default", + "x-litellm-priority": priority or "default", "x-litellm-saturation": f"{saturation:.2%}", }, ) @@ -521,7 +547,9 @@ class _PROXY_DynamicRateLimitHandlerV3(CustomLogger): return None model = data["model"] - key_priority: Optional[str] = user_api_key_dict.metadata.get("priority", None) + priority = self._get_priority_from_user_api_key_dict( + user_api_key_dict=user_api_key_dict + ) # Get model configuration model_group_info: Optional[ModelGroupInfo] = ( @@ -543,7 +571,7 @@ class _PROXY_DynamicRateLimitHandlerV3(CustomLogger): verbose_proxy_logger.debug( f"[Dynamic Rate Limiter] Model={model}, Saturation={saturation:.1%}, " - f"Threshold={saturation_threshold:.1%}, Priority={key_priority}" + f"Threshold={saturation_threshold:.1%}, Priority={priority}" ) # STEP 2: Check rate limits in THREE phases @@ -555,7 +583,7 @@ class _PROXY_DynamicRateLimitHandlerV3(CustomLogger): model=model, model_group_info=model_group_info, user_api_key_dict=user_api_key_dict, - key_priority=key_priority, + priority=priority, saturation=saturation, data=data, ) @@ -586,8 +614,8 @@ class _PROXY_DynamicRateLimitHandlerV3(CustomLogger): # Add additional priority-specific headers if isinstance(response, ModelResponse): - key_priority: Optional[str] = user_api_key_dict.metadata.get( - "priority", None + priority = self._get_priority_from_user_api_key_dict( + user_api_key_dict=user_api_key_dict ) # Get existing additional headers @@ -599,7 +627,7 @@ class _PROXY_DynamicRateLimitHandlerV3(CustomLogger): ) # Add priority information - additional_headers["x-litellm-priority"] = key_priority or "default" + additional_headers["x-litellm-priority"] = priority or "default" additional_headers["x-litellm-rate-limiter-version"] = "v3" # Update response From 5fb7530d8c28c040ef10ec1a53f7f67d6efb266c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 5 Dec 2025 15:44:15 -0800 Subject: [PATCH 089/178] build(deps): bump jws from 3.2.2 to 3.2.3 in /ui/litellm-dashboard (#17494) Bumps [jws](https://github.com/brianloveswords/node-jws) from 3.2.2 to 3.2.3. - [Release notes](https://github.com/brianloveswords/node-jws/releases) - [Changelog](https://github.com/auth0/node-jws/blob/master/CHANGELOG.md) - [Commits](https://github.com/brianloveswords/node-jws/compare/v3.2.2...v3.2.3) --- updated-dependencies: - dependency-name: jws dependency-version: 3.2.3 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- ui/litellm-dashboard/package-lock.json | 50 ++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 7 deletions(-) diff --git a/ui/litellm-dashboard/package-lock.json b/ui/litellm-dashboard/package-lock.json index 9907113c7eb..2ca71c5a8b3 100644 --- a/ui/litellm-dashboard/package-lock.json +++ b/ui/litellm-dashboard/package-lock.json @@ -324,6 +324,7 @@ "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.28.5.tgz", "integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==", "license": "MIT", + "peer": true, "dependencies": { "@babel/code-frame": "^7.27.1", "@babel/generator": "^7.28.5", @@ -2185,6 +2186,7 @@ } ], "license": "MIT", + "peer": true, "engines": { "node": ">=18" }, @@ -2227,6 +2229,7 @@ } ], "license": "MIT", + "peer": true, "engines": { "node": ">=18" } @@ -2336,6 +2339,7 @@ "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-7.1.0.tgz", "integrity": "sha512-8sLjZwK0R+JlxlYcTuVnyT2v+htpdrjDOKuMcOVdYjt52Lh8hWRYpxBPoKx/Zg+bcjc3wx6fmQevMmUztS/ccA==", "license": "MIT", + "peer": true, "dependencies": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" @@ -2757,6 +2761,7 @@ "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-7.1.0.tgz", "integrity": "sha512-8sLjZwK0R+JlxlYcTuVnyT2v+htpdrjDOKuMcOVdYjt52Lh8hWRYpxBPoKx/Zg+bcjc3wx6fmQevMmUztS/ccA==", "license": "MIT", + "peer": true, "dependencies": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" @@ -5824,6 +5829,7 @@ "integrity": "sha512-o4PXJQidqJl82ckFaXUeoAW+XysPLauYI43Abki5hABd853iMhitooc6znOnczgbTYmEP6U6/y1ZyKAIsvMKGg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@babel/code-frame": "^7.10.4", "@babel/runtime": "^7.12.5", @@ -6617,6 +6623,7 @@ "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.48.tgz", "integrity": "sha512-qboRCl6Ie70DQQG9hhNREz81jqC1cs9EVNcjQ1AU+jH6NFfSAhVVbrrY/+nSF+Bsk4AOwm9Qa61InvMCyV+H3w==", "license": "MIT", + "peer": true, "dependencies": { "@types/prop-types": "*", "@types/scheduler": "*", @@ -6639,6 +6646,7 @@ "integrity": "sha512-MEe3UeoENYVFXzoXEWsvcpg6ZvlrFNlOQ7EOsvhI3CfAXwzPfO8Qwuxd40nepsYKqyyVQnTdEfv68q91yLcKrQ==", "dev": true, "license": "MIT", + "peer": true, "peerDependencies": { "@types/react": "^18.0.0" } @@ -6835,6 +6843,7 @@ "integrity": "sha512-lJi3PfxVmo0AkEY93ecfN+r8SofEqZNGByvHAI3GBLrvt1Cw6H5k1IM02nSzu0RfUafr2EvFSw0wAsZgubNplQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@typescript-eslint/scope-manager": "8.47.0", "@typescript-eslint/types": "8.47.0", @@ -7496,6 +7505,7 @@ "integrity": "sha512-hGISOaP18plkzbWEcP/QvtRW1xDXF2+96HbEX6byqQhAUbiS5oH6/9JwW+QsQCIYON2bI6QZBF+2PvOmrRZ9wA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@vitest/utils": "3.2.4", "fflate": "^0.8.2", @@ -7724,6 +7734,7 @@ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "license": "MIT", + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -7813,6 +7824,7 @@ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "license": "MIT", + "peer": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -8666,6 +8678,7 @@ } ], "license": "MIT", + "peer": true, "dependencies": { "baseline-browser-mapping": "^2.8.25", "caniuse-lite": "^1.0.30001754", @@ -8990,6 +9003,7 @@ "resolved": "https://registry.npmjs.org/chevrotain/-/chevrotain-11.0.3.tgz", "integrity": "sha512-ci2iJH6LeIkvP9eJW6gpueU8cnZhv85ELY8w8WiFtNjMHA5ad6pQLaJo9mEly/9qUyCpvqX8/POVUTf18/HFdw==", "license": "Apache-2.0", + "peer": true, "dependencies": { "@chevrotain/cst-dts-gen": "11.0.3", "@chevrotain/gast": "11.0.3", @@ -9718,6 +9732,7 @@ "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-7.1.0.tgz", "integrity": "sha512-8sLjZwK0R+JlxlYcTuVnyT2v+htpdrjDOKuMcOVdYjt52Lh8hWRYpxBPoKx/Zg+bcjc3wx6fmQevMmUztS/ccA==", "license": "MIT", + "peer": true, "dependencies": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" @@ -10080,6 +10095,7 @@ "resolved": "https://registry.npmjs.org/cytoscape/-/cytoscape-3.33.1.tgz", "integrity": "sha512-iJc4TwyANnOGR1OmWhsS9ayRS3s+XQ185FmuHObThD+5AeJCakAAbWv8KimMTt08xCCLNgneQwFp+JRJOr9qGQ==", "license": "MIT", + "peer": true, "engines": { "node": ">=0.10" } @@ -10489,6 +10505,7 @@ "resolved": "https://registry.npmjs.org/d3-selection/-/d3-selection-3.0.0.tgz", "integrity": "sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==", "license": "ISC", + "peer": true, "engines": { "node": ">=12" } @@ -10663,6 +10680,7 @@ "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-3.6.0.tgz", "integrity": "sha512-fRHTG8g/Gif+kSh50gaGEdToemgfj74aRX3swtiouboip5JDLAyDE9F11nHMIcvOaXeOC6D7SpNhi7uFyB7Uww==", "license": "MIT", + "peer": true, "funding": { "type": "github", "url": "https://github.com/sponsors/kossnocorp" @@ -11540,6 +11558,7 @@ "deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", @@ -11725,6 +11744,7 @@ "integrity": "sha512-whOE1HFo/qJDyX4SnXzP4N6zOWn79WhnCUY/iDR0mPfQZO8wcYE4JClzI2oZrhBnnMUCBCHZhO6VQyoBU95mZA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@rtsao/scc": "^1.1.0", "array-includes": "^3.1.9", @@ -14988,6 +15008,7 @@ "integrity": "sha512-454TI39PeRDW1LgpyLPyURtB4Zx1tklSr6+OFOipsxGUH1WMTvk6C65JQdrj455+DP2uJ1+veBEHTGFKWVLFoA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@acemir/cssom": "^0.9.23", "@asamuzakjp/dom-selector": "^6.7.4", @@ -15142,12 +15163,12 @@ } }, "node_modules/jws": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", - "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.3.tgz", + "integrity": "sha512-byiJ0FLRdLdSVSReO/U4E7RoEyOCKnEnEPMjq3HxWtvzLsV08/i5RQKsFVNkCldrCaPr2vDNAOMsfs8T/Hze7g==", "license": "MIT", "dependencies": { - "jwa": "^1.4.1", + "jwa": "^1.4.2", "safe-buffer": "^5.0.1" } }, @@ -18115,6 +18136,7 @@ "resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz", "integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==", "license": "MIT", + "peer": true, "engines": { "node": "*" } @@ -19306,6 +19328,7 @@ } ], "license": "MIT", + "peer": true, "dependencies": { "nanoid": "^3.3.11", "picocolors": "^1.1.1", @@ -20318,6 +20341,7 @@ "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-7.1.0.tgz", "integrity": "sha512-8sLjZwK0R+JlxlYcTuVnyT2v+htpdrjDOKuMcOVdYjt52Lh8hWRYpxBPoKx/Zg+bcjc3wx6fmQevMmUztS/ccA==", "license": "MIT", + "peer": true, "dependencies": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" @@ -21812,6 +21836,7 @@ "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", "license": "MIT", + "peer": true, "dependencies": { "loose-envify": "^1.1.0" }, @@ -21851,6 +21876,7 @@ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", "license": "MIT", + "peer": true, "dependencies": { "loose-envify": "^1.1.0", "scheduler": "^0.23.2" @@ -21908,6 +21934,7 @@ "resolved": "https://registry.npmjs.org/@docusaurus/react-loadable/-/react-loadable-6.0.0.tgz", "integrity": "sha512-YMMxTUQV/QFSnbgrP3tjDzLHRg7vsbMn8e9HAa8o/1iXoiomo48b7sk/kkmWEuWNDPJVlKSJRB6Y2fHqdJk+SQ==", "license": "MIT", + "peer": true, "dependencies": { "@types/react": "*" }, @@ -21973,6 +22000,7 @@ "resolved": "https://registry.npmjs.org/react-router/-/react-router-5.3.4.tgz", "integrity": "sha512-Ys9K+ppnJah3QuaRiLxk+jDWOR1MekYQrlytiXxC1RyfbdsZkS5pvKAzCCr031xHixZwpnsYNT5xysdFHQaYsA==", "license": "MIT", + "peer": true, "dependencies": { "@babel/runtime": "^7.12.13", "history": "^4.9.0", @@ -23010,8 +23038,7 @@ "version": "1.1.5", "resolved": "https://registry.npmjs.org/schema-dts/-/schema-dts-1.1.5.tgz", "integrity": "sha512-RJr9EaCmsLzBX2NDiO5Z3ux2BVosNZN5jo0gWgsyKvxKIUL5R3swNvoorulAeL9kLB0iTSX7V6aokhla2m7xbg==", - "license": "Apache-2.0", - "peer": true + "license": "Apache-2.0" }, "node_modules/schema-utils": { "version": "4.3.3", @@ -23037,6 +23064,7 @@ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "license": "MIT", + "peer": true, "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", @@ -24268,6 +24296,7 @@ "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.18.tgz", "integrity": "sha512-6A2rnmW5xZMdw11LYjhcI5846rt9pbLSabY5XPxo+XWdxwZaFEn47Go4NzFiHu9sNNmr/kXivP1vStfvMaK1GQ==", "license": "MIT", + "peer": true, "dependencies": { "@alloc/quick-lru": "^5.2.0", "arg": "^5.0.2", @@ -24578,6 +24607,7 @@ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "license": "MIT", + "peer": true, "engines": { "node": ">=12" }, @@ -24790,7 +24820,8 @@ "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", - "license": "0BSD" + "license": "0BSD", + "peer": true }, "node_modules/type-check": { "version": "0.4.0", @@ -24923,6 +24954,7 @@ "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", "devOptional": true, "license": "Apache-2.0", + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -25465,6 +25497,7 @@ "integrity": "sha512-NL8jTlbo0Tn4dUEXEsUg8KeyG/Lkmc4Fnzb8JXN/Ykm9G4HNImjtABMJgkQoVjOBN/j2WAwDTRytdqJbZsah7w==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.5.0", @@ -25581,6 +25614,7 @@ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=12" }, @@ -25594,6 +25628,7 @@ "integrity": "sha512-LUCP5ev3GURDysTWiP47wRRUpLKMOfPh+yKTx3kVIEiu5KOMeqzpnYNsKyOoVrULivR8tLcks4+lga33Whn90A==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@types/chai": "^5.2.2", "@vitest/expect": "3.2.4", @@ -25799,6 +25834,7 @@ "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.103.0.tgz", "integrity": "sha512-HU1JOuV1OavsZ+mfigY0j8d1TgQgbZ6M+J75zDkpEAwYeXjWSqrGJtgnPblJjd/mAyTNQ7ygw0MiKOn6etz8yw==", "license": "MIT", + "peer": true, "dependencies": { "@types/eslint-scope": "^3.7.7", "@types/estree": "^1.0.8", From 2ffe8ee204723cf9bf8cca7d2d56174c2788bc01 Mon Sep 17 00:00:00 2001 From: Dominic Fallows Date: Fri, 5 Dec 2025 23:45:19 +0000 Subject: [PATCH 090/178] fix(presidio): handle empty content and error dict responses (#17489) - Skip empty/whitespace text before calling Presidio API - Handle error dict responses gracefully (e.g., {'error': 'No text provided'}) - Add defensive error handling for invalid result items - Add comprehensive test coverage for empty content scenarios Fixes crash in tool/function calling where assistant messages have empty content. --- .../guardrails/guardrail_hooks/presidio.py | 43 +++- .../guardrail_hooks/test_presidio.py | 222 ++++++++++++++++++ 2 files changed, 264 insertions(+), 1 deletion(-) diff --git a/litellm/proxy/guardrails/guardrail_hooks/presidio.py b/litellm/proxy/guardrails/guardrail_hooks/presidio.py index d183b688edd..8666f6add53 100644 --- a/litellm/proxy/guardrails/guardrail_hooks/presidio.py +++ b/litellm/proxy/guardrails/guardrail_hooks/presidio.py @@ -207,6 +207,14 @@ class _OPTIONAL_PresidioPIIMasking(CustomGuardrail): Send text to the Presidio analyzer endpoint and get analysis results """ try: + # Skip empty or whitespace-only text to avoid Presidio errors + # Common in tool/function calling where assistant content is empty + if not text or len(text.strip()) == 0: + verbose_proxy_logger.debug( + "Skipping Presidio analysis for empty/whitespace-only text" + ) + return [] + async with aiohttp.ClientSession() as session: if self.mock_redacted_text is not None: return self.mock_redacted_text @@ -231,9 +239,42 @@ class _OPTIONAL_PresidioPIIMasking(CustomGuardrail): async with session.post(analyze_url, json=analyze_payload) as response: analyze_results = await response.json() verbose_proxy_logger.debug("analyze_results: %s", analyze_results) + + # Handle error responses from Presidio (e.g., {'error': 'No text provided'}) + # Presidio may return a dict instead of a list when errors occur + if isinstance(analyze_results, dict): + if "error" in analyze_results: + verbose_proxy_logger.warning( + "Presidio analyzer returned error: %s, returning empty list", + analyze_results.get("error") + ) + return [] + # If it's a dict but not an error, try to process it as a single item + verbose_proxy_logger.debug( + "Presidio returned dict (not list), attempting to process as single item" + ) + try: + return [PresidioAnalyzeResponseItem(**analyze_results)] + except Exception as e: + verbose_proxy_logger.warning( + "Failed to parse Presidio dict response: %s, returning empty list", + e + ) + return [] + + # Normal case: list of results final_results = [] for item in analyze_results: - final_results.append(PresidioAnalyzeResponseItem(**item)) + try: + final_results.append(PresidioAnalyzeResponseItem(**item)) + except TypeError as te: + # Handle case where item is not a dict (shouldn't happen, but be defensive) + verbose_proxy_logger.warning( + "Skipping invalid Presidio result item: %s (error: %s)", + item, + te + ) + continue return final_results except Exception as e: raise e diff --git a/tests/test_litellm/proxy/guardrails/guardrail_hooks/test_presidio.py b/tests/test_litellm/proxy/guardrails/guardrail_hooks/test_presidio.py index a6b2ae5b3a0..6450b9a63b0 100644 --- a/tests/test_litellm/proxy/guardrails/guardrail_hooks/test_presidio.py +++ b/tests/test_litellm/proxy/guardrails/guardrail_hooks/test_presidio.py @@ -634,6 +634,228 @@ async def test_request_data_flows_to_apply_guardrail(): print("āœ“ request_data correctly passed to apply_guardrail") +@pytest.mark.asyncio +async def test_empty_content_handling(presidio_guardrail, mock_user_api_key, mock_cache): + """ + Test that Presidio handles empty content gracefully. + + This is common in tool/function calling where assistant messages have + empty content but include tool_calls. + + Bug fix: Previously crashed with: + TypeError: argument after ** must be a mapping, not str + """ + test_data = { + "messages": [ + {"role": "user", "content": "What is 2+2?"}, + { + "role": "assistant", + "content": "", # Empty content - common in tool calls + "tool_calls": [ + { + "id": "call_123", + "type": "function", + "function": {"name": "calculator", "arguments": '{"a":2,"b":2}'}, + } + ], + }, + {"role": "tool", "tool_call_id": "call_123", "content": "4"}, + ], + "model": "gpt-4", + } + + # Mock check_pii to simulate PII processing without needing Presidio API + async def mock_check_pii(text, output_parse_pii, presidio_config, request_data): + # Empty text returns as-is (this is what our fix ensures) + return text + + presidio_guardrail.check_pii = mock_check_pii + + # This should not raise an exception + result = await presidio_guardrail.async_pre_call_hook( + user_api_key_dict=mock_user_api_key, + cache=mock_cache, + data=test_data, + call_type="completion", + ) + + assert result is not None + assert "messages" in result + # Verify messages are preserved + assert len(result["messages"]) == 3 + + print("āœ“ Empty content handling test passed") + + +@pytest.mark.asyncio +async def test_whitespace_only_content(presidio_guardrail, mock_user_api_key, mock_cache): + """ + Test that Presidio handles whitespace-only content gracefully. + + Whitespace-only content should be treated the same as empty content. + """ + test_data = { + "messages": [ + {"role": "user", "content": " "}, # Whitespace only + {"role": "assistant", "content": "\n\t "}, # Tabs and newlines + {"role": "user", "content": "Real question here"}, + ], + "model": "gpt-4", + } + + # Mock check_pii to simulate PII processing + async def mock_check_pii(text, output_parse_pii, presidio_config, request_data): + return text + + presidio_guardrail.check_pii = mock_check_pii + + result = await presidio_guardrail.async_pre_call_hook( + user_api_key_dict=mock_user_api_key, + cache=mock_cache, + data=test_data, + call_type="completion", + ) + + assert result is not None + assert len(result["messages"]) == 3 + + print("āœ“ Whitespace-only content test passed") + + +@pytest.mark.asyncio +async def test_analyze_text_with_empty_string(): + """ + Test analyze_text method directly with empty string. + + Should return empty list without making API call to Presidio. + """ + presidio = _OPTIONAL_PresidioPIIMasking( + presidio_analyzer_api_base="http://test:5002/", + presidio_anonymizer_api_base="http://test:5001/", + output_parse_pii=False, + ) + + # Test with empty string - should return immediately without API call + result = await presidio.analyze_text( + text="", + presidio_config=None, + request_data={}, + ) + assert result == [], "Empty text should return empty list" + + # Test with whitespace only - should return immediately + result = await presidio.analyze_text( + text=" \n\t ", + presidio_config=None, + request_data={}, + ) + assert result == [], "Whitespace-only text should return empty list" + + print("āœ“ analyze_text empty string test passed") + + +@pytest.mark.asyncio +async def test_analyze_text_error_dict_handling(): + """ + Test that analyze_text handles error dict responses from Presidio API. + + When Presidio returns {'error': 'No text provided'}, should handle gracefully + instead of crashing with TypeError. + """ + presidio = _OPTIONAL_PresidioPIIMasking( + presidio_analyzer_api_base="http://mock-presidio:5002/", + presidio_anonymizer_api_base="http://mock-presidio:5001/", + output_parse_pii=False, + ) + + # Mock the HTTP response to return error dict + class MockResponse: + async def json(self): + return {"error": "No text provided"} + async def __aenter__(self): + return self + async def __aexit__(self, *args): + pass + + class MockSession: + def post(self, *args, **kwargs): + return MockResponse() + async def __aenter__(self): + return self + async def __aexit__(self, *args): + pass + + with patch("aiohttp.ClientSession", return_value=MockSession()): + result = await presidio.analyze_text( + text="some text", + presidio_config=None, + request_data={}, + ) + # Should return empty list when error dict is received + assert result == [], "Error dict should be handled gracefully" + + print("āœ“ analyze_text error dict handling test passed") + + +@pytest.mark.asyncio +async def test_tool_calling_complete_scenario(presidio_guardrail, mock_user_api_key, mock_cache): + """ + Test complete tool calling scenario with PII in user message. + + This tests the real-world scenario where: + 1. User provides a query with PII + 2. Assistant responds with empty content + tool_calls + 3. Tool provides response + 4. Assistant provides final answer + """ + test_data = { + "messages": [ + { + "role": "user", + "content": "My email is john.doe@example.com. Can you look up my account?", + }, + { + "role": "assistant", + "content": "", # Empty - tool call + "tool_calls": [ + { + "id": "call_abc", + "type": "function", + "function": {"name": "lookup_account", "arguments": "{}"}, + } + ], + }, + {"role": "tool", "tool_call_id": "call_abc", "content": "Account found"}, + {"role": "assistant", "content": "I found your account information."}, + ], + "model": "gpt-4", + } + + # Mock check_pii to simulate PII masking + async def mock_check_pii(text, output_parse_pii, presidio_config, request_data): + if "john.doe@example.com" in text: + return text.replace("john.doe@example.com", "[EMAIL]") + return text + + presidio_guardrail.check_pii = mock_check_pii + + result = await presidio_guardrail.async_pre_call_hook( + user_api_key_dict=mock_user_api_key, + cache=mock_cache, + data=test_data, + call_type="completion", + ) + + assert result is not None + # Verify PII was masked in user message + assert "[EMAIL]" in result["messages"][0]["content"] + assert "john.doe@example.com" not in result["messages"][0]["content"] + # Verify other messages preserved + assert len(result["messages"]) == 4 + + print("āœ“ Tool calling complete scenario test passed") + + if __name__ == "__main__": # Run tests asyncio.run( From ae065525ea6d331bc36a451fae94319023c638cc Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Fri, 5 Dec 2025 15:39:22 -0800 Subject: [PATCH 091/178] fix ZAI --- litellm/__init__.py | 53 +++++++++++++++++++ ...odel_prices_and_context_window_backup.json | 28 ++++++++++ 2 files changed, 81 insertions(+) diff --git a/litellm/__init__.py b/litellm/__init__.py index e312169ffc7..f87dee6ba93 100644 --- a/litellm/__init__.py +++ b/litellm/__init__.py @@ -520,6 +520,7 @@ perplexity_models: Set = set() watsonx_models: Set = set() gemini_models: Set = set() xai_models: Set = set() +zai_models: Set = set() deepseek_models: Set = set() runwayml_models: Set = set() azure_ai_models: Set = set() @@ -711,6 +712,8 @@ def add_known_models(): text_completion_codestral_models.add(key) elif value.get("litellm_provider") == "xai": xai_models.add(key) + elif value.get("litellm_provider") == "zai": + zai_models.add(key) elif value.get("litellm_provider") == "fal_ai": fal_ai_models.add(key) elif value.get("litellm_provider") == "deepseek": @@ -872,6 +875,7 @@ model_list = list( | gemini_models | text_completion_codestral_models | xai_models + | zai_models | fal_ai_models | deepseek_models | azure_ai_models @@ -960,6 +964,7 @@ models_by_provider: dict = { "aleph_alpha": aleph_alpha_models, "text-completion-codestral": text_completion_codestral_models, "xai": xai_models, + "zai": zai_models, "fal_ai": fal_ai_models, "deepseek": deepseek_models, "runwayml": runwayml_models, @@ -1497,10 +1502,58 @@ def set_global_gitlab_config(config: Dict[str, Any]) -> None: # Lazy loading system for heavy modules to reduce initial import time and memory usage if TYPE_CHECKING: + from litellm.types.utils import ModelInfo + + # Cost calculator functions cost_per_token: Callable[..., Tuple[float, float]] completion_cost: Callable[..., float] response_cost_calculator: Any modify_integration: Any + + # Utils functions - type stubs for lazy loaded functions + exception_type: Callable[..., Any] + get_optional_params: Callable[..., dict] + get_response_string: Callable[..., str] + token_counter: Callable[..., int] + create_pretrained_tokenizer: Callable[..., Any] + create_tokenizer: Callable[..., Any] + supports_function_calling: Callable[..., bool] + supports_web_search: Callable[..., bool] + supports_url_context: Callable[..., bool] + supports_response_schema: Callable[..., bool] + supports_parallel_function_calling: Callable[..., bool] + supports_vision: Callable[..., bool] + supports_audio_input: Callable[..., bool] + supports_audio_output: Callable[..., bool] + supports_system_messages: Callable[..., bool] + supports_reasoning: Callable[..., bool] + get_litellm_params: Callable[..., dict] + acreate: Callable[..., Any] + get_max_tokens: Callable[..., int] + get_model_info: Callable[..., ModelInfo] + register_prompt_template: Callable[..., None] + validate_environment: Callable[..., dict] + check_valid_key: Callable[..., bool] + register_model: Callable[..., None] + encode: Callable[..., list] + decode: Callable[..., str] + _calculate_retry_after: Callable[..., float] + _should_retry: Callable[[int], bool] + get_supported_openai_params: Callable[..., Optional[list]] + get_api_base: Callable[..., Optional[str]] + get_first_chars_messages: Callable[..., str] + get_provider_fields: Callable[..., dict] + get_valid_models: Callable[..., list] + + # Response types - lazy loaded + ModelResponse: Type[Any] + ModelResponseStream: Type[Any] + EmbeddingResponse: Type[Any] + ImageResponse: Type[Any] + TranscriptionResponse: Type[Any] + TextCompletionResponse: Type[Any] + ModelResponseListIterator: Type[Any] + Logging: Type[Any] def __getattr__(name: str) -> Any: diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json index 634ea6dc48a..d4afde20e93 100644 --- a/litellm/model_prices_and_context_window_backup.json +++ b/litellm/model_prices_and_context_window_backup.json @@ -5164,6 +5164,19 @@ "supports_function_calling": true, "supports_tool_choice": true }, + "azure_ai/mistral-large-3": { + "input_cost_per_token": 5e-07, + "litellm_provider": "azure_ai", + "max_input_tokens": 256000, + "max_output_tokens": 8191, + "max_tokens": 8191, + "mode": "chat", + "output_cost_per_token": 1.5e-06, + "source": "https://azure.microsoft.com/en-us/blog/introducing-mistral-large-3-in-microsoft-foundry-open-capable-and-ready-for-production-workloads/", + "supports_function_calling": true, + "supports_tool_choice": true, + "supports_vision": true + }, "azure_ai/mistral-medium-2505": { "input_cost_per_token": 4e-07, "litellm_provider": "azure_ai", @@ -18745,6 +18758,21 @@ "supports_response_schema": true, "supports_tool_choice": true }, + "mistral/mistral-large-3": { + "input_cost_per_token": 5e-07, + "litellm_provider": "mistral", + "max_input_tokens": 256000, + "max_output_tokens": 8191, + "max_tokens": 8191, + "mode": "chat", + "output_cost_per_token": 1.5e-06, + "source": "https://docs.mistral.ai/models/mistral-large-3-25-12", + "supports_assistant_prefill": true, + "supports_function_calling": true, + "supports_response_schema": true, + "supports_tool_choice": true, + "supports_vision": true + }, "mistral/mistral-medium": { "input_cost_per_token": 2.7e-06, "litellm_provider": "mistral", From e519462efab817a3d708d1e9cd47b7cf340d5191 Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Fri, 5 Dec 2025 15:46:14 -0800 Subject: [PATCH 092/178] fix MYPY linting --- litellm/__init__.py | 26 +++-------- .../get_llm_provider_logic.py | 4 +- .../chat/guardrail_translation/handler.py | 46 +++++++++---------- litellm/llms/openai_like/dynamic_config.py | 7 ++- .../llms/vertex_ai/gemini/transformation.py | 4 +- .../text_to_speech/transformation.py | 2 +- litellm/proxy/auth/login_utils.py | 14 ++++-- .../generic_guardrail_api.py | 2 +- .../health_endpoints/_health_endpoints.py | 2 +- .../proxy/hooks/key_management_event_hooks.py | 1 - litellm/proxy/proxy_server.py | 22 +++++---- litellm/utils.py | 4 +- 12 files changed, 68 insertions(+), 66 deletions(-) diff --git a/litellm/__init__.py b/litellm/__init__.py index f87dee6ba93..10ea521cc9c 100644 --- a/litellm/__init__.py +++ b/litellm/__init__.py @@ -1502,7 +1502,7 @@ def set_global_gitlab_config(config: Dict[str, Any]) -> None: # Lazy loading system for heavy modules to reduce initial import time and memory usage if TYPE_CHECKING: - from litellm.types.utils import ModelInfo + from litellm.types.utils import ModelInfo as _ModelInfoType # Cost calculator functions cost_per_token: Callable[..., Tuple[float, float]] @@ -1510,13 +1510,9 @@ if TYPE_CHECKING: response_cost_calculator: Any modify_integration: Any - # Utils functions - type stubs for lazy loaded functions - exception_type: Callable[..., Any] - get_optional_params: Callable[..., dict] + # Utils functions - type stubs for truly lazy loaded functions only + # (functions NOT imported via "from .main import *") get_response_string: Callable[..., str] - token_counter: Callable[..., int] - create_pretrained_tokenizer: Callable[..., Any] - create_tokenizer: Callable[..., Any] supports_function_calling: Callable[..., bool] supports_web_search: Callable[..., bool] supports_url_context: Callable[..., bool] @@ -1527,10 +1523,9 @@ if TYPE_CHECKING: supports_audio_output: Callable[..., bool] supports_system_messages: Callable[..., bool] supports_reasoning: Callable[..., bool] - get_litellm_params: Callable[..., dict] acreate: Callable[..., Any] get_max_tokens: Callable[..., int] - get_model_info: Callable[..., ModelInfo] + get_model_info: Callable[..., _ModelInfoType] register_prompt_template: Callable[..., None] validate_environment: Callable[..., dict] check_valid_key: Callable[..., bool] @@ -1538,22 +1533,15 @@ if TYPE_CHECKING: encode: Callable[..., list] decode: Callable[..., str] _calculate_retry_after: Callable[..., float] - _should_retry: Callable[[int], bool] + _should_retry: Callable[..., bool] get_supported_openai_params: Callable[..., Optional[list]] get_api_base: Callable[..., Optional[str]] get_first_chars_messages: Callable[..., str] - get_provider_fields: Callable[..., dict] + get_provider_fields: Callable[..., List] get_valid_models: Callable[..., list] - # Response types - lazy loaded - ModelResponse: Type[Any] - ModelResponseStream: Type[Any] - EmbeddingResponse: Type[Any] - ImageResponse: Type[Any] - TranscriptionResponse: Type[Any] - TextCompletionResponse: Type[Any] + # Response types - truly lazy loaded only (not in main.py or elsewhere) ModelResponseListIterator: Type[Any] - Logging: Type[Any] def __getattr__(name: str) -> Any: diff --git a/litellm/litellm_core_utils/get_llm_provider_logic.py b/litellm/litellm_core_utils/get_llm_provider_logic.py index 288c122e0e7..ca00370729b 100644 --- a/litellm/litellm_core_utils/get_llm_provider_logic.py +++ b/litellm/litellm_core_utils/get_llm_provider_logic.py @@ -469,11 +469,13 @@ def _get_openai_compatible_provider_info( # noqa: PLR0915 model = model.split("/", 1)[1] # Check JSON providers FIRST (before hardcoded ones) - from litellm.llms.openai_like.json_loader import JSONProviderRegistry from litellm.llms.openai_like.dynamic_config import create_config_class + from litellm.llms.openai_like.json_loader import JSONProviderRegistry if JSONProviderRegistry.exists(custom_llm_provider): provider_config = JSONProviderRegistry.get(custom_llm_provider) + if provider_config is None: + raise ValueError(f"Provider {custom_llm_provider} not found") config_class = create_config_class(provider_config) api_base, dynamic_api_key = config_class()._get_openai_compatible_provider_info( api_base, api_key diff --git a/litellm/llms/openai/chat/guardrail_translation/handler.py b/litellm/llms/openai/chat/guardrail_translation/handler.py index aa2580453a8..809c3e4d3e0 100644 --- a/litellm/llms/openai/chat/guardrail_translation/handler.py +++ b/litellm/llms/openai/chat/guardrail_translation/handler.py @@ -164,7 +164,7 @@ class OpenAIChatCompletionsHandler(BaseTranslation): for tool_call_idx, tool_call in enumerate(tool_calls): if isinstance(tool_call, dict): # Add the full tool call object to the list - tool_calls_to_check.append(ChatCompletionToolParam(**tool_call)) + tool_calls_to_check.append(cast(ChatCompletionToolParam, tool_call)) tool_call_task_mappings.append((msg_idx, int(tool_call_idx))) async def _apply_guardrail_responses_to_input_texts( @@ -380,20 +380,20 @@ class OpenAIChatCompletionsHandler(BaseTranslation): if isinstance(content, str): # String content - accumulate for this choice - key = (choice_idx, None) - if key not in combined_texts: - combined_texts[key] = "" - combined_texts[key] += content + str_key: Tuple[int, Optional[int]] = (choice_idx, None) + if str_key not in combined_texts: + combined_texts[str_key] = "" + combined_texts[str_key] += content elif isinstance(content, list): # List content - accumulate for each content item for content_idx, content_item in enumerate(content): text_str = content_item.get("text") if text_str: - key = (choice_idx, content_idx) - if key not in combined_texts: - combined_texts[key] = "" - combined_texts[key] += text_str + list_key: Tuple[int, Optional[int]] = (choice_idx, content_idx) + if list_key not in combined_texts: + combined_texts[list_key] = "" + combined_texts[list_key] += text_str # Step 2: Create lists for guardrail processing texts_to_check: List[str] = [] @@ -401,9 +401,9 @@ class OpenAIChatCompletionsHandler(BaseTranslation): task_mappings: List[Tuple[int, Optional[int]]] = [] # Track (choice_index, content_index) for each combined text - for (choice_idx, content_idx), combined_text in combined_texts.items(): + for (map_choice_idx, map_content_idx), combined_text in combined_texts.items(): texts_to_check.append(combined_text) - task_mappings.append((choice_idx, content_idx)) + task_mappings.append((map_choice_idx, map_content_idx)) # Step 3: Apply guardrail to all combined texts in batch if texts_to_check: @@ -503,7 +503,7 @@ class OpenAIChatCompletionsHandler(BaseTranslation): # Determine content source and tool calls based on choice type content = None - tool_calls = None + tool_calls: Optional[List[Any]] = None if isinstance(choice, litellm.Choices): content = choice.message.content tool_calls = choice.message.tool_calls @@ -686,15 +686,15 @@ class OpenAIChatCompletionsHandler(BaseTranslation): if isinstance(content, str): # String content - key = (choice_idx_in_response, None) - if key in guardrail_map: - if key not in already_set: + str_key: Tuple[int, Optional[int]] = (choice_idx_in_response, None) + if str_key in guardrail_map: + if str_key not in already_set: # First chunk - set the complete guardrailed text if isinstance(choice, litellm.StreamingChoices): - choice.delta.content = guardrail_map[key] + choice.delta.content = guardrail_map[str_key] elif isinstance(choice, litellm.Choices): - choice.message.content = guardrail_map[key] - already_set[key] = True + choice.message.content = guardrail_map[str_key] + already_set[str_key] = True else: # Subsequent chunks - clear the content if isinstance(choice, litellm.StreamingChoices): @@ -706,12 +706,12 @@ class OpenAIChatCompletionsHandler(BaseTranslation): # List content - handle each content item for content_idx, content_item in enumerate(content): if "text" in content_item: - key = (choice_idx_in_response, content_idx) - if key in guardrail_map: - if key not in already_set: + list_key: Tuple[int, Optional[int]] = (choice_idx_in_response, content_idx) + if list_key in guardrail_map: + if list_key not in already_set: # First chunk - set the complete guardrailed text - content_item["text"] = guardrail_map[key] - already_set[key] = True + content_item["text"] = guardrail_map[list_key] + already_set[list_key] = True else: # Subsequent chunks - clear the text content_item["text"] = "" diff --git a/litellm/llms/openai_like/dynamic_config.py b/litellm/llms/openai_like/dynamic_config.py index ca2489799c2..1e7866bebbe 100644 --- a/litellm/llms/openai_like/dynamic_config.py +++ b/litellm/llms/openai_like/dynamic_config.py @@ -19,11 +19,11 @@ def create_config_class(provider: SimpleProviderConfig): """Generate config class dynamically from JSON configuration""" # Choose base class - base_class = ( + base_class: type = ( OpenAIGPTConfig if provider.base_class == "openai_gpt" else OpenAILikeChatConfig ) - class JSONProviderConfig(base_class): + class JSONProviderConfig(base_class): # type: ignore[valid-type,misc] @overload def _transform_messages( self, messages: List[AllMessageValues], model: str, is_async: Literal[True] @@ -87,6 +87,9 @@ def create_config_class(provider: SimpleProviderConfig): if not api_base: api_base = provider.base_url + if api_base is None: + raise ValueError(f"api_base is required for provider {provider.slug}") + if not api_base.endswith("/chat/completions"): api_base = f"{api_base}/chat/completions" diff --git a/litellm/llms/vertex_ai/gemini/transformation.py b/litellm/llms/vertex_ai/gemini/transformation.py index 3151a6d667e..a95d5447e97 100644 --- a/litellm/llms/vertex_ai/gemini/transformation.py +++ b/litellm/llms/vertex_ai/gemini/transformation.py @@ -116,7 +116,7 @@ def _process_gemini_image( is not None ): file_data = FileDataType(file_uri=image_url, mime_type=image_type) - part: PartType = {"file_data": file_data} + part = {"file_data": file_data} if media_resolution_enum is not None and model is not None: from .vertex_and_google_ai_studio_gemini import VertexGeminiConfig @@ -129,7 +129,7 @@ def _process_gemini_image( image = convert_to_anthropic_image_obj(image_url, format=format) _blob: BlobType = {"data": image["data"], "mime_type": image["media_type"]} - part: PartType = {"inline_data": cast(BlobType, _blob)} + part = {"inline_data": cast(BlobType, _blob)} if media_resolution_enum is not None and model is not None: from .vertex_and_google_ai_studio_gemini import VertexGeminiConfig diff --git a/litellm/llms/vertex_ai/text_to_speech/transformation.py b/litellm/llms/vertex_ai/text_to_speech/transformation.py index aff14b1004f..18ca077c4da 100644 --- a/litellm/llms/vertex_ai/text_to_speech/transformation.py +++ b/litellm/llms/vertex_ai/text_to_speech/transformation.py @@ -220,7 +220,7 @@ class VertexAITextToSpeechConfig(BaseTextToSpeechConfig, VertexBase): Returns: Tuple of (mapped_voice_str, mapped_params) """ - mapped_params = {} + mapped_params: Dict[str, Any] = {} ########################################################## # Map voice using helper diff --git a/litellm/proxy/auth/login_utils.py b/litellm/proxy/auth/login_utils.py index 6ef983b221c..fb9757ca647 100644 --- a/litellm/proxy/auth/login_utils.py +++ b/litellm/proxy/auth/login_utils.py @@ -9,9 +9,9 @@ import os import secrets from typing import Literal, Optional, cast -import litellm from fastapi import HTTPException +import litellm from litellm.constants import LITELLM_PROXY_ADMIN_NAME from litellm.proxy._types import ( LiteLLM_UserTable, @@ -64,13 +64,19 @@ def get_ui_credentials(master_key: Optional[str]) -> tuple[str, str]: class LoginResult: """Result object containing authentication data from login.""" + user_id: str + key: str + user_email: Optional[str] + user_role: str + login_method: Literal["sso", "username_password"] + def __init__( self, user_id: str, key: str, user_email: Optional[str], user_role: str, - login_method: str = "username_password", + login_method: Literal["sso", "username_password"] = "username_password", ): self.user_id = user_id self.key = key @@ -193,14 +199,14 @@ async def authenticate_user( key = response["token"] # type: ignore if get_secret_bool("EXPERIMENTAL_UI_LOGIN"): + from litellm.proxy.auth.auth_checks import ExperimentalUIJWTToken + user_info: Optional[LiteLLM_UserTable] = None if _user_row is not None: user_info = _user_row elif ( user_id is not None ): # if user_id is not None, we are using the UI_USERNAME and UI_PASSWORD - from litellm.proxy.auth.auth_checks import ExperimentalUIJWTToken - user_info = LiteLLM_UserTable( user_id=user_id, user_role=user_role, diff --git a/litellm/proxy/guardrails/guardrail_hooks/generic_guardrail_api/generic_guardrail_api.py b/litellm/proxy/guardrails/guardrail_hooks/generic_guardrail_api/generic_guardrail_api.py index c7b4f19a089..6ad21a4758a 100644 --- a/litellm/proxy/guardrails/guardrail_hooks/generic_guardrail_api/generic_guardrail_api.py +++ b/litellm/proxy/guardrails/guardrail_hooks/generic_guardrail_api/generic_guardrail_api.py @@ -127,7 +127,7 @@ class GenericGuardrailAPI(CustomGuardrail): for field_name in GenericGuardrailAPIMetadata.__annotations__.keys(): value = metadata_dict.get(field_name) if value is not None: - result_metadata[field_name] = value + result_metadata[field_name] = value # type: ignore[literal-required] # handle user_api_key_token = user_api_key_hash if metadata_dict.get("user_api_key_token") is not None: diff --git a/litellm/proxy/health_endpoints/_health_endpoints.py b/litellm/proxy/health_endpoints/_health_endpoints.py index 5e4784d709e..62a2aca05dc 100644 --- a/litellm/proxy/health_endpoints/_health_endpoints.py +++ b/litellm/proxy/health_endpoints/_health_endpoints.py @@ -409,7 +409,7 @@ def _build_model_param_to_info_mapping(model_list: list) -> dict: Returns: Dictionary mapping model parameter to list of model info dicts """ - model_param_to_info = {} + model_param_to_info: dict = {} for model in model_list: model_info = model.get("model_info", {}) model_name = model.get("model_name") diff --git a/litellm/proxy/hooks/key_management_event_hooks.py b/litellm/proxy/hooks/key_management_event_hooks.py index 5cfc85ae7aa..3aa62eeeede 100644 --- a/litellm/proxy/hooks/key_management_event_hooks.py +++ b/litellm/proxy/hooks/key_management_event_hooks.py @@ -7,7 +7,6 @@ import litellm from litellm._logging import verbose_proxy_logger from litellm._uuid import uuid from litellm.proxy._types import ( - CommonProxyErrors, GenerateKeyRequest, GenerateKeyResponse, KeyRequest, diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index c1a5fd6c924..2caaec47243 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -45,7 +45,10 @@ from litellm.constants import ( LITELLM_SETTINGS_SAFE_DB_OVERRIDES, ) from litellm.litellm_core_utils.safe_json_dumps import safe_dumps -from litellm.proxy.common_utils.callback_utils import normalize_callback_names +from litellm.proxy.common_utils.callback_utils import ( + normalize_callback_names, + process_callback, +) from litellm.proxy.common_utils.realtime_utils import _realtime_request_body from litellm.types.utils import ( ModelResponse, @@ -54,7 +57,6 @@ from litellm.types.utils import ( TokenCountResponse, ) from litellm.utils import load_credentials_from_list -from litellm.proxy.common_utils.callback_utils import process_callback if TYPE_CHECKING: from aiohttp import ClientSession @@ -168,8 +170,8 @@ from litellm.constants import ( PROXY_BUDGET_RESCHEDULER_MIN_TIME, ) from litellm.exceptions import RejectedRequestError -from litellm.integrations.SlackAlerting.slack_alerting import SlackAlerting from litellm.integrations.custom_logger import CustomLogger +from litellm.integrations.SlackAlerting.slack_alerting import SlackAlerting from litellm.litellm_core_utils.core_helpers import ( _get_parent_otel_span_from_kwargs, get_litellm_metadata_from_kwargs, @@ -613,7 +615,7 @@ async def proxy_shutdown_event(): await jwt_handler.close() if db_writer_client is not None: - await db_writer_client.close() + await db_writer_client.close() # type: ignore[reportGeneralTypeIssues] # flush remaining langfuse logs if "langfuse" in litellm.success_callback: @@ -792,7 +794,7 @@ async def proxy_startup_event(app: FastAPI): except Exception as e: verbose_proxy_logger.error(f"Error closing shared aiohttp session: {e}") - await proxy_shutdown_event() + await proxy_shutdown_event() # type: ignore[reportGeneralTypeIssues] app = FastAPI( @@ -802,7 +804,7 @@ app = FastAPI( description=_description, version=version, root_path=server_root_path, # check if user passed root path, FastAPI defaults this value to "" - lifespan=proxy_startup_event, + lifespan=proxy_startup_event, # type: ignore[reportGeneralTypeIssues] ) vertex_live_passthrough_vertex_base = VertexBase() @@ -8330,9 +8332,9 @@ async def login(request: Request): # noqa: PLR0915 # Generate JWT token import jwt - jwt_token = jwt.encode( # type: ignore + jwt_token = jwt.encode( cast(dict, returned_ui_token_object), - master_key, + cast(str, master_key), algorithm="HS256", ) @@ -8377,9 +8379,9 @@ async def login_v2(request: Request): # noqa: PLR0915 import jwt - jwt_token = jwt.encode( # type: ignore + jwt_token = jwt.encode( cast(dict, returned_ui_token_object), - master_key, + cast(str, master_key), algorithm="HS256", ) diff --git a/litellm/utils.py b/litellm/utils.py index 0db84d3f5b9..1d10ecce016 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -7023,11 +7023,13 @@ class ProviderConfigManager: """ # Check JSON providers FIRST - from litellm.llms.openai_like.json_loader import JSONProviderRegistry from litellm.llms.openai_like.dynamic_config import create_config_class + from litellm.llms.openai_like.json_loader import JSONProviderRegistry if JSONProviderRegistry.exists(provider.value): provider_config = JSONProviderRegistry.get(provider.value) + if provider_config is None: + raise ValueError(f"Provider {provider.value} not found") return create_config_class(provider_config)() if ( From bffc1181709a5ebfa8fd6d4f230d1c1e4adf30a1 Mon Sep 17 00:00:00 2001 From: Irfan Sofyana Putra Date: Sat, 6 Dec 2025 06:47:34 +0700 Subject: [PATCH 093/178] fix bedrock qwen anthropic beta (#17467) --- .../bedrock/chat/converse_transformation.py | 5 +- .../bedrock/test_anthropic_beta_support.py | 100 ++++++++++++++++++ 2 files changed, 104 insertions(+), 1 deletion(-) diff --git a/litellm/llms/bedrock/chat/converse_transformation.py b/litellm/llms/bedrock/chat/converse_transformation.py index 705f3c9e630..2a1d7f2e3a3 100644 --- a/litellm/llms/bedrock/chat/converse_transformation.py +++ b/litellm/llms/bedrock/chat/converse_transformation.py @@ -960,7 +960,10 @@ class AmazonConverseConfig(BaseConfig): bedrock_tools = _bedrock_tools_pt(filtered_tools) # Set anthropic_beta in additional_request_params if we have any beta features - if anthropic_beta_list: + # ONLY apply to Anthropic/Claude models - other models (e.g., Qwen, Llama) don't support this field + # and will error with "unknown variant anthropic_beta" if included + base_model = BedrockModelInfo.get_base_model(model) + if anthropic_beta_list and base_model.startswith("anthropic"): # Remove duplicates while preserving order unique_betas = [] seen = set() diff --git a/tests/test_litellm/llms/bedrock/test_anthropic_beta_support.py b/tests/test_litellm/llms/bedrock/test_anthropic_beta_support.py index 7de2294954c..b9324e4966f 100644 --- a/tests/test_litellm/llms/bedrock/test_anthropic_beta_support.py +++ b/tests/test_litellm/llms/bedrock/test_anthropic_beta_support.py @@ -290,3 +290,103 @@ class TestAnthropicBetaHeaderSupport: else: # If no beta headers, that's also fine assert True + + def test_converse_non_anthropic_model_no_anthropic_beta(self): + """Test that non-Anthropic models (e.g., Qwen) do NOT get anthropic_beta in additionalModelRequestFields. + + This is critical because non-Anthropic models on Bedrock will error with + "unknown variant anthropic_beta" if this field is included. + """ + config = AmazonConverseConfig() + # Even if headers contain anthropic-beta, non-Anthropic models should NOT get it + headers = {"anthropic-beta": "context-1m-2025-08-07,interleaved-thinking-2025-05-14"} + + # Test with Qwen model (using ARN format like the user's config) + result = config._transform_request_helper( + model="qwen.qwen3-coder-480b-a35b-v1:0", + system_content_blocks=[], + optional_params={}, + messages=[{"role": "user", "content": "Test"}], + headers=headers + ) + + additional_fields = result.get("additionalModelRequestFields", {}) + assert "anthropic_beta" not in additional_fields, ( + "anthropic_beta should NOT be added for non-Anthropic models like Qwen. " + "This field is only supported by Anthropic/Claude models on Bedrock." + ) + + def test_converse_llama_model_no_anthropic_beta(self): + """Test that Llama models do NOT get anthropic_beta in additionalModelRequestFields.""" + config = AmazonConverseConfig() + headers = {"anthropic-beta": "context-1m-2025-08-07"} + + result = config._transform_request_helper( + model="meta.llama3-2-11b-instruct-v1:0", + system_content_blocks=[], + optional_params={}, + messages=[{"role": "user", "content": "Test"}], + headers=headers + ) + + additional_fields = result.get("additionalModelRequestFields", {}) + assert "anthropic_beta" not in additional_fields, ( + "anthropic_beta should NOT be added for Llama models." + ) + + def test_converse_nova_model_no_anthropic_beta(self): + """Test that Amazon Nova models do NOT get anthropic_beta in additionalModelRequestFields.""" + config = AmazonConverseConfig() + headers = {"anthropic-beta": "computer-use-2024-10-22"} + + result = config._transform_request_helper( + model="amazon.nova-pro-v1:0", + system_content_blocks=[], + optional_params={}, + messages=[{"role": "user", "content": "Test"}], + headers=headers + ) + + additional_fields = result.get("additionalModelRequestFields", {}) + assert "anthropic_beta" not in additional_fields, ( + "anthropic_beta should NOT be added for Amazon Nova models." + ) + + def test_converse_anthropic_model_gets_anthropic_beta(self): + """Test that Anthropic models DO get anthropic_beta in additionalModelRequestFields.""" + config = AmazonConverseConfig() + headers = {"anthropic-beta": "context-1m-2025-08-07"} + + result = config._transform_request_helper( + model="anthropic.claude-3-5-sonnet-20241022-v2:0", + system_content_blocks=[], + optional_params={}, + messages=[{"role": "user", "content": "Test"}], + headers=headers + ) + + additional_fields = result.get("additionalModelRequestFields", {}) + assert "anthropic_beta" in additional_fields, ( + "anthropic_beta SHOULD be added for Anthropic models." + ) + assert "context-1m-2025-08-07" in additional_fields["anthropic_beta"] + + def test_converse_anthropic_model_with_cross_region_prefix(self): + """Test that Anthropic models with cross-region prefix still get anthropic_beta.""" + config = AmazonConverseConfig() + headers = {"anthropic-beta": "context-1m-2025-08-07"} + + # Model with 'us.' cross-region prefix + result = config._transform_request_helper( + model="us.anthropic.claude-3-5-sonnet-20241022-v2:0", + system_content_blocks=[], + optional_params={}, + messages=[{"role": "user", "content": "Test"}], + headers=headers + ) + + additional_fields = result.get("additionalModelRequestFields", {}) + assert "anthropic_beta" in additional_fields, ( + "anthropic_beta SHOULD be added for Anthropic models with cross-region prefix." + ) + assert "context-1m-2025-08-07" in additional_fields["anthropic_beta"] From 2cf41d63a6eaa5abcfc7ba4f91c33e6b971ae21a Mon Sep 17 00:00:00 2001 From: Cesar Garcia <128240629+Chesars@users.noreply.github.com> Date: Fri, 5 Dec 2025 20:51:51 -0300 Subject: [PATCH 094/178] fix(gemini): use thought:true instead of thoughtSignature to detect thinking blocks (#17266) The previous implementation incorrectly used `thoughtSignature` as the criterion to detect thinking blocks. However, per Google's docs: - `thought: true` indicates that a part contains reasoning/thinking content - `thoughtSignature` is just a token for multi-turn context preservation (a part can have thoughtSignature without thought:true, e.g., function calls) This caused functionCall data to leak into reasoning_content when using Gemini 2.5 Pro with streaming + tools enabled. Changes: - _extract_thinking_blocks_from_parts now checks `part.get("thought") is True` - Extract actual text content instead of json.dumps(part) - Include signature only when present (optional in Gemini 2.5) Refs: - https://ai.google.dev/gemini-api/docs/thinking - https://ai.google.dev/gemini-api/docs/thought-signatures --- .../vertex_and_google_ai_studio_gemini.py | 34 +++++---- ...test_vertex_and_google_ai_studio_gemini.py | 73 +++++++++++++++++-- 2 files changed, 83 insertions(+), 24 deletions(-) diff --git a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py index e604bd392a6..106074811f6 100644 --- a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py +++ b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py @@ -1085,24 +1085,26 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig): def _extract_thinking_blocks_from_parts( self, parts: List[HttpxPartType] ) -> List[ChatCompletionThinkingBlock]: - """Extract thinking blocks from parts if present""" + """Extract thinking blocks from parts if present. + + Per Google's docs (https://ai.google.dev/gemini-api/docs/thinking): + - Parts with `thought: true` contain thinking/reasoning content + - `thoughtSignature` is a separate token for multi-turn context preservation, + it does NOT indicate that the content is thinking (a part can have + thoughtSignature without thought: true, e.g., function calls) + """ thinking_blocks: List[ChatCompletionThinkingBlock] = [] for part in parts: - if "thoughtSignature" in part: - part_copy = part.copy() - part_copy.pop("thoughtSignature") - - text_content = part_copy.get("text") - if isinstance(text_content, str) and text_content.strip() == "": - continue - - thinking_blocks.append( - ChatCompletionThinkingBlock( - type="thinking", - thinking=json.dumps(part_copy), - signature=part["thoughtSignature"], - ) - ) + if part.get("thought") is True: + thinking_text = part.get("text", "") + block: ChatCompletionThinkingBlock = { + "type": "thinking", + "thinking": thinking_text, + } + signature = part.get("thoughtSignature") + if signature is not None: + block["signature"] = signature + thinking_blocks.append(block) return thinking_blocks def _extract_image_response_from_parts( diff --git a/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py b/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py index 41afec9cd14..7d45ce4091a 100644 --- a/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py +++ b/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py @@ -390,13 +390,13 @@ def test_streaming_chunk_includes_reasoning_content(): ) -def test_streaming_chunk_with_tool_calls_includes_reasoning_content(): +def test_streaming_chunk_with_tool_calls_and_thought_includes_reasoning_content(): """ - Test for issue #16805: Ensure that when Gemini returns a streaming chunk with - tool calls AND thoughtSignature, the reasoning_content is included in the delta. + Test that when Gemini returns a streaming chunk with both thought: true parts + AND tool calls, the reasoning_content is correctly extracted from the thought parts. - Previously, thinking_blocks were only added to non-streaming responses, causing - reasoning_content to be missing in streaming mode when tools were enabled. + Per Google's docs: thought: true indicates reasoning content, NOT thoughtSignature. + thoughtSignature is just a token for multi-turn context preservation. """ from litellm.llms.vertex_ai.gemini.vertex_and_google_ai_studio_gemini import ( ModelResponseIterator, @@ -409,12 +409,16 @@ def test_streaming_chunk_with_tool_calls_includes_reasoning_content(): { "content": { "parts": [ + { + "text": "Let me think about how to get the time...", + "thought": True, # This indicates reasoning content + }, { "functionCall": { "name": "get_current_time", "args": {"timezone": "America/New_York"}, }, - "thoughtSignature": "EsEDCr4DAdHtim...", # Base64 signature + "thoughtSignature": "EsEDCr4DAdHtim...", # Just a token, not reasoning } ] }, @@ -433,8 +437,8 @@ def test_streaming_chunk_with_tool_calls_includes_reasoning_content(): ) streaming_chunk = iterator.chunk_parser(chunk) - # Verify that reasoning_content is present in the streaming delta - assert streaming_chunk.choices[0].delta.reasoning_content is not None + # Verify reasoning_content comes from the thought: true part + assert streaming_chunk.choices[0].delta.reasoning_content == "Let me think about how to get the time..." # Verify tool calls are also present assert streaming_chunk.choices[0].delta.tool_calls is not None @@ -442,6 +446,59 @@ def test_streaming_chunk_with_tool_calls_includes_reasoning_content(): assert streaming_chunk.choices[0].delta.tool_calls[0].function.name == "get_current_time" +def test_streaming_chunk_with_tool_calls_no_thought_no_reasoning_content(): + """ + Test that when Gemini returns tool calls with thoughtSignature but WITHOUT + thought: true, there is NO reasoning_content. + + This is a regression test for the bug where functionCall data was incorrectly + being placed into reasoning_content when thoughtSignature was present. + Per Google's docs: thoughtSignature is just a token for multi-turn, not reasoning. + """ + from litellm.llms.vertex_ai.gemini.vertex_and_google_ai_studio_gemini import ( + ModelResponseIterator, + ) + + litellm_logging = MagicMock() + + chunk = { + "candidates": [ + { + "content": { + "parts": [ + { + "functionCall": { + "name": "get_current_time", + "args": {"timezone": "America/New_York"}, + }, + "thoughtSignature": "EsEDCr4DAdHtim...", # Just a token, NOT thought: true + } + ] + }, + "finishReason": "STOP", + } + ], + "usageMetadata": { + "promptTokenCount": 68, + "candidatesTokenCount": 120, + "totalTokenCount": 188, + }, + } + + iterator = ModelResponseIterator( + streaming_response=[], sync_stream=True, logging_obj=litellm_logging + ) + streaming_chunk = iterator.chunk_parser(chunk) + + # reasoning_content should be None - thoughtSignature alone does NOT mean reasoning + assert getattr(streaming_chunk.choices[0].delta, 'reasoning_content', None) is None + + # Tool calls should still work + assert streaming_chunk.choices[0].delta.tool_calls is not None + assert len(streaming_chunk.choices[0].delta.tool_calls) == 1 + assert streaming_chunk.choices[0].delta.tool_calls[0].function.name == "get_current_time" + + def test_check_finish_reason(): finish_reason_mappings = VertexGeminiConfig.get_finish_reason_mapping() for k, v in finish_reason_mappings.items(): From 852a1fee89754d5f095e2a6e4915bfbc58a1eda3 Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Fri, 5 Dec 2025 15:51:56 -0800 Subject: [PATCH 095/178] Support images in compare UI --- .../playground/compareUI/CompareUI.test.tsx | 69 ++++++++- .../playground/compareUI/CompareUI.tsx | 136 ++++++++++++++---- .../components/MessageDisplay.test.tsx | 29 ++++ .../compareUI/components/MessageDisplay.tsx | 4 +- .../components/MessageInput.test.tsx | 12 ++ .../compareUI/components/MessageInput.tsx | 11 +- 6 files changed, 230 insertions(+), 31 deletions(-) diff --git a/ui/litellm-dashboard/src/components/playground/compareUI/CompareUI.test.tsx b/ui/litellm-dashboard/src/components/playground/compareUI/CompareUI.test.tsx index 1941943a58b..963b7527745 100644 --- a/ui/litellm-dashboard/src/components/playground/compareUI/CompareUI.test.tsx +++ b/ui/litellm-dashboard/src/components/playground/compareUI/CompareUI.test.tsx @@ -2,6 +2,7 @@ import { render, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { beforeEach, describe, expect, it, vi } from "vitest"; import CompareUI from "./CompareUI"; +import { makeOpenAIChatCompletionRequest } from "../llm_calls/chat_completion"; vi.mock("../llm_calls/fetch_models", () => ({ fetchAvailableModels: vi.fn().mockResolvedValue([{ model_group: "gpt-4" }, { model_group: "gpt-3.5-turbo" }]), @@ -11,6 +12,34 @@ vi.mock("../llm_calls/chat_completion", () => ({ makeOpenAIChatCompletionRequest: vi.fn().mockResolvedValue(undefined), })); +let capturedOnImageUpload: ((file: File) => false) | null = null; + +vi.mock("../chat_ui/ChatImageUpload", () => ({ + default: ({ onImageUpload }: { onImageUpload: (file: File) => false }) => { + capturedOnImageUpload = onImageUpload; + return ( +

+ +
+ ); + }, +})); + +vi.mock("../chat_ui/ChatImageUtils", () => ({ + createChatMultimodalMessage: vi.fn().mockResolvedValue({ + role: "user", + content: [ + { type: "text", text: "test message" }, + { type: "image_url", image_url: { url: "data:image/png;base64,test" } }, + ], + }), + createChatDisplayMessage: vi.fn().mockReturnValue({ + role: "user", + content: "test message [Image attached]", + imagePreviewUrl: "blob:test-url", + }), +})); + vi.mock("./components/ComparisonPanel", () => ({ ComparisonPanel: ({ comparison, onRemove }: { comparison: any; onRemove: () => void }) => (
@@ -22,8 +51,9 @@ vi.mock("./components/ComparisonPanel", () => ({ })); vi.mock("./components/MessageInput", () => ({ - MessageInput: ({ value, onChange, onSend, disabled }: any) => ( + MessageInput: ({ value, onChange, onSend, disabled, hasAttachment, uploadComponent }: any) => (
+ {uploadComponent &&
{uploadComponent}
}