diff --git a/apps/rowboat/app/projects/[projectId]/entities/agent_config.tsx b/apps/rowboat/app/projects/[projectId]/entities/agent_config.tsx index f44432f4..0ccf3435 100644 --- a/apps/rowboat/app/projects/[projectId]/entities/agent_config.tsx +++ b/apps/rowboat/app/projects/[projectId]/entities/agent_config.tsx @@ -2,10 +2,10 @@ import { WorkflowPrompt, WorkflowAgent, Workflow, WorkflowTool } from "../../../lib/types/workflow_types"; import { DataSource } from "@/src/entities/models/data-source"; import { z } from "zod"; -import { PlusIcon, X as XIcon, ChevronDown, ChevronRight, Trash2, Maximize2, Minimize2, StarIcon, DatabaseIcon, UserIcon, Settings, Info } from "lucide-react"; +import { PlusIcon, X as XIcon, ChevronDown, ChevronRight, Trash2, Maximize2, Minimize2, StarIcon, DatabaseIcon, UserIcon, Settings, Info, Edit3 } from "lucide-react"; import { useState, useEffect, useRef } from "react"; import { usePreviewModal } from "../workflow/preview-modal"; -import { Modal, ModalContent, ModalHeader, ModalBody, ModalFooter, Select, SelectItem, Chip, SelectSection } from "@heroui/react"; +import { Modal, ModalContent, ModalHeader, ModalBody, ModalFooter, Select, SelectItem, Chip, SelectSection, Input } from "@heroui/react"; import { PreviewModalProvider } from "../workflow/preview-modal"; import { CopilotMessage } from "@/src/application/lib/copilot/types"; import { getCopilotAgentInstructions } from "@/app/actions/copilot.actions"; @@ -17,7 +17,6 @@ import { Button as CustomButton } from "@/components/ui/button"; import clsx from "clsx"; import { InputField } from "@/app/lib/components/input-field"; import { USE_TRANSFER_CONTROL_OPTIONS } from "@/app/lib/feature_flags"; -import { Input } from "@/components/ui/input"; import { Info as InfoIcon } from "lucide-react"; import { useCopilot } from "../copilot/use-copilot"; import { BillingUpgradeModal } from "@/components/common/billing-upgrade-modal"; @@ -78,6 +77,8 @@ export function AgentConfig({ const [previousRagSources, setPreviousRagSources] = useState([]); const [billingError, setBillingError] = useState(null); const [showSavedBanner, setShowSavedBanner] = useState(false); + const [isEditingName, setIsEditingName] = useState(false); + const nameInputRef = useRef(null); // Check if this agent is a pipeline agent const isPipelineAgent = agent.type === 'pipeline'; @@ -101,6 +102,14 @@ export function AgentConfig({ setLocalName(agent.name); }, [agent.name]); + // Focus name input when entering edit mode + useEffect(() => { + if (isEditingName && nameInputRef.current) { + nameInputRef.current.focus(); + nameInputRef.current.select(); + } + }, [isEditingName]); + // Track changes in RAG datasources useEffect(() => { const currentSources = agent.ragDataSources || []; @@ -188,15 +197,36 @@ export function AgentConfig({ return true; }; - const handleNameChange = (e: React.ChangeEvent) => { + const handleNameChange = (e: React.ChangeEvent) => { const newName = e.target.value; setLocalName(newName); - - if (validateName(newName)) { + setNameError(null); + }; + + const handleNameCommit = () => { + if (validateName(localName)) { handleUpdate({ ...agent, - name: newName + name: localName }); + showSavedMessage(); + setIsEditingName(false); + } + }; + + const handleNameCancel = () => { + setLocalName(agent.name); + setNameError(null); + setIsEditingName(false); + }; + + const handleNameKeyDown = (e: React.KeyboardEvent) => { + if (e.key === 'Enter') { + e.preventDefault(); + handleNameCommit(); + } else if (e.key === 'Escape') { + e.preventDefault(); + handleNameCancel(); } }; @@ -221,8 +251,36 @@ export function AgentConfig({ -
- {agent.name} +
+ {isEditingName ? ( +
+ +
+ ) : ( + + )}
- {/* Identity Section Card */} - } - title="Identity" - labelWidth="md:w-32" - className="mb-1" - > -
-
- -
- { - setLocalName(value); - if (validateName(value)) { - handleUpdate({ - ...agent, - name: value - }); - } - showSavedMessage(); - }} - error={nameError} - className="w-full" - /> -
-
- -
-
{/* Behavior Section Card */} }