Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ux improvements #3947

Merged
merged 6 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions backend/onyx/db/persona.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ def create_update_persona(
num_chunks=create_persona_request.num_chunks,
llm_relevance_filter=create_persona_request.llm_relevance_filter,
llm_filter_extraction=create_persona_request.llm_filter_extraction,
is_default_persona=create_persona_request.is_default_persona,
)

versioned_make_persona_private = fetch_versioned_implementation(
Expand Down
129 changes: 46 additions & 83 deletions web/src/app/assistants/mine/AssistantCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import {
PopoverContent,
} from "@/components/ui/popover";
import { AssistantIcon } from "@/components/assistants/AssistantIcon";
import { AssistantVisibilityPopover } from "./AssistantVisibilityPopover";
import { DeleteAssistantPopover } from "./DeleteAssistantPopover";
import { Persona } from "@/app/admin/assistants/interfaces";
import { useUser } from "@/components/user/UserProvider";
import { useAssistants } from "@/components/context/AssistantsContext";
Expand Down Expand Up @@ -149,14 +147,9 @@ const AssistantCard: React.FC<{
)}
</div>
{isOwnedByUser && (
<div className="flex ml-2 items-center gap-x-2">
<Popover
open={activePopover !== undefined}
onOpenChange={(open) =>
open ? setActivePopover(null) : setActivePopover(undefined)
}
>
<PopoverTrigger asChild>
<div className="flex ml-2 relative items-center gap-x-2">
<Popover modal>
<PopoverTrigger>
<button
type="button"
className="hover:bg-neutral-200 dark:hover:bg-neutral-700 p-1 -my-1 rounded-full"
Expand All @@ -165,86 +158,56 @@ const AssistantCard: React.FC<{
</button>
</PopoverTrigger>
<PopoverContent
className={`z-[1000000] ${
activePopover === null ? "w-32" : "w-80"
} p-2`}
className={`w-32 z-[10000] p-2 hover:bg-red-400`}
>
{activePopover === null && (
<div className="flex flex-col text-sm space-y-1">
<div className="flex flex-col text-sm space-y-1">
<button
onClick={isOwnedByUser ? handleEdit : undefined}
className={`w-full flex items-center text-left px-2 py-1 rounded ${
isOwnedByUser
? "hover:bg-neutral-200 dark:hover:bg-neutral-700"
: "opacity-50 cursor-not-allowed"
}`}
disabled={!isOwnedByUser}
>
<FiEdit size={12} className="inline mr-2" />
Edit
</button>
{isPaidEnterpriseFeaturesEnabled && isOwnedByUser && (
<button
onClick={isOwnedByUser ? handleEdit : undefined}
className={`w-full flex items-center text-left px-2 py-1 rounded ${
onClick={
isOwnedByUser
? "hover:bg-neutral-200 dark:hover:bg-neutral-700"
: "opacity-50 cursor-not-allowed"
}`}
disabled={!isOwnedByUser}
>
<FiEdit size={12} className="inline mr-2" />
Edit
</button>
{isPaidEnterpriseFeaturesEnabled && isOwnedByUser && (
<button
onClick={
isOwnedByUser
? () => {
router.push(
`/assistants/stats/${persona.id}`
);
closePopover();
}
: undefined
}
className={`w-full text-left items-center px-2 py-1 rounded ${
isOwnedByUser
? "hover:bg-neutral-200 dark:hover:bg-neutral-800"
: "opacity-50 cursor-not-allowed"
}`}
disabled={!isOwnedByUser}
>
<FiBarChart size={12} className="inline mr-2" />
Stats
</button>
)}
<button
onClick={isOwnedByUser ? handleDelete : undefined}
className={`w-full text-left items-center px-2 py-1 rounded ${
? () => {
router.push(
`/assistants/stats/${persona.id}`
);
closePopover();
}
: undefined
}
className={`w-full text-left items-center px-2 py-1 rounded ${
isOwnedByUser
? "hover:bg-neutral-200 dark:hover:bg-neutral- text-red-600 dark:text-red-400"
: "opacity-50 cursor-not-allowed text-red-300 dark:text-red-500"
? "hover:bg-neutral-200 dark:hover:bg-neutral-800"
: "opacity-50 cursor-not-allowed"
}`}
disabled={!isOwnedByUser}
>
<FiTrash size={12} className="inline mr-2" />
Delete
<FiBarChart size={12} className="inline mr-2" />
Stats
</button>
</div>
)}
{activePopover === "visibility" && (
<AssistantVisibilityPopover
assistant={persona}
user={user}
allUsers={[]}
onClose={closePopover}
onTogglePublic={async (isPublic: boolean) => {
await togglePersonaPublicStatus(persona.id, isPublic);
await refreshAssistants();
}}
/>
)}
{activePopover === "delete" && (
<DeleteAssistantPopover
entityName={persona.name}
onClose={closePopover}
onSubmit={async () => {
const success = await deletePersona(persona.id);
if (success) {
await refreshAssistants();
}
closePopover();
}}
/>
)}
)}
<button
onClick={isOwnedByUser ? handleDelete : undefined}
className={`w-full text-left items-center px-2 py-1 rounded ${
isOwnedByUser
? "hover:bg-neutral-200 dark:hover:bg-neutral- text-red-600 dark:text-red-400"
: "opacity-50 cursor-not-allowed text-red-300 dark:text-red-500"
}`}
disabled={!isOwnedByUser}
>
<FiTrash size={12} className="inline mr-2" />
Delete
</button>
</div>
</PopoverContent>
</Popover>
</div>
Expand Down
6 changes: 3 additions & 3 deletions web/src/app/assistants/mine/AssistantModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export function AssistantModal({
return (
<Dialog open={true} onOpenChange={(open) => !open && hideModal()}>
<DialogContent
className="p-0 max-h-[80vh] max-w-none w-[95%] bg-background rounded-sm shadow-2xl transform transition-all duration-300 ease-in-out relative w-11/12 max-w-4xl pt-10 pb-10 px-10 overflow-hidden flex flex-col max-w-4xl"
className="p-0 max-h-[80vh] max-w-none w-[95%] bg-background rounded-sm shadow-2xl transform transition-all duration-300 ease-in-out relative w-11/12 max-w-4xl pt-10 pb-10 px-10 flex flex-col max-w-4xl"
style={{
position: "fixed",
top: "10vh",
Expand All @@ -127,7 +127,7 @@ export function AssistantModal({
margin: 0,
}}
>
<div className="flex den flex-col h-full">
<div className="flex overflow-hidden flex-col h-full">
<div className="flex flex-col sticky top-0 z-10">
<div className="flex px-2 justify-between items-center gap-x-2 mb-0">
<div className="h-12 w-full rounded-lg flex-col justify-center items-start gap-2.5 inline-flex">
Expand Down Expand Up @@ -205,7 +205,7 @@ export function AssistantModal({
Featured Assistants
</h2>

<div className="w-full px-2 pb-2 grid grid-cols-1 md:grid-cols-2 gap-x-6 gap-y-6">
<div className="w-full px-2 pb-10 grid grid-cols-1 md:grid-cols-2 gap-x-6 gap-y-6">
{featuredAssistants.length > 0 ? (
featuredAssistants.map((assistant, index) => (
<div key={index}>
Expand Down
198 changes: 0 additions & 198 deletions web/src/app/assistants/mine/AssistantVisibilityPopover.tsx

This file was deleted.

Loading
Loading