Skip to content

Commit f851d8b

Browse files
committed
fix: show config errors for selected assistant, remove duplicate fatal error
1 parent bf9ba15 commit f851d8b

File tree

2 files changed

+47
-40
lines changed

2 files changed

+47
-40
lines changed

gui/src/components/Layout.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { saveCurrentSession } from "../redux/thunks/session";
1616
import { fontSize, isMetaEquivalentKeyPressed } from "../util";
1717
import { incrementFreeTrialCount } from "../util/freeTrial";
1818
import { ROUTES } from "../util/navigation";
19+
import { FatalErrorIndicator } from "./config/FatalErrorNotice";
1920
import TextDialog from "./dialogs";
2021
import { GenerateRuleDialog } from "./GenerateRuleDialog";
2122
import { useMainEditor } from "./mainInput/TipTapEditor";
@@ -26,7 +27,6 @@ import {
2627
} from "./OnboardingCard";
2728
import OSRContextMenu from "./OSRContextMenu";
2829
import PostHogPageView from "./PosthogPageView";
29-
import { FatalErrorIndicator } from "./config/FatalErrorNotice";
3030

3131
const LayoutTopDiv = styled(CustomScrollbarDiv)`
3232
height: 100%;
@@ -280,7 +280,8 @@ const Layout = () => {
280280
<GridDiv>
281281
<PostHogPageView />
282282
<Outlet />
283-
<FatalErrorIndicator />
283+
{/* The fatal error for chat is shown below input */}
284+
{location.pathname !== "/" && <FatalErrorIndicator />}
284285
</GridDiv>
285286
</div>
286287
<div style={{ fontSize: fontSize(-4) }} id="tooltip-portal-div" />

gui/src/pages/config/sections/AgentsSection.tsx

Lines changed: 44 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ import { ToolTip } from "../../../components/gui/Tooltip";
55
import { Button, Card, Divider, EmptyState } from "../../../components/ui";
66
import { useAuth } from "../../../context/Auth";
77
import { IdeMessengerContext } from "../../../context/IdeMessenger";
8+
import { useAppSelector } from "../../../redux/hooks";
89
import { ConfigHeader } from "../components/ConfigHeader";
910

1011
export function AgentsSection() {
11-
const { profiles } = useAuth();
12+
const { profiles, selectedProfile } = useAuth();
1213
const ideMessenger = useContext(IdeMessengerContext);
14+
const configError = useAppSelector((state) => state.config.configError);
1315

1416
function handleAddAgent() {
1517
void ideMessenger.request("config/newAssistantFile", undefined);
@@ -29,47 +31,51 @@ export function AgentsSection() {
2931

3032
<Card>
3133
{profiles && profiles.length > 0 ? (
32-
profiles.map((profile, index) => (
33-
<div key={profile.id}>
34-
<div className="flex items-center justify-between">
35-
<div className="flex items-baseline gap-3">
36-
<div className="flex h-6 w-6 flex-shrink-0 items-center justify-center">
37-
<AssistantIcon assistant={profile} />
34+
profiles.map((profile, index) => {
35+
const isSelected = profile.id === selectedProfile?.id;
36+
const errors = isSelected ? configError : profile.errors;
37+
return (
38+
<div key={profile.id}>
39+
<div className="flex items-center justify-between">
40+
<div className="flex items-baseline gap-3">
41+
<div className="flex h-6 w-6 flex-shrink-0 items-center justify-center">
42+
<AssistantIcon assistant={profile} />
43+
</div>
44+
<div className="flex-1">
45+
<h3
46+
className={`my-2 text-sm font-medium ${errors && errors.length > 0 ? "text-error" : ""}`}
47+
>
48+
{profile.title}
49+
</h3>
50+
{errors && errors.length > 0 && (
51+
<div className="mt-2 space-y-1">
52+
{errors.map((error, errorIndex) => (
53+
<div
54+
key={errorIndex}
55+
className="text-error bg-error/10 rounded py-1 pr-2 text-xs"
56+
>
57+
{error.message}
58+
</div>
59+
))}
60+
</div>
61+
)}
62+
</div>
3863
</div>
39-
<div className="flex-1">
40-
<h3
41-
className={`my-2 text-sm font-medium ${profile.errors && profile.errors.length > 0 ? "text-error" : ""}`}
64+
<ToolTip content="Configure agent">
65+
<Button
66+
onClick={() => handleConfigureAgent(profile.id)}
67+
variant="ghost"
68+
size="sm"
69+
className="text-description-muted hover:enabled:text-foreground my-0 h-6 w-6 p-0"
4270
>
43-
{profile.title}
44-
</h3>
45-
{profile.errors && profile.errors.length > 0 && (
46-
<div className="mt-2 space-y-1">
47-
{profile.errors.map((error, errorIndex) => (
48-
<div
49-
key={errorIndex}
50-
className="text-error bg-error/10 rounded py-1 pr-2 text-xs"
51-
>
52-
{error.message}
53-
</div>
54-
))}
55-
</div>
56-
)}
57-
</div>
71+
<Cog6ToothIcon className="h-4 w-4 flex-shrink-0" />
72+
</Button>
73+
</ToolTip>
5874
</div>
59-
<ToolTip content="Configure agent">
60-
<Button
61-
onClick={() => handleConfigureAgent(profile.id)}
62-
variant="ghost"
63-
size="sm"
64-
className="text-description-muted hover:enabled:text-foreground my-0 h-6 w-6 p-0"
65-
>
66-
<Cog6ToothIcon className="h-4 w-4 flex-shrink-0" />
67-
</Button>
68-
</ToolTip>
75+
{index < profiles.length - 1 && <Divider />}
6976
</div>
70-
{index < profiles.length - 1 && <Divider />}
71-
</div>
72-
))
77+
);
78+
})
7379
) : (
7480
<EmptyState message="No agents configured. Click the + button to add your first agent." />
7581
)}

0 commit comments

Comments
 (0)