Skip to content

Commit 05f3f87

Browse files
committed
Edit edit/delete modals
1 parent df17c53 commit 05f3f87

File tree

7 files changed

+194
-182
lines changed

7 files changed

+194
-182
lines changed

web/src/app/admin/assistants/AssistantEditor.tsx

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ import TextView from "@/components/chat/TextView";
9696
import { MinimalOnyxDocument } from "@/lib/search/interfaces";
9797
import { MAX_CHARACTERS_PERSONA_DESCRIPTION } from "@/lib/constants";
9898
import { FormErrorFocus } from "@/components/FormErrorHelpers";
99+
import { useAgentsContext } from "@/components-2/context/AgentsContext";
99100

100101
function findSearchTool(tools: ToolSnapshot[]) {
101102
return tools.find((tool) => tool.in_code_tool_id === SEARCH_TOOL_ID);
@@ -122,6 +123,17 @@ function SubLabel({ children }: { children: string | JSX.Element }) {
122123
);
123124
}
124125

126+
interface AssistantEditorProps {
127+
existingPersona?: FullPersona | null;
128+
ccPairs: CCPairBasicInfo[];
129+
documentSets: DocumentSetSummary[];
130+
user: User | null;
131+
defaultPublic: boolean;
132+
llmProviders: LLMProviderView[];
133+
tools: ToolSnapshot[];
134+
shouldAddAssistantToUserPreferences?: boolean;
135+
}
136+
125137
export function AssistantEditor({
126138
existingPersona,
127139
ccPairs,
@@ -131,17 +143,9 @@ export function AssistantEditor({
131143
llmProviders,
132144
tools,
133145
shouldAddAssistantToUserPreferences,
134-
}: {
135-
existingPersona?: FullPersona | null;
136-
ccPairs: CCPairBasicInfo[];
137-
documentSets: DocumentSetSummary[];
138-
user: User | null;
139-
defaultPublic: boolean;
140-
llmProviders: LLMProviderView[];
141-
tools: ToolSnapshot[];
142-
shouldAddAssistantToUserPreferences?: boolean;
143-
}) {
144-
const { refreshAssistants } = useAssistantsContext();
146+
}: AssistantEditorProps) {
147+
// const { refreshAssistants } = useAssistantsContext();
148+
const { refreshAgents } = useAgentsContext();
145149

146150
const router = useRouter();
147151
const searchParams = useSearchParams();
@@ -452,7 +456,7 @@ export function AssistantEditor({
452456
if (existingPersona) {
453457
const response = await deletePersona(existingPersona.id);
454458
if (response.ok) {
455-
await refreshAssistants();
459+
await refreshAgents();
456460
router.push(
457461
isAdminPage ? `/admin/assistants?u=${Date.now()}` : `/chat`
458462
);
@@ -703,7 +707,7 @@ export function AssistantEditor({
703707
message: `"${assistant.name}" has been added to your list.`,
704708
type: "success",
705709
});
706-
await refreshAssistants();
710+
await refreshAgents();
707711
} else {
708712
setPopup({
709713
message: `"${assistant.name}" could not be added to your list.`,
@@ -712,7 +716,7 @@ export function AssistantEditor({
712716
}
713717
}
714718

715-
await refreshAssistants();
719+
await refreshAgents();
716720
await refreshFolders();
717721

718722
router.push(
@@ -787,7 +791,7 @@ export function AssistantEditor({
787791
Edit assistant <b>{existingPersona.name}</b>
788792
</>
789793
) : (
790-
"Create an Assistant"
794+
"Create an Agent"
791795
)}
792796
</p>
793797
<div className="max-w-4xl w-full">

web/src/components-2/Button.tsx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
"use client";
2+
3+
import React from "react";
4+
import Text from "@/components-2/Text";
5+
6+
const variantClasses = {
7+
secondary: "bg-background-tint-01 hover:bg-background-tint-02",
8+
danger: "bg-action-danger-05 hover:bg-action-danger-04",
9+
} as const;
10+
11+
interface ButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
12+
secondary?: boolean;
13+
danger?: boolean;
14+
}
15+
16+
export default function Button({
17+
children,
18+
className,
19+
secondary,
20+
danger,
21+
...props
22+
}: ButtonProps) {
23+
const variant = danger ? "danger" : secondary ? "secondary" : "secondary";
24+
25+
return (
26+
<button
27+
className={`p-spacing-interline rounded-08 border ${variantClasses[variant]} ${className}`}
28+
{...props}
29+
>
30+
{typeof children === "string" ? <Text>{children}</Text> : children}
31+
</button>
32+
);
33+
}

web/src/components-2/modals/Modal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export default function Modal({
5252
<div className="border-b" />
5353

5454
{/* Content area */}
55-
<div className="flex-1 p-padding-block-end overflow-scroll">
55+
<div className="flex-1 m-padding-block-end overflow-scroll">
5656
{children}
5757
</div>
5858
</div>

web/src/icons/bar-chart.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const SvgBarChart = (props: SVGProps<SVGSVGElement>) => (
99
>
1010
<path
1111
d="M12 13.3333V6.66666M8 13.3333V2.66666M4 13.3333V9.33332"
12-
strokeOpacity={0.8}
1312
strokeWidth={1.5}
1413
strokeLinecap="round"
1514
strokeLinejoin="round"

0 commit comments

Comments
 (0)