Skip to content
Open
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
48 changes: 26 additions & 22 deletions client/webui/frontend/src/lib/components/chat/ChatInputArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const createEnhancedMessage = (command: ChatCommand, conversationContext?: strin
export const ChatInputArea: React.FC<{ agents: AgentCardInfo[]; scrollToBottom?: () => void }> = ({ agents = [], scrollToBottom }) => {
const navigate = useNavigate();
const location = useLocation();
const { isResponding, isCancelling, selectedAgentName, sessionId, setSessionId, handleSubmit, handleCancel, uploadArtifactFile, displayError, artifacts, messages, startNewChatWithPrompt, pendingPrompt, clearPendingPrompt } = useChatContext();
const { isResponding, isCancelling, selectedAgentName, singleAgentMode, sessionId, setSessionId, handleSubmit, handleCancel, uploadArtifactFile, displayError, artifacts, messages, startNewChatWithPrompt, pendingPrompt, clearPendingPrompt } = useChatContext();
const { handleAgentSelection } = useAgentSelection();
const { settings } = useAudioSettings();
const { configFeatureEnablement } = useConfigContext();
Expand Down Expand Up @@ -1068,27 +1068,31 @@ export const ChatInputArea: React.FC<{ agents: AgentCardInfo[]; scrollToBottom?:
<Paperclip className="size-4" />
</Button>

<div>Agent: </div>
<Select
value={selectedAgentName}
onValueChange={agentName => {
handleAgentSelection(agentName);
}}
disabled={isResponding || agents.length === 0}
>
<SelectTrigger className="w-[250px]">
<SelectValue placeholder="Select an agent..." />
</SelectTrigger>
<SelectContent>
{agents
.filter(agent => !agent.isWorkflow)
.map(agent => (
<SelectItem key={agent.name} value={agent.name}>
{agent.displayName || agent.name}
</SelectItem>
))}
</SelectContent>
</Select>
{!singleAgentMode && (
<>
<div>Agent: </div>
<Select
value={selectedAgentName}
onValueChange={agentName => {
handleAgentSelection(agentName);
}}
disabled={isResponding || agents.length === 0}
>
<SelectTrigger className="w-[250px]">
<SelectValue placeholder="Select an agent..." />
</SelectTrigger>
<SelectContent>
{agents
.filter(agent => !agent.isWorkflow)
.map(agent => (
<SelectItem key={agent.name} value={agent.name}>
{agent.displayName || agent.name}
</SelectItem>
))}
</SelectContent>
</Select>
</>
)}

{/* Spacer to push buttons to the right */}
<div className="flex-1" />
Expand Down
2 changes: 2 additions & 0 deletions client/webui/frontend/src/lib/contexts/ChatContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface ChatState {
sessionOwnerEmail: string | null;
currentTaskId: string | null;
selectedAgentName: string;
singleAgentMode: boolean;
notifications: Notification[];
isCancelling: boolean;
latestStatusText: React.RefObject<string | null>;
Expand Down Expand Up @@ -89,6 +90,7 @@ export interface ChatActions {
handleCancel: () => void;
addNotification: (message: string, type?: "success" | "info" | "warning") => void;
setSelectedAgentName: React.Dispatch<React.SetStateAction<string>>;
setSingleAgentMode: React.Dispatch<React.SetStateAction<boolean>>;
uploadArtifactFile: (file: File, overrideSessionId?: string, description?: string, silent?: boolean) => Promise<{ uri: string; sessionId: string } | { error: string } | null>;
/** Side Panel Control Actions */
setIsSidePanelCollapsed: React.Dispatch<React.SetStateAction<boolean>>;
Expand Down
3 changes: 3 additions & 0 deletions client/webui/frontend/src/lib/providers/ChatProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export const ChatProvider: React.FC<ChatProviderProps> = ({ children }) => {
const [notifications, setNotifications] = useState<Notification[]>([]);
const [currentTaskId, setCurrentTaskId] = useState<string | null>(null);
const [selectedAgentName, setSelectedAgentName] = useState<string>("");
const [singleAgentMode, setSingleAgentMode] = useState<boolean>(false);
const [isCancelling, setIsCancelling] = useState<boolean>(false);
const [taskIdInSidePanel, setTaskIdInSidePanel] = useState<string | null>(null);
const [isSidePanelCollapsed, setIsSidePanelCollapsed] = useState<boolean>(true);
Expand Down Expand Up @@ -2002,6 +2003,8 @@ export const ChatProvider: React.FC<ChatProviderProps> = ({ children }) => {
addNotification,
selectedAgentName,
setSelectedAgentName,
singleAgentMode,
setSingleAgentMode,
artifacts,
allArtifacts,
artifactsLoading,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ export function SharedChatProvider({ children, artifacts: initialArtifacts, ragD
sessionOwnerEmail: null,
currentTaskId: null,
selectedAgentName: "",
singleAgentMode: false,
notifications: [],
isCancelling: false,
latestStatusText,
Expand Down Expand Up @@ -262,6 +263,7 @@ export function SharedChatProvider({ children, artifacts: initialArtifacts, ragD
handleCancel: () => {},
addNotification: () => {},
setSelectedAgentName: () => {},
setSingleAgentMode: () => {},
uploadArtifactFile: async () => null,

// Side Panel Control Actions
Expand Down
Loading