@@ -2,6 +2,7 @@ import { useMemo } from "react";
22import { MessageSquareCode , MoreHorizontal , Plus } from "lucide-react" ;
33import { useIntl } from "react-intl" ;
44import { Card , CardContent , CardHeader } from "@/components/ui/card" ;
5+ import { CardTag } from "@/components/ui/card-tag" ;
56import { Button } from "@/components/ui/button" ;
67import { useQuery } from "@/hooks/useQuery" ;
78import {
@@ -39,16 +40,20 @@ function buildPromptGroups(prompts: Prompt[], restPromptsLabel: string): PromptG
3940 const map = new Map < string , PromptGroup > ( ) ;
4041
4142 for ( const prompt of prompts ) {
42- const slug = prompt . gatewaySlug ?. trim ( ) || restPromptsLabel ;
43- let group = map . get ( slug ) ;
43+ const slug = prompt . gatewaySlug ?. trim ( ) ;
44+ // Namespace the map key so gateway-less prompts (keyed "rest") can never
45+ // merge into a real gateway whose slug happens to equal the localized
46+ // "REST prompts" label. `label` stays purely for display.
47+ const key = slug ? `gateway:${ slug } ` : "rest" ;
48+ let group = map . get ( key ) ;
4449 if ( ! group ) {
4550 group = {
46- key : slug ,
47- label : slug ,
51+ key,
52+ label : slug || restPromptsLabel ,
4853 gatewayId : prompt . gatewayId ,
4954 prompts : [ ] ,
5055 } ;
51- map . set ( slug , group ) ;
56+ map . set ( key , group ) ;
5257 }
5358 group . prompts . push ( prompt ) ;
5459 }
@@ -102,24 +107,19 @@ function PromptGroupCard({ group }: { group: PromptGroup }) {
102107 < CardContent >
103108 < div className = "flex flex-wrap gap-1" >
104109 { visiblePrompts . map ( ( prompt ) => (
105- < span
106- key = { prompt . id }
107- className = "inline-flex items-center rounded bg-tool-badge-bg px-1.5 py-1 text-[10px] font-medium leading-none text-white"
108- title = { getPromptDescription ( prompt ) ?? undefined }
109- >
110+ < CardTag key = { prompt . id } tooltip = { getPromptDescription ( prompt ) } >
110111 { getPromptLabel ( prompt ) }
111- </ span >
112+ </ CardTag >
112113 ) ) }
113114 { remainingCount > 0 && (
114- < span
115- className = "inline-flex items-center rounded bg-tool-badge-bg px-1.5 py-1 text-[10px] font-medium leading-none text-white"
116- title = { intl . formatMessage (
115+ < CardTag
116+ tooltip = { intl . formatMessage (
117117 { id : "prompts.card.morePromptsTitle" } ,
118118 { count : remainingCount } ,
119119 ) }
120120 >
121121 +{ remainingCount }
122- </ span >
122+ </ CardTag >
123123 ) }
124124 </ div >
125125 </ CardContent >
0 commit comments