mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-05 02:41:56 +00:00
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> |
||
|---|---|---|
| .. | ||
| prompt_editor_view | ||
| add_prompt_form.tsx | ||
| prompt_editor_view.tsx | ||
| prompt_info.tsx | ||
| prompt_table.tsx | ||
| prompt_utils.tsx | ||
| README.md | ||
| tool_modal.tsx | ||
| variable_textarea.tsx | ||
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
getPromptsListAPI 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=promptsURL parameter - API: Uses
getPromptsListandgetPromptInfofunctions fromnetworking.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:
- Left Navigation: Added to
leftnav.tsxwithFileTextOutlinedicon - Main Routing: Added to
page.tsxwith proper routing logic - 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