fix: refine AI agent config dialog header
This commit is contained in:
@@ -3,7 +3,6 @@
|
|||||||
import { useCallback, useEffect, useMemo, useState, type ReactNode } from "react"
|
import { useCallback, useEffect, useMemo, useState, type ReactNode } from "react"
|
||||||
import {
|
import {
|
||||||
ArrowDownIcon,
|
ArrowDownIcon,
|
||||||
ArrowLeftIcon,
|
|
||||||
ArrowUpIcon,
|
ArrowUpIcon,
|
||||||
BotMessageSquareIcon,
|
BotMessageSquareIcon,
|
||||||
BrainCircuitIcon,
|
BrainCircuitIcon,
|
||||||
@@ -114,11 +113,9 @@ function uniqueNumbers(input: number[]) {
|
|||||||
|
|
||||||
export function AIAgentConfigWorkbench({
|
export function AIAgentConfigWorkbench({
|
||||||
agentId,
|
agentId,
|
||||||
onClose,
|
|
||||||
onAgentSaved,
|
onAgentSaved,
|
||||||
}: {
|
}: {
|
||||||
agentId: number
|
agentId: number
|
||||||
onClose: () => void
|
|
||||||
onAgentSaved?: () => void
|
onAgentSaved?: () => void
|
||||||
}) {
|
}) {
|
||||||
const [activeSection, setActiveSection] = useState<SectionKey>("basic")
|
const [activeSection, setActiveSection] = useState<SectionKey>("basic")
|
||||||
@@ -449,18 +446,14 @@ export function AIAgentConfigWorkbench({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex h-full min-h-0 flex-col overflow-hidden bg-background">
|
<div className="flex h-full min-h-0 flex-col overflow-hidden bg-background">
|
||||||
<div className="flex shrink-0 items-center justify-between border-b px-5 py-3">
|
<div className="flex shrink-0 items-center justify-between gap-4 border-b px-5 py-3 pr-28">
|
||||||
<div className="flex min-w-0 items-center gap-3">
|
<div className="flex min-w-0 items-center gap-3">
|
||||||
<Button variant="outline" size="icon-sm" onClick={onClose}>
|
|
||||||
<ArrowLeftIcon />
|
|
||||||
</Button>
|
|
||||||
<div className="flex size-10 items-center justify-center rounded-md bg-muted text-muted-foreground">
|
<div className="flex size-10 items-center justify-center rounded-md bg-muted text-muted-foreground">
|
||||||
<BotMessageSquareIcon className="size-5" />
|
<BotMessageSquareIcon className="size-5" />
|
||||||
</div>
|
</div>
|
||||||
<div className="min-w-0">
|
<div className="min-w-0">
|
||||||
<h1 className="truncate text-base font-semibold">{agent?.name ?? "AI Agent 配置"}</h1>
|
<h1 className="truncate text-base font-semibold">{agent?.name ?? "AI Agent 配置"}</h1>
|
||||||
<div className="mt-1 flex items-center gap-2 text-sm text-muted-foreground">
|
<div className="mt-1 flex items-center gap-2 text-sm text-muted-foreground">
|
||||||
<span>Agent #{agentId || "-"}</span>
|
|
||||||
{agent?.statusName ? <Badge variant="secondary">{agent.statusName}</Badge> : null}
|
{agent?.statusName ? <Badge variant="secondary">{agent.statusName}</Badge> : null}
|
||||||
{agent?.workflowVersionId ? <Badge>已发布流程</Badge> : <Badge variant="outline">草稿流程</Badge>}
|
{agent?.workflowVersionId ? <Badge>已发布流程</Badge> : <Badge variant="outline">草稿流程</Badge>}
|
||||||
</div>
|
</div>
|
||||||
@@ -469,7 +462,7 @@ export function AIAgentConfigWorkbench({
|
|||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Button variant="outline" disabled={savingAgent || loading} onClick={saveAgentSettings}>
|
<Button variant="outline" disabled={savingAgent || loading} onClick={saveAgentSettings}>
|
||||||
<SaveIcon className="size-4" />
|
<SaveIcon className="size-4" />
|
||||||
保存 Agent
|
保存
|
||||||
</Button>
|
</Button>
|
||||||
<Button disabled={savingWorkflow || loading} onClick={publishWorkflow}>
|
<Button disabled={savingWorkflow || loading} onClick={publishWorkflow}>
|
||||||
<SendIcon className="size-4" />
|
<SendIcon className="size-4" />
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import { useRouter } from "next/navigation"
|
|
||||||
import { useState } from "react"
|
import { useState } from "react"
|
||||||
|
|
||||||
import { AIAgentConfigWorkbench } from "../_components/config-workbench"
|
import { AIAgentConfigWorkbench } from "../_components/config-workbench"
|
||||||
@@ -11,15 +10,11 @@ function readAgentIdFromLocation() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function DashboardAIAgentConfigPage() {
|
export default function DashboardAIAgentConfigPage() {
|
||||||
const router = useRouter()
|
|
||||||
const [agentId] = useState(() => readAgentIdFromLocation())
|
const [agentId] = useState(() => readAgentIdFromLocation())
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="h-[calc(100vh-var(--header-height))] min-h-0">
|
<div className="h-[calc(100vh-var(--header-height))] min-h-0">
|
||||||
<AIAgentConfigWorkbench
|
<AIAgentConfigWorkbench agentId={agentId} />
|
||||||
agentId={agentId}
|
|
||||||
onClose={() => router.push("/dashboard/ai-agents")}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -320,7 +320,6 @@ export default function DashboardAIAgentsPage() {
|
|||||||
{configAgentId ? (
|
{configAgentId ? (
|
||||||
<AIAgentConfigWorkbench
|
<AIAgentConfigWorkbench
|
||||||
agentId={configAgentId}
|
agentId={configAgentId}
|
||||||
onClose={() => setConfigAgentId(null)}
|
|
||||||
onAgentSaved={() => crudActions?.onRefresh()}
|
onAgentSaved={() => crudActions?.onRefresh()}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
|
|||||||
Reference in New Issue
Block a user