@@ -20,6 +20,7 @@ import {
2020 Search ,
2121 Trash2 ,
2222} from "lucide-react" ;
23+ import { Button } from "@openai/apps-sdk-ui/components/Button" ;
2324import {
2425 deleteAgentFeedbackCases ,
2526 createGithubDeliveryRollbackPr ,
@@ -74,7 +75,7 @@ import { BUILTIN_TOOLS } from "../create/veadkCatalog";
7475import type { DeploymentTaskUpdate } from "./ProjectPreview" ;
7576import { DeploymentErrorMessage } from "./DeploymentErrorMessage" ;
7677import { Markdown } from "./Markdown" ;
77- import { PageBackButton } from "./PageBackButton " ;
78+ import { ResourceDetailLayout } from "./ResourceCollection " ;
7879import { StudioConfirmDialog } from "./StudioConfirmDialog" ;
7980import { TextShimmer } from "./text-shimmer/TextShimmer" ;
8081import "./AgentWorkspace.css" ;
@@ -2779,7 +2780,7 @@ export function AgentWorkspace({
27792780 < p > 未选择智能体</ p >
27802781 </ main >
27812782 ) : (
2782- < main className = { `aw-main${ deploymentInProgress ? " is-deploying" : "" } ` } >
2783+ < main className = { `aw-main${ deploymentInProgress ? " is-deploying" : "" } ${ detailOnly ? " resource-page" : "" } ` } >
27832784 { selectedAgent && ! selectedAgentInfo && loadingAgentInfo && (
27842785 < div className = "aw-detail-loading" role = "status" aria-live = "polite" >
27852786 < div className = "aw-detail-loading-card" >
@@ -2802,32 +2803,34 @@ export function AgentWorkspace({
28022803 </ div >
28032804 </ div >
28042805 ) }
2805- < div className = "aw-agent-head" >
2806- < div className = "aw-agent-heading" >
2807- { detailOnly && onBack ? (
2808- < PageBackButton label = "返回智能体列表" onClick = { onBack } />
2809- ) : null }
2810- < div className = "aw-agent-heading-copy" >
2811- < div className = "aw-agent-title-row" >
2812- < h2 > { selectedName } </ h2 >
2813- { displayCurrentVersion != null && (
2814- < span > v{ displayCurrentVersion } </ span >
2815- ) }
2816- { selectedDraft && < span > 草稿</ span > }
2817- { selectedAgentUpdateDraft && < span > 待更新</ span > }
2818- { ! selectedAgent && ! selectedDraft && selectedPendingTask && (
2819- < span > { selectedPendingTask . label } </ span >
2820- ) }
2821- </ div >
2822- < p > { draft . description || ( loadingAgentInfo || ( detailOnly && ! detailAgentInfoResolved ) ? "正在读取智能体信息…" : "暂无描述" ) } </ p >
2823- </ div >
2824- </ div >
2825- { ( selectedDraft || selectedAgentUpdateDraft || selectedAgent ?. canDelete ) && (
2826- < div className = "aw-head-actions" >
2806+ < ResourceDetailLayout
2807+ className = "aw-agent-detail"
2808+ title = { selectedName }
2809+ description = { draft . description || ( loadingAgentInfo || ( detailOnly && ! detailAgentInfoResolved ) ? "正在读取智能体信息…" : "暂无描述" ) }
2810+ identitySeed = { selectedName }
2811+ backLabel = "返回智能体列表"
2812+ onBack = { detailOnly ? onBack : undefined }
2813+ meta = { (
2814+ < >
2815+ { displayCurrentVersion != null && < span className = "aw-agent-meta" > v{ displayCurrentVersion } </ span > }
2816+ { selectedDraft && < span className = "aw-agent-meta" > 草稿</ span > }
2817+ { selectedAgentUpdateDraft && < span className = "aw-agent-meta" > 待更新</ span > }
2818+ { ! selectedAgent && ! selectedDraft && selectedPendingTask && (
2819+ < span className = "aw-agent-meta" > { selectedPendingTask . label } </ span >
2820+ ) }
2821+ </ >
2822+ ) }
2823+ actionsClassName = "aw-head-actions"
2824+ bodyClassName = "aw-agent-detail__body"
2825+ actions = { ( selectedDraft || selectedAgentUpdateDraft || selectedAgent ?. canDelete ) ? (
2826+ < >
28272827 { ( selectedDraft || selectedAgentUpdateDraft ) && (
2828- < button
2828+ < Button
28292829 type = "button"
2830- className = "aw-head-delete aw-head-delete--draft"
2830+ color = "danger"
2831+ variant = "soft"
2832+ size = "lg"
2833+ pill = { false }
28312834 onClick = { ( ) => {
28322835 const draftToDelete = selectedDraft ?? selectedAgentUpdateDraft ;
28332836 if ( draftToDelete ) deleteSingleDraft ( draftToDelete ) ;
@@ -2838,24 +2841,32 @@ export function AgentWorkspace({
28382841 >
28392842 < Trash2 aria-hidden />
28402843 < span > 删除草稿</ span >
2841- </ button >
2844+ </ Button >
28422845 ) }
28432846 { selectedAgent ?. canDelete && (
2844- < button
2847+ < Button
28452848 type = "button"
2846- className = "aw-head-delete"
2849+ color = "danger"
2850+ variant = "soft"
2851+ size = "lg"
2852+ pill = { false }
28472853 onClick = { ( ) => void deleteSingleAgent ( selectedAgent ) }
28482854 disabled = { deletingAgents }
28492855 aria-label = "删除 Agent"
28502856 title = "删除 Agent"
28512857 >
28522858 < Trash2 aria-hidden />
28532859 < span > { deletingAgents ? "删除中…" : "删除 Agent" } </ span >
2854- </ button >
2860+ </ Button >
28552861 ) }
2856- </ div >
2857- ) }
2858- </ div >
2862+ </ >
2863+ ) : undefined }
2864+ sections = { visibleAgentSections . map ( ( item ) => ( {
2865+ key : item . id ,
2866+ label : item . label ,
2867+ disabled : deploymentInProgress ,
2868+ content : item . id === section ? (
2869+ < >
28592870 { deploymentTask && shouldShowDeploymentTask && (
28602871 < div
28612872 className = { `aw-detail-deployment${ deploymentInProgress ? " is-running" : "" } ` }
@@ -2868,50 +2879,7 @@ export function AgentWorkspace({
28682879 />
28692880 </ div >
28702881 ) }
2871- < nav
2872- className = "aw-agent-tabs"
2873- aria-label = "智能体详情"
2874- role = "tablist"
2875- >
2876- { visibleAgentSections . map ( ( item ) => (
2877- < button
2878- type = "button"
2879- key = { item . id }
2880- id = { `agent-${ item . id } -tab` }
2881- className = { section === item . id ? "is-active" : "" }
2882- role = "tab"
2883- aria-selected = { section === item . id }
2884- aria-controls = { `agent-${ item . id } -panel` }
2885- tabIndex = { section === item . id ? 0 : - 1 }
2886- onClick = { ( ) => setSection ( item . id ) }
2887- onKeyDown = { ( event ) => {
2888- if ( ! [ "ArrowLeft" , "ArrowRight" , "Home" , "End" ] . includes ( event . key ) ) return ;
2889- event . preventDefault ( ) ;
2890- const currentIndex = visibleAgentSections . findIndex (
2891- ( sectionItem ) => sectionItem . id === item . id ,
2892- ) ;
2893- const nextIndex = event . key === "Home"
2894- ? 0
2895- : event . key === "End"
2896- ? visibleAgentSections . length - 1
2897- : ( currentIndex + ( event . key === "ArrowRight" ? 1 : - 1 ) + visibleAgentSections . length )
2898- % visibleAgentSections . length ;
2899- const nextSection = visibleAgentSections [ nextIndex ] ;
2900- setSection ( nextSection . id ) ;
2901- document . getElementById ( `agent-${ nextSection . id } -tab` ) ?. focus ( ) ;
2902- } }
2903- >
2904- { item . label }
2905- </ button >
2906- ) ) }
2907- </ nav >
2908-
2909- < div
2910- className = "aw-content"
2911- id = { `agent-${ section } -panel` }
2912- role = "tabpanel"
2913- aria-labelledby = { `agent-${ section } -tab` }
2914- >
2882+ < div className = "aw-content" >
29152883 { section === "basic" && (
29162884 < div className = "aw-basic-stack" >
29172885 { ( detailAgentInfoError || runtimeDetailError ) && (
@@ -3746,6 +3714,13 @@ export function AgentWorkspace({
37463714 </ span >
37473715 </ div >
37483716 ) }
3717+ </ >
3718+ ) : null ,
3719+ } ) ) }
3720+ activeSectionKey = { section }
3721+ navigationLabel = "智能体详情"
3722+ onSectionChange = { setSection }
3723+ />
37493724 </ main >
37503725 ) }
37513726 </ div >
0 commit comments