Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
feat(ui): Phase 3 - PricingConfigModal/MasterSkillEditor overlays
trohitg11ea62eb036b
diff --git a/client/src/components/PricingConfigModal.tsx b/client/src/components/PricingConfigModal.tsxindex bc16feec..7c287742 100644--- a/client/src/components/PricingConfigModal.tsx+++ b/client/src/components/PricingConfigModal.tsx@@ -4,8 +4,15 @@*/import React, { useState, useEffect, useCallback } from 'react';-import { Button, Tabs, InputNumber, Collapse } from 'antd';+import { Button, InputNumber } from 'antd';import { Loader2 } from 'lucide-react';+import {+ Accordion,+ AccordionItem,+ AccordionTrigger,+ AccordionContent,+} from '@/components/ui/accordion';+import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs';import { toast } from 'sonner';import {SaveOutlined,@@ -243,11 +250,8 @@ const PricingConfigModal: React.FC<Props> = ({ visible, onClose }) => {const providers = Object.keys(config.llm).sort();return (- <Collapse- defaultActiveKey={providers.slice(0, 2)}- style={{ background: 'transparent' }}- >- {providers.map(provider => {+ <Accordion type="multiple" defaultValue={providers.slice(0, 2)} className="bg-transparent">+ {providers.map((provider) => {const models = config.llm[provider];const modelNames = Object.keys(models).sort((a, b) => {if (a === '_default') return 1;@@ -256,33 +260,33 @@ const PricingConfigModal: React.FC<Props> = ({ visible, onClose }) => {});return (- <Collapse.Panel- key={provider}- header={- <span style={{ textTransform: 'capitalize', fontWeight: 500 }}>+ <AccordionItem key={provider} value={provider}>+ <AccordionTrigger>+ <span className="font-medium capitalize">{provider}- <span style={{ marginLeft: 8, fontSize: 12, color: theme.colors.textSecondary }}>+ <span className="ml-2 text-xs text-muted-foreground">({modelNames.length} models)</span></span>- }- >- <div style={{ fontSize: 11, color: theme.colors.textSecondary, padding: '4px 12px' }}>- Prices in USD per million tokens (MTok)- </div>- {modelNames.map(model => (- <LLMModelRow- key={model}- model={model}- pricing={models[model]}- onChange={(field, value) => updateLLMPricing(provider, model, field, value)}- theme={theme}- />- ))}- </Collapse.Panel>+ </AccordionTrigger>+ <AccordionContent>+ <div className="px-3 py-1 text-[11px] text-muted-foreground">+ Prices in USD per million tokens (MTok)+ </div>+ {modelNames.map((model) => (+ <LLMModelRow+ key={model}+ model={model}+ pricing={models[model]}+ onChange={(field, value) => updateLLMPricing(provider, model, field, value)}+ theme={theme}+ />+ ))}+ </AccordionContent>+ </AccordionItem>);})}- </Collapse>+ </Accordion>);};@@ -293,59 +297,56 @@ const PricingConfigModal: React.FC<Props> = ({ visible, onClose }) => {const services = Object.keys(config.api).sort();return (- <Collapse- defaultActiveKey={services}- style={{ background: 'transparent' }}- >- {services.map(service => {+ <Accordion type="multiple" defaultValue={services} className="bg-transparent">+ {services.map((service) => {const operations = config.api[service];- const opNames = Object.keys(operations).filter(k => !k.startsWith('_')).sort();+ const opNames = Object.keys(operations).filter((k) => !k.startsWith('_')).sort();const description = (operations as Record<string, string | number>)._description as string | undefined;const source = (operations as Record<string, string | number>)._source as string | undefined;return (- <Collapse.Panel- key={service}- header={- <span style={{ textTransform: 'capitalize', fontWeight: 500 }}>+ <AccordionItem key={service} value={service}>+ <AccordionTrigger>+ <span className="font-medium capitalize">{service}- <span style={{ marginLeft: 8, fontSize: 12, color: theme.colors.textSecondary }}>+ <span className="ml-2 text-xs text-muted-foreground">({opNames.length} operations)</span></span>- }- >- {description && (- <div style={{ fontSize: 12, color: theme.colors.textSecondary, padding: '4px 12px 8px' }}>- {description}- {source && (- <a- href={source}- target="_blank"- rel="noopener noreferrer"- style={{ marginLeft: 8, color: theme.dracula.cyan }}- >- Source- </a>- )}+ </AccordionTrigger>+ <AccordionContent>+ {description && (+ <div className="px-3 py-1 pb-2 text-xs text-muted-foreground">+ {description}+ {source && (+ <a+ href={source}+ target="_blank"+ rel="noopener noreferrer"+ className="ml-2 text-dracula-cyan"+ >+ Source+ </a>+ )}+ </div>+ )}+ <div className="px-3 py-1 text-[11px] text-muted-foreground">+ Prices in USD per resource/request</div>- )}- <div style={{ fontSize: 11, color: theme.colors.textSecondary, padding: '0 12px 4px' }}>- Prices in USD per resource/request- </div>- {opNames.map(operation => (- <APIPricingRow- key={operation}- operation={operation}- price={(operations as Record<string, number>)[operation]}- onChange={(value) => updateAPIPricing(service, operation, value)}- theme={theme}- />- ))}- </Collapse.Panel>+ {opNames.map((operation) => (+ <APIPricingRow+ key={operation}+ operation={operation}+ price={(operations as Record<string, number>)[operation]}+ onChange={(value) => updateAPIPricing(service, operation, value)}+ theme={theme}+ />+ ))}+ </AccordionContent>+ </AccordionItem>);})}- </Collapse>+ </Accordion>);};@@ -412,21 +413,14 @@ const PricingConfigModal: React.FC<Props> = ({ visible, onClose }) => {</div>{/* Tabs */}- <Tabs- defaultActiveKey="llm"- items={[- {- key: 'llm',- label: 'LLM Pricing',- children: renderLLMTab(),- },- {- key: 'api',- label: 'API Pricing',- children: renderAPITab(),- },- ]}- />+ <Tabs defaultValue="llm">+ <TabsList>+ <TabsTrigger value="llm">LLM Pricing</TabsTrigger>+ <TabsTrigger value="api">API Pricing</TabsTrigger>+ </TabsList>+ <TabsContent value="llm">{renderLLMTab()}</TabsContent>+ <TabsContent value="api">{renderAPITab()}</TabsContent>+ </Tabs></>) : (<div style={{ textAlign: 'center', padding: 40, color: theme.colors.textSecondary }}>diff --git a/client/src/components/parameterPanel/MasterSkillEditor.tsx b/client/src/components/parameterPanel/MasterSkillEditor.tsxindex 4a46125d..bc02995b 100644--- a/client/src/components/parameterPanel/MasterSkillEditor.tsx+++ b/client/src/components/parameterPanel/MasterSkillEditor.tsx@@ -11,9 +11,26 @@*/import React, { useState, useEffect, useCallback, useMemo, useRef } from 'react';-import { Input, Select, Checkbox, Button, List, Badge, Empty, Tooltip, Popconfirm } from 'antd';+import { Input, Select, Checkbox, Button, List, Badge, Empty } from 'antd';import { Loader2, Info } from 'lucide-react';import { Alert as DSAlert, AlertDescription } from '@/components/ui/alert';+import {+ Tooltip,+ TooltipContent,+ TooltipProvider,+ TooltipTrigger,+} from '@/components/ui/tooltip';+import {+ AlertDialog,+ AlertDialogAction,+ AlertDialogCancel,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogHeader,+ AlertDialogTitle,+ AlertDialogTrigger,+} from '@/components/ui/alert-dialog';import { toast } from 'sonner';import { SearchOutlined, ReloadOutlined, FolderOutlined, PlusOutlined, DeleteOutlined, SaveOutlined, CloseOutlined } from '@ant-design/icons';import { useAppTheme } from '../../hooks/useAppTheme';@@ -589,19 +606,24 @@ const MasterSkillEditor: React.FC<MasterSkillEditorProps> = ({</span><div style={{ display: 'flex', alignItems: 'center', gap: theme.spacing.xs }}><Badge count={enabledCount} style={{ backgroundColor: theme.dracula.purple }} showZero />- <Tooltip title="Create new skill">- <Button- size="small"- icon={<PlusOutlined />}- onClick={handleCreateSkill}- disabled={isCreatingNew}- style={{- backgroundColor: `${theme.dracula.green}20`,- borderColor: theme.dracula.green,- color: theme.dracula.green,- }}- />- </Tooltip>+ <TooltipProvider>+ <Tooltip>+ <TooltipTrigger asChild>+ <Button+ size="small"+ icon={<PlusOutlined />}+ onClick={handleCreateSkill}+ disabled={isCreatingNew}+ style={{+ backgroundColor: `${theme.dracula.green}20`,+ borderColor: theme.dracula.green,+ color: theme.dracula.green,+ }}+ />+ </TooltipTrigger>+ <TooltipContent>Create new skill</TooltipContent>+ </Tooltip>+ </TooltipProvider></div></div>@@ -705,15 +727,22 @@ const MasterSkillEditor: React.FC<MasterSkillEditorProps> = ({{skill.displayName}</span>{isCustomized && (- <Tooltip title="Customized">- <div style={{- width: 8,- height: 8,- borderRadius: '50%',- backgroundColor: theme.dracula.orange,- flexShrink: 0- }} />- </Tooltip>+ <TooltipProvider>+ <Tooltip>+ <TooltipTrigger asChild>+ <div+ style={{+ width: 8,+ height: 8,+ borderRadius: '50%',+ backgroundColor: theme.dracula.orange,+ flexShrink: 0,+ }}+ />+ </TooltipTrigger>+ <TooltipContent>Customized</TooltipContent>+ </Tooltip>+ </TooltipProvider>)}{skill.isUserSkill && (<Badge@@ -974,25 +1003,39 @@ const MasterSkillEditor: React.FC<MasterSkillEditorProps> = ({Save</Button>)}- <Popconfirm- title="Delete this skill?"- onConfirm={() => handleDeleteSkill(selectedSkillName!)}- okText="Delete"- cancelText="Cancel"- okButtonProps={{ danger: true }}- >- <Button- icon={<DeleteOutlined />}- size="small"- danger- style={{- backgroundColor: `${theme.dracula.red}15`,- borderColor: `${theme.dracula.red}40`,- }}- >- Delete- </Button>- </Popconfirm>+ <AlertDialog>+ <AlertDialogTrigger asChild>+ <Button+ icon={<DeleteOutlined />}+ size="small"+ danger+ style={{+ backgroundColor: `${theme.dracula.red}15`,+ borderColor: `${theme.dracula.red}40`,+ }}+ >+ Delete+ </Button>+ </AlertDialogTrigger>+ <AlertDialogContent>+ <AlertDialogHeader>+ <AlertDialogTitle>Delete this skill?</AlertDialogTitle>+ <AlertDialogDescription>+ This action cannot be undone. The skill and any custom+ instructions will be permanently removed.+ </AlertDialogDescription>+ </AlertDialogHeader>+ <AlertDialogFooter>+ <AlertDialogCancel>Cancel</AlertDialogCancel>+ <AlertDialogAction+ onClick={() => handleDeleteSkill(selectedSkillName!)}+ className="bg-destructive text-white hover:bg-destructive/90"+ >+ Delete+ </AlertDialogAction>+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog></>)}diff --git a/client/src/components/ui/alert-dialog.tsx b/client/src/components/ui/alert-dialog.tsxnew file mode 100644index 00000000..186efdb8--- /dev/null+++ b/client/src/components/ui/alert-dialog.tsx@@ -0,0 +1,197 @@+import * as React from "react"+import { AlertDialog as AlertDialogPrimitive } from "radix-ui"++import { cn } from "@/lib/utils"+import { Button } from "@/components/ui/button"++function AlertDialog({+ ...props+}: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {+ return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />+}++function AlertDialogTrigger({+ ...props+}: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {+ return (+ <AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />+ )+}++function AlertDialogPortal({+ ...props+}: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {+ return (+ <AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props} />+ )+}++function AlertDialogOverlay({+ className,+ ...props+}: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {+ return (+ <AlertDialogPrimitive.Overlay+ data-slot="alert-dialog-overlay"+ className={cn(+ "fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",+ className+ )}+ {...props}+ />+ )+}++function AlertDialogContent({+ className,+ size = "default",+ ...props+}: React.ComponentProps<typeof AlertDialogPrimitive.Content> & {+ size?: "default" | "sm"+}) {+ return (+ <AlertDialogPortal>+ <AlertDialogOverlay />+ <AlertDialogPrimitive.Content+ data-slot="alert-dialog-content"+ data-size={size}+ className={cn(+ "group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",+ className+ )}+ {...props}+ />+ </AlertDialogPortal>+ )+}++function AlertDialogHeader({+ className,+ ...props+}: React.ComponentProps<"div">) {+ return (+ <div+ data-slot="alert-dialog-header"+ className={cn(+ "grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",+ className+ )}+ {...props}+ />+ )+}++function AlertDialogFooter({+ className,+ ...props+}: React.ComponentProps<"div">) {+ return (+ <div+ data-slot="alert-dialog-footer"+ className={cn(+ "-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",+ className+ )}+ {...props}+ />+ )+}++function AlertDialogMedia({+ className,+ ...props+}: React.ComponentProps<"div">) {+ return (+ <div+ data-slot="alert-dialog-media"+ className={cn(+ "mb-2 inline-flex size-10 items-center justify-center rounded-md bg-muted sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-6",+ className+ )}+ {...props}+ />+ )+}++function AlertDialogTitle({+ className,+ ...props+}: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {+ return (+ <AlertDialogPrimitive.Title+ data-slot="alert-dialog-title"+ className={cn(+ "text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",+ className+ )}+ {...props}+ />+ )+}++function AlertDialogDescription({+ className,+ ...props+}: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {+ return (+ <AlertDialogPrimitive.Description+ data-slot="alert-dialog-description"+ className={cn(+ "text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",+ className+ )}+ {...props}+ />+ )+}++function AlertDialogAction({+ className,+ variant = "default",+ size = "default",+ ...props+}: React.ComponentProps<typeof AlertDialogPrimitive.Action> &+ Pick<React.ComponentProps<typeof Button>, "variant" | "size">) {+ return (+ <Button variant={variant} size={size} asChild>+ <AlertDialogPrimitive.Action+ data-slot="alert-dialog-action"+ className={cn(className)}+ {...props}+ />+ </Button>+ )+}++function AlertDialogCancel({+ className,+ variant = "outline",+ size = "default",+ ...props+}: React.ComponentProps<typeof AlertDialogPrimitive.Cancel> &+ Pick<React.ComponentProps<typeof Button>, "variant" | "size">) {+ return (+ <Button variant={variant} size={size} asChild>+ <AlertDialogPrimitive.Cancel+ data-slot="alert-dialog-cancel"+ className={cn(className)}+ {...props}+ />+ </Button>+ )+}++export {+ AlertDialog,+ AlertDialogAction,+ AlertDialogCancel,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogHeader,+ AlertDialogMedia,+ AlertDialogOverlay,+ AlertDialogPortal,+ AlertDialogTitle,+ AlertDialogTrigger,+}