Fix confidence score in task actions (#458)

This commit is contained in:
Kerem Yilmaz
2024-06-11 11:29:57 -07:00
committed by GitHub
parent a9e4a06263
commit f3478ffc65
2 changed files with 21 additions and 4 deletions

View File

@@ -187,7 +187,7 @@ export type Option = {
export type ActionApiResponse = {
reasoning: string;
confidence_float: number;
confidence_float?: number;
action_type: ActionType;
text: string | null;
option: Option | null;
@@ -196,7 +196,7 @@ export type ActionApiResponse = {
export type Action = {
reasoning: string;
confidence: number;
confidence?: number;
type: ActionType;
input: string;
success: boolean;

View File

@@ -3,6 +3,12 @@ import { Action, ActionTypes, ReadableActionTypes } from "@/api/types";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { Separator } from "@/components/ui/separator";
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from "@/components/ui/tooltip";
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
import { cn } from "@/util/utils";
import {
@@ -105,9 +111,20 @@ function ScrollableActionList({
<div className="flex gap-2 items-center">
<span>#{index + 1}</span>
<Badge>{ReadableActionTypes[action.type]}</Badge>
<div>{action.confidence}</div>
</div>
<div>
<div className="flex items-center gap-2">
{typeof action.confidence === "number" && (
<TooltipProvider>
<Tooltip>
<TooltipTrigger>
<Badge variant="secondary">
{action.confidence}
</Badge>
</TooltipTrigger>
<TooltipContent>Confidence Score</TooltipContent>
</Tooltip>
</TooltipProvider>
)}
{action.success ? (
<CheckCircledIcon className="w-6 h-6 text-success" />
) : (