feat(ms22-p2): add agent selector UI in WebUI (#685)
All checks were successful
ci/woodpecker/push/ci Pipeline was successful

Co-authored-by: Jason Woltje <jason@diversecanvas.com>
Co-committed-by: Jason Woltje <jason@diversecanvas.com>
This commit was merged in pull request #685.
This commit is contained in:
2026-03-05 03:29:02 +00:00
committed by jason.woltje
parent 2f1ee53c8d
commit a70f149886
5 changed files with 281 additions and 2 deletions

View File

@@ -9,6 +9,7 @@ import { useWorkspaceId } from "@/lib/hooks";
import { MessageList } from "./MessageList";
import { ChatInput, type ModelId, DEFAULT_TEMPERATURE, DEFAULT_MAX_TOKENS } from "./ChatInput";
import { ChatEmptyState } from "./ChatEmptyState";
import { AgentSelector } from "./AgentSelector";
import type { Message } from "@/hooks/useChat";
export interface ChatRef {
@@ -66,6 +67,7 @@ export const Chat = forwardRef<ChatRef, ChatProps>(function Chat(
const [selectedModel, setSelectedModel] = useState<ModelId>("llama3.2");
const [temperature, setTemperature] = useState<number>(DEFAULT_TEMPERATURE);
const [maxTokens, setMaxTokens] = useState<number>(DEFAULT_MAX_TOKENS);
const [selectedAgent, setSelectedAgent] = useState<string | null>(null);
// Suggestion fill value: controls ChatInput's textarea content
const [suggestionValue, setSuggestionValue] = useState<string | undefined>(undefined);
@@ -88,6 +90,7 @@ export const Chat = forwardRef<ChatRef, ChatProps>(function Chat(
temperature,
maxTokens,
...(initialProjectId !== undefined && { projectId: initialProjectId }),
...(selectedAgent !== null && { agent: selectedAgent }),
});
// Read workspace ID from localStorage (set by auth-context after session check).
@@ -375,6 +378,13 @@ export const Chat = forwardRef<ChatRef, ChatProps>(function Chat(
}}
>
<div className="mx-auto max-w-4xl px-4 py-4 lg:px-8">
<div className="mb-3">
<AgentSelector
selectedAgent={selectedAgent}
onChange={setSelectedAgent}
disabled={isChatLoading || isStreaming || !user}
/>
</div>
<ChatInput
onSend={handleSendMessage}
disabled={isChatLoading || !user}