mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-07 02:59:05 +00:00
Update litellm/proxy/spend_tracking/spend_management_endpoints.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
This commit is contained in:
parent
ae44022a40
commit
b29c0bfb8f
1 changed files with 5 additions and 1 deletions
|
|
@ -1928,6 +1928,10 @@ async def ui_view_spend_logs( # noqa: PLR0915
|
|||
sql_params.append(f"%{error_message}%")
|
||||
p += 1
|
||||
|
||||
# Quote column names that need quoting in SQL
|
||||
_sql_col = f'"{order_column}"' if order_column in ("startTime", "endTime") else order_column
|
||||
_sql_dir = "ASC" if order_direction == "asc" else "DESC"
|
||||
|
||||
sql_query = f"""
|
||||
SELECT
|
||||
request_id, call_type, api_key, spend, total_tokens,
|
||||
|
|
@ -1939,7 +1943,7 @@ async def ui_view_spend_logs( # noqa: PLR0915
|
|||
session_id, status, mcp_namespaced_tool_name, agent_id
|
||||
FROM "LiteLLM_SpendLogs"
|
||||
WHERE {" AND ".join(sql_conditions)}
|
||||
ORDER BY "startTime" DESC
|
||||
ORDER BY {_sql_col} {_sql_dir}
|
||||
LIMIT ${p} OFFSET ${p + 1}
|
||||
"""
|
||||
sql_params.extend([page_size, skip])
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue