修改优化

This commit is contained in:
xuhd committed 2026-05-19 09:38:00 +08:00
1 parent f80a00e211
commit 6253a2bca9
4 files changed
+237 -35

No files matched your search

@@ -530,6 +530,15 @@ function MemorySearchPanel() {
const { t } = useI18n();
const m = t.settings.memory;
// 检索范围:default 是内置助手,其余是用户的自定义专家 —— 对应
// Hindsight 的 work bank deerflow-work-{user}-{agent}。
const { agents: allAgents } = useAgents();
const experts = useMemo(
() => allAgents.filter((a) => !a.builtin),
[allAgents],
);
const [searchAgent, setSearchAgent] = useState("default");
const [query, setQuery] = useState("");
const [mode, setMode] = useState<MemorySearchMode>("recall");
const [isSearching, setIsSearching] = useState(false);
@@ -542,7 +551,7 @@ function MemorySearchPanel() {
if (!q) return;
setIsSearching(true);
try {
const result = await searchMemory(q, mode);
const result = await searchMemory(q, mode, searchAgent);
setUnavailable(!result.available);
setResults(result.results);
setReflectText(result.text);
@@ -566,6 +575,26 @@ function MemorySearchPanel() {
placeholder={m.searchPlaceholder}
className="min-w-0 flex-1"
/>
<div className="flex items-center gap-1">
<span className="text-muted-foreground text-sm">
{m.workNotesAgentLabel}
</span>
<Select value={searchAgent} onValueChange={setSearchAgent}>
<SelectTrigger className="w-40" size="sm">
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="default">
{m.workNotesDefaultAgent}
</SelectItem>
{experts.map((a) => (
<SelectItem key={a.id} value={a.id}>
{a.name}
</SelectItem>
))}
</SelectContent>
</Select>
</div>
<ToggleGroup
type="single"
value={mode}