Skip to content

Commit

Permalink
Applied Pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas committed Dec 9, 2024
1 parent f88e5ee commit 5274870
Showing 1 changed file with 21 additions and 25 deletions.
46 changes: 21 additions & 25 deletions front/components/assistant/AssistantDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,19 @@ export function AssistantDetails({
);

const TabsSection = () => (
<Tabs defaultValue="feedback">
<Tabs defaultValue="info">
<TabsList>
<TabsTrigger value="info" label="Info" icon={InformationCircleIcon} />
<TabsTrigger value="feedback" label="Feedback" icon={HandThumbUpIcon} />
<TabsTrigger
value="performance"
label="Performance"
icon={HandThumbUpIcon}
/>
</TabsList>
<TabsContent value="info">
<InfoSection />
</TabsContent>
<TabsContent value="feedback">
<TabsContent value="performance">
<FeedbacksSection />
</TabsContent>
</Tabs>
Expand Down Expand Up @@ -200,7 +204,7 @@ export function AssistantDetails({
<div className="mt-3 text-sm text-element-900">No feedbacks.</div>
) : (
<div className="mt-3">
<ConfigVersionHeader
<AgentConfigurationVersionHeader
agentConfiguration={agentConfiguration}
agentConfigurationVersion={agentConfiguration.version}
isLatestVersion={true}
Expand All @@ -210,7 +214,7 @@ export function AssistantDetails({
{index > 0 &&
feedback.agentConfigurationVersion !==
sortedFeedbacks[index - 1].agentConfigurationVersion && (
<ConfigVersionHeader
<AgentConfigurationVersionHeader
agentConfiguration={agentConfigurationHistory?.find(
(c) => c.version === feedback.agentConfigurationVersion
)}
Expand Down Expand Up @@ -245,7 +249,7 @@ export function AssistantDetails({
);
}

function ConfigVersionHeader({
function AgentConfigurationVersionHeader({
agentConfigurationVersion,
agentConfiguration,
isLatestVersion,
Expand All @@ -254,20 +258,17 @@ function ConfigVersionHeader({
agentConfiguration: LightAgentConfigurationType | undefined;
isLatestVersion: boolean;
}) {
const getStringRepresentation = useCallback(
const getAgentConfigurationVersionString = useCallback(
(config: LightAgentConfigurationType) => {
const dateFormatter = new Intl.DateTimeFormat(navigator.language, {
year: "numeric",
month: "short",
day: "numeric",
hour: "numeric",
minute: "numeric",
});
return isLatestVersion
? "Latest Version"
: config.versionCreatedAt
? dateFormatter.format(new Date(config.versionCreatedAt))
: `v${config.version}`;
: !config.versionCreatedAt
? `v${config.version}`
: new Date(config.versionCreatedAt).toLocaleDateString("en-US", {
year: "numeric",
month: "long",
day: "numeric",
});
},
[isLatestVersion]
);
Expand All @@ -276,7 +277,7 @@ function ConfigVersionHeader({
<div className="flex items-center gap-2">
<Page.H variant="h6">
{agentConfiguration
? getStringRepresentation(agentConfiguration)
? getAgentConfigurationVersionString(agentConfiguration)
: `v${agentConfigurationVersion}`}
</Page.H>
</div>
Expand All @@ -295,20 +296,15 @@ function FeedbackCard({
workspaceId: owner.sId,
feedbackId: feedback.id.toString(),
});

const baseUrl =
process.env.NODE_ENV === "development"
? "http://localhost:3000"
: "https://dust.tt";
const conversationUrl = `${baseUrl}/w/${owner.sId}/assistant/${conversationId}`;
const conversationUrl = `${process.env.NEXT_PUBLIC_DUST_CLIENT_FACING_URL}/w/${owner.sId}/assistant/${conversationId}`;

return (
<ContentMessage variant="slate" className="my-2">
<div className="justify-content-around mb-3 flex items-center gap-2">
<div className="flex w-full items-center gap-2">
<Avatar
size="xs"
visual={userDetails?.image}
visual={userDetails?.image || undefined}
name={userDetails?.firstName || "?"}
/>
{userDetails?.firstName} {userDetails?.lastName}
Expand Down

0 comments on commit 5274870

Please sign in to comment.