@@ -72,6 +72,7 @@ function ApiDetails(props) {
7272 const [ loading , setLoading ] = useState ( false )
7373 const [ showMoreActions , setShowMoreActions ] = useState ( false )
7474 const setSelectedSampleApi = PersistStore ( state => state . setSelectedSampleApi )
75+ const allCollections = PersistStore ( state => state . allCollections )
7576 const [ disabledTabs , setDisabledTabs ] = useState ( [ ] )
7677 const [ description , setDescription ] = useState ( "" )
7778 const [ headersWithData , setHeadersWithData ] = useState ( [ ] )
@@ -608,21 +609,31 @@ function ApiDetails(props) {
608609 < Text variant = "headingSm" fontWeight = "semibold" >
609610 Detected Prompt Template
610611 </ Text >
611- < Box background = "bg-surface" padding = "2" borderRadius = "1" style = { { minHeight : '200px' } } >
612- < SampleData
613- data = { {
614- message : detectedBasePrompt ,
615- vulnerabilitySegments : func . findPlaceholders ( detectedBasePrompt )
616- } }
617- editorLanguage = "plaintext"
618- readOnly = { true }
619- minHeight = "200px"
620- wordWrap = { true }
621- />
622- </ Box >
623- < Text variant = "bodySm" color = "subdued" >
624- Auto-detected prompt template with placeholders from agent traffic. This template represents the common structure of prompts sent to this endpoint.
625- </ Text >
612+ { detectedBasePrompt ? (
613+ < >
614+ < Box background = "bg-surface" padding = "2" borderRadius = "1" style = { { minHeight : '200px' } } >
615+ < SampleData
616+ data = { {
617+ message : detectedBasePrompt ,
618+ vulnerabilitySegments : func . findPlaceholders ( detectedBasePrompt )
619+ } }
620+ editorLanguage = "plaintext"
621+ readOnly = { true }
622+ minHeight = "200px"
623+ wordWrap = { true }
624+ />
625+ </ Box >
626+ < Text variant = "bodySm" color = "subdued" >
627+ Auto-detected prompt template with placeholders from agent traffic. This template represents the common structure of prompts sent to this endpoint.
628+ </ Text >
629+ </ >
630+ ) : (
631+ < Box padding = "4" >
632+ < Text variant = "bodyMd" color = "subdued" >
633+ No prompt template detected yet. The base prompt template will be automatically detected from agent traffic when requests are made to this endpoint.
634+ </ Text >
635+ </ Box >
636+ ) }
626637 </ VerticalStack >
627638 </ Box >
628639 </ VerticalStack >
@@ -829,6 +840,20 @@ function ApiDetails(props) {
829840 </ VerticalStack >
830841 )
831842
843+ // Check if collection has gen-ai tag (same pattern as CreateGuardrailModal.jsx)
844+ const hasGenAiTag = ( ) => {
845+ if ( ! apiDetail ?. apiCollectionId || ! allCollections ) return false ;
846+ const collection = allCollections . find ( c => c . id === apiDetail . apiCollectionId ) ;
847+ if ( ! collection ) return false ;
848+
849+ return collection . envType && collection . envType . some ( envType =>
850+ envType . keyName === 'gen-ai'
851+ ) ;
852+ } ;
853+
854+ // Always show BasePromptTab for AI agents (collections with gen-ai tag)
855+ const shouldShowBasePromptTab = hasGenAiTag ( ) ;
856+
832857 const components = showForbidden
833858 ? [ < Box padding = "4" key = "forbidden" > < ForbiddenRole /> </ Box > ]
834859 : [
@@ -838,7 +863,7 @@ function ApiDetails(props) {
838863 tabs = { [
839864 ValuesTab ,
840865 SchemaTab ,
841- ...( detectedBasePrompt ? [ BasePromptTab ] : [ ] ) ,
866+ ...( shouldShowBasePromptTab ? [ BasePromptTab ] : [ ] ) ,
842867 ...( hasIssues ? [ IssuesTab ] : [ ] ) ,
843868 ApiCallStatsTab ,
844869 DependencyTab
0 commit comments