mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-10 03:28:53 +00:00
ui fix column on request logs page
This commit is contained in:
parent
b1bcd0d254
commit
e4fda2a60d
1 changed files with 32 additions and 33 deletions
|
|
@ -77,37 +77,23 @@ export const columns: ColumnDef<LogEntry>[] = [
|
|||
accessorKey: "metadata.user_api_key_team_alias",
|
||||
cell: (info: any) => <span>{String(info.getValue() || "-")}</span>,
|
||||
},
|
||||
{
|
||||
header: "Key Hash",
|
||||
accessorKey: "metadata.user_api_key",
|
||||
cell: (info: any) => {
|
||||
const value = String(info.getValue() || "-");
|
||||
return (
|
||||
<Tooltip title={value}>
|
||||
<span className="font-mono">{value.slice(0, 5)}...</span>
|
||||
</Tooltip>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
header: "Key Name",
|
||||
accessorKey: "metadata.user_api_key_alias",
|
||||
cell: (info: any) => <span>{String(info.getValue() || "-")}</span>,
|
||||
},
|
||||
{
|
||||
header: "Request",
|
||||
accessorKey: "messages",
|
||||
cell: (info: any) => {
|
||||
const messages = info.getValue();
|
||||
try {
|
||||
const content =
|
||||
typeof messages === "string" ? JSON.parse(messages) : messages;
|
||||
let displayText = "";
|
||||
|
||||
if (Array.isArray(content)) {
|
||||
displayText = formatMessage(content[0]?.content);
|
||||
} else {
|
||||
displayText = formatMessage(content);
|
||||
}
|
||||
|
||||
return <span className="truncate block w-[200px] text-sm">{displayText}</span>;
|
||||
} catch (e) {
|
||||
return (
|
||||
<span className="truncate block w-[200px] text-sm">
|
||||
{formatMessage(messages)}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
header: "Model",
|
||||
accessorKey: "model",
|
||||
|
|
@ -176,16 +162,29 @@ export const columns: ColumnDef<LogEntry>[] = [
|
|||
cell: (info: any) => {
|
||||
const tags = info.getValue();
|
||||
if (!tags || Object.keys(tags).length === 0) return "-";
|
||||
|
||||
const tagEntries = Object.entries(tags);
|
||||
const firstTag = tagEntries[0];
|
||||
const remainingTags = tagEntries.slice(1);
|
||||
|
||||
return (
|
||||
<div className="flex flex-wrap gap-1">
|
||||
{Object.entries(tags).map(([key, value]) => (
|
||||
<span
|
||||
key={key}
|
||||
className="px-2 py-1 bg-gray-100 rounded-full text-xs"
|
||||
>
|
||||
{key}: {String(value)}
|
||||
<Tooltip
|
||||
title={
|
||||
<div className="flex flex-col gap-1">
|
||||
{tagEntries.map(([key, value]) => (
|
||||
<span key={key}>
|
||||
{key}: {String(value)}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<span className="px-2 py-1 bg-gray-100 rounded-full text-xs">
|
||||
{firstTag[0]}: {String(firstTag[1])}
|
||||
{remainingTags.length > 0 && ` +${remainingTags.length}`}
|
||||
</span>
|
||||
))}
|
||||
</Tooltip>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue