refactor(chat-ui): reuse shared LogEntry type in logs panel - #33858
refactor(chat-ui): reuse shared LogEntry type in logs panel#33858devin-ai-integration[bot] wants to merge 1 commit into
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
|
Greptile SummaryThis PR eliminates the duplicate
Confidence Score: 5/5Safe to merge — the change is confined to a single TypeScript import and interface substitution with no runtime effect. Every field accessed by LogsPanel.tsx is present in LogEntry with compatible types. The removed LogRow was a strict subset of LogEntry, so no consumer is narrowed in a way that would cause a type error or behavioral difference. The only material difference is that LogEntry carries additional required fields the old interface omitted, but those fields are already present in the actual API responses since both panels share the same endpoint. No files require special attention.
|
| Filename | Overview |
|---|---|
| ui/litellm-dashboard/src/components/chat/LogsPanel.tsx | Removes local LogRow interface and replaces all references with the shared LogEntry type from view_logs/columns; no runtime or behavior change |
Reviews (1): Last reviewed commit: "refactor(chat-ui): reuse shared LogEntry..." | Re-trigger Greptile
Relevant issues
Follow-up to #33829 (merged), addressing review feedback from @ryan-crabbe-berri
Linear ticket
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
@greptileaito re-request a review after pushing changes)Screenshots / Proof of Fix
Type-only refactor with no runtime or behavior change; the existing
LogsPanel.test.tsxsuite (user scoping, row/empty/error states, lazy detail load,proxy_server_requestfallback) still passes andfrontend-lint/build-uistay greenType
🧹 Refactoring
Changes
Follow-up to review feedback on #33829: the chat Logs panel hand-rolled its own
LogRowinterface for the/spend/logs/uirows. This reuses the sharedLogEntrytype that the main Spend Logs UI already defines inview_logs/columns.tsx, so the row shape lives in one place instead of being duplicatedNote on why not the generated
schema.d.tstype directly: the reviewer asked about pulling fromschema.d.ts. The generatedcomponents["schemas"]["LiteLLM_SpendLogs"]exists but does not fully fit this table today; it omitsstatus,request_duration_ms, andcustom_llm_provider(which the endpoint returns and the table renders), and it types the/spend/logs/uiresponse as a bareLiteLLM_SpendLogs[]rather than the paginated{ data, total, page, page_size, total_pages }wrapper the endpoint actually returns. That mismatch is exactly why the main log UI maintains the hand-writtenLogEntry. ReusingLogEntryremoves the duplication now; makingschema.d.tsthe single source of truth would additionally require fixing the backend Pydantic response model (add the missing fields, model the pagination wrapper) and regenerating types, which is a larger, separate changeFinal Attestation
Link to Devin session: https://app.devin.ai/sessions/d8f28b85a07e42fba149e7e51169bf0a
Requested by: @krrish-berri-2