litellm/ui/litellm-dashboard/src/components/prompts
yuneng-jiang eeab8705a1 [Refactor] UI: Remove 38 unused files detected by knip
Dead code cleanup — these files had no imports from any active entry points.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-19 22:07:41 -08:00
..
prompt_editor_view fix Prompt Studio history to load tools and system messages (#19920) 2026-01-28 17:19:59 -08:00
add_prompt_form.tsx removing unused imports 2025-10-10 10:24:57 -07:00
prompt_editor_view.tsx [Feat] Prompt Management - Add UI for editing the prompts (#16853) 2025-11-19 16:26:11 -08:00
prompt_info.tsx [Feat] UI - Show "get code" section for prompt management + minor polish of showing version history (#16941) 2025-11-21 14:00:33 -08:00
prompt_table.tsx [Fix] Prompt Management - UI, allow seeing model, prompt id for Prompt (#16932) 2025-11-21 13:59:54 -08:00
prompt_utils.tsx [Feat] UI - Show "get code" section for prompt management + minor polish of showing version history (#16941) 2025-11-21 14:00:33 -08:00
README.md added and ran prettier autoformatter 2025-10-04 18:19:48 -07:00
tool_modal.tsx [Feat] Prompt Management - Add UI for editing the prompts (#16853) 2025-11-19 16:26:11 -08:00
variable_textarea.tsx [Feat] Prompt Management - Add UI for editing the prompts (#16853) 2025-11-19 16:26:11 -08:00

Prompts Component

This component provides a view-only interface for viewing prompts in the LiteLLM dashboard, similar to the guardrails component.

Components

PromptsPanel (prompts.tsx)

  • Main component that displays the prompts list
  • Fetches prompts using the getPromptsList API call
  • Handles loading states and error handling

PromptTable (prompt_table.tsx)

  • Table component that displays prompts data
  • Uses Tanstack Table for sorting and filtering
  • Shows: Prompt ID, Created At, Updated At, Type
  • Supports clicking on prompt IDs to open detailed view

PromptInfoView (prompt_info.tsx)

  • Detail view component for individual prompts
  • Shows comprehensive prompt information including metadata and parameters
  • Three-tab interface: Overview, Details (admin-only), and Raw JSON
  • Overview: Shows formatted prompt information with key details
  • Details: Shows structured breakdown of all prompt data (admin users only)
  • Raw JSON: Shows exactly what the API returns with copy-to-clipboard functionality
  • Includes copy-to-clipboard functionality for prompt ID and raw JSON
  • Similar structure to GuardrailInfoView component

Usage

The component is integrated into the main application at:

  • Navigation: Available in the left sidebar under "Experimental" > "Prompts" (admin role required)
  • Routing: Accessible via ?page=prompts URL parameter
  • API: Uses getPromptsList and getPromptInfo functions from networking.tsx
  • Detail View: Click any prompt ID to view detailed information

Props

interface PromptsProps {
  accessToken: string | null;
  userRole?: string;
}

Data Structure

The component expects prompts with the following structure:

interface PromptItem {
  prompt_id?: string;
  prompt_name: string | null;
  prompt_info: Record<string, any>;
  created_at?: string;
  updated_at?: string;
}

Integration

The component is fully integrated into the main application:

  1. Left Navigation: Added to leftnav.tsx with FileTextOutlined icon
  2. Main Routing: Added to page.tsx with proper routing logic
  3. Permissions: Restricted to admin roles (same as guardrails)

Future Enhancements

  • ✅ Add prompt detail view (similar to GuardrailInfoView) - COMPLETED
  • Add create/edit/delete functionality
  • Add bulk operations
  • Add search and filtering capabilities
  • Add export functionality