feat: enhance tool display names for better user experience in chat UI

This commit is contained in:
DESKTOP-RTLN3BA\$punk 2026-04-29 07:40:11 -07:00
parent c110f5b955
commit 9a114a2d45
7 changed files with 267 additions and 32 deletions

View file

@ -37,6 +37,7 @@ import {
AlertDialogTrigger,
} from "@/components/ui/alert-dialog";
import { Button } from "@/components/ui/button";
import { getToolDisplayName } from "@/contracts/enums/toolIcons";
import {
agentActionsApiService,
type RevertTurnActionResult,
@ -48,10 +49,6 @@ interface RevertTurnButtonProps {
chatTurnId: string | null | undefined;
}
function formatToolName(name: string): string {
return name.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
}
// Empty-array sentinel so the per-turn ``selectAtom`` slice returns a
// stable reference when the turn has no recorded actions yet. Without
// this every render allocates a fresh ``[]`` and Jotai's
@ -218,7 +215,7 @@ function RevertResultRow({ result }: { result: RevertTurnActionResult }) {
/>
<div className="min-w-0 flex-1">
<p className="font-medium truncate">
{formatToolName(result.tool_name)}{" "}
{getToolDisplayName(result.tool_name)}{" "}
<span className="ml-1 text-xs text-muted-foreground">
{result.status.replace(/_/g, " ")}
</span>