refactor(edit): implement tabbed interface for tool configuration in EditDialog

This commit is contained in:
mlogclub
2026-04-18 14:11:13 +08:00
parent 3249c8ae96
commit e1ffcc64a9
@@ -31,6 +31,12 @@ import {
PopoverDescription, PopoverDescription,
PopoverTrigger, PopoverTrigger,
} from "@/components/ui/popover"; } from "@/components/ui/popover";
import {
Tabs,
TabsContent,
TabsList,
TabsTrigger,
} from "@/components/ui/tabs";
import { Textarea } from "@/components/ui/textarea"; import { Textarea } from "@/components/ui/textarea";
import { import {
fetchAIAgent, fetchAIAgent,
@@ -883,13 +889,18 @@ function EditDialogBody({
<SectionCard <SectionCard
title="能力配置" title="能力配置"
description="知识库用于 RAGSkills 用于业务流程,Direct Tools 用于外部 MCP 查询,Graph Tools 用于内置业务流程。"
> >
<div className="space-y-4"> <Tabs defaultValue="knowledge" className="gap-4">
<div className="rounded-xl border bg-muted/10 p-4"> <TabsList className="w-fit">
<div className="mb-1 text-sm font-medium"></div> <TabsTrigger value="knowledge"></TabsTrigger>
<div className="mb-4 text-xs text-muted-foreground"> <TabsTrigger value="skills">Skills</TabsTrigger>
<TabsTrigger value="direct-tools">Direct Tools</TabsTrigger>
<TabsTrigger value="graph-tools">Graph Tools</TabsTrigger>
</TabsList>
<TabsContent value="knowledge" className="space-y-4">
<div className="text-xs text-muted-foreground">
</div> </div>
<Field data-invalid={selectedKnowledgeIds.length === 0}> <Field data-invalid={selectedKnowledgeIds.length === 0}>
<FieldContent className="space-y-3"> <FieldContent className="space-y-3">
@@ -921,10 +932,7 @@ function EditDialogBody({
) : ( ) : (
<div className="space-y-2 rounded-md border p-3"> <div className="space-y-2 rounded-md border p-3">
{selectedKnowledgeOptions.map((option, index) => ( {selectedKnowledgeOptions.map((option, index) => (
<div <div key={option.value} className="flex items-center gap-2">
key={option.value}
className="flex items-center gap-2"
>
<Badge <Badge
variant="secondary" variant="secondary"
className="min-w-8 justify-center" className="min-w-8 justify-center"
@@ -972,7 +980,7 @@ function EditDialogBody({
</FieldContent> </FieldContent>
</Field> </Field>
<div className="mt-4 grid grid-cols-1 gap-4 xl:grid-cols-1"> <div className="grid grid-cols-1 gap-4 xl:grid-cols-1">
<Field data-invalid={!!errors.fallbackMode}> <Field data-invalid={!!errors.fallbackMode}>
<FieldLabel></FieldLabel> <FieldLabel></FieldLabel>
<FieldContent className="space-y-3"> <FieldContent className="space-y-3">
@@ -1011,11 +1019,10 @@ function EditDialogBody({
</FieldContent> </FieldContent>
</Field> </Field>
</div> </div>
</div> </TabsContent>
<div className="rounded-xl border bg-muted/10 p-4"> <TabsContent value="skills" className="space-y-4">
<div className="mb-1 text-sm font-medium">Skills</div> <div className="text-xs text-muted-foreground">
<div className="mb-4 text-xs text-muted-foreground">
</div> </div>
<Field> <Field>
@@ -1072,11 +1079,10 @@ function EditDialogBody({
</div> </div>
</FieldContent> </FieldContent>
</Field> </Field>
</div> </TabsContent>
<div className="rounded-xl border bg-muted/10 p-4"> <TabsContent value="direct-tools" className="space-y-4">
<div className="mb-1 text-sm font-medium">Direct Tools</div> <div className="text-xs text-muted-foreground">
<div className="mb-4 text-xs text-muted-foreground">
MCP MCP
</div> </div>
<Field> <Field>
@@ -1108,9 +1114,7 @@ function EditDialogBody({
<Button <Button
type="button" type="button"
variant="outline" variant="outline"
disabled={ disabled={!directToolGroupToAdd || !directToolToAdd}
!directToolGroupToAdd || !directToolToAdd
}
onClick={() => handleAddDirectTool(directToolToAdd)} onClick={() => handleAddDirectTool(directToolToAdd)}
> >
<PlusIcon /> <PlusIcon />
@@ -1124,10 +1128,7 @@ function EditDialogBody({
</span> </span>
) : ( ) : (
directToolsGrouped.map(([groupLabel, tools]) => ( directToolsGrouped.map(([groupLabel, tools]) => (
<div <div key={groupLabel} className="rounded-md border p-3">
key={groupLabel}
className="rounded-md border p-3"
>
<div className="mb-2 text-xs font-medium text-muted-foreground"> <div className="mb-2 text-xs font-medium text-muted-foreground">
{groupLabel} {groupLabel}
</div> </div>
@@ -1169,11 +1170,10 @@ function EditDialogBody({
</div> </div>
</FieldContent> </FieldContent>
</Field> </Field>
</div> </TabsContent>
<div className="rounded-xl border bg-muted/10 p-4"> <TabsContent value="graph-tools" className="space-y-4">
<div className="mb-1 text-sm font-medium">Graph Tools</div> <div className="text-xs text-muted-foreground">
<div className="mb-4 text-xs text-muted-foreground">
Direct Tools Direct Tools
</div> </div>
<Field> <Field>
@@ -1236,8 +1236,8 @@ function EditDialogBody({
</div> </div>
</FieldContent> </FieldContent>
</Field> </Field>
</div> </TabsContent>
</div> </Tabs>
</SectionCard> </SectionCard>
</form> </form>
)} )}