fix(agent): validate UI envelopes
This commit is contained in:
@@ -29,6 +29,7 @@ import {
|
||||
PromptInputSubmit,
|
||||
PromptInputTextarea
|
||||
} from "@/shared/ai-elements/prompt-input";
|
||||
import { Suggestion, Suggestions } from "@/shared/ai-elements/suggestion";
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
@@ -93,6 +94,12 @@ type AgentCommandPanelProps = {
|
||||
onRejectQuestion?: (request: AgentQuestionRequest) => Promise<void> | void;
|
||||
};
|
||||
|
||||
const AGENT_PROMPT_SUGGESTIONS = [
|
||||
"当前监测数据质量如何,是否存在缺失、失真或可信度不足的问题?",
|
||||
"当前监测数据中有哪些异常问题需要重点关注?",
|
||||
"当前管网哪些区域可能存在雨污混接,判断依据是什么?"
|
||||
] as const;
|
||||
|
||||
export function AgentCommandPanel({
|
||||
collapsing = false,
|
||||
personaState,
|
||||
@@ -305,7 +312,18 @@ export function AgentCommandPanel({
|
||||
</Conversation>
|
||||
</AgentContent>
|
||||
|
||||
<div className="agent-panel-band border-t border-white/70 p-3">
|
||||
<div className="agent-panel-band space-y-2 border-t border-white/70 p-3">
|
||||
<Suggestions aria-label="推荐问题" role="group">
|
||||
{AGENT_PROMPT_SUGGESTIONS.map((suggestion) => (
|
||||
<Suggestion
|
||||
key={suggestion}
|
||||
suggestion={suggestion}
|
||||
disabled={streaming}
|
||||
onClick={submitPrompt}
|
||||
className="border-slate-200/80 bg-white/75 text-slate-600 shadow-none hover:border-blue-200 hover:bg-blue-50 hover:text-blue-700"
|
||||
/>
|
||||
))}
|
||||
</Suggestions>
|
||||
<PromptInput
|
||||
className="agent-panel-control rounded-2xl shadow-sm"
|
||||
onSubmit={(message) => {
|
||||
@@ -626,4 +644,3 @@ function BackendMessageList({
|
||||
</motion.div>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user