diff --git a/src/components/GenerateRoadmap/GenerateRoadmap.tsx b/src/components/GenerateRoadmap/GenerateRoadmap.tsx index 174e8c3b5..e935e3a07 100644 --- a/src/components/GenerateRoadmap/GenerateRoadmap.tsx +++ b/src/components/GenerateRoadmap/GenerateRoadmap.tsx @@ -35,6 +35,7 @@ import { cn } from '../../lib/classname.ts'; import { RoadmapTopicDetail } from './RoadmapTopicDetail.tsx'; import { AIRoadmapAlert } from './AIRoadmapAlert.tsx'; import { OpenAISettings } from './OpenAISettings.tsx'; +import { IS_KEY_ONLY_ROADMAP_GENERATION } from '../../lib/ai.ts'; export type GetAIRoadmapLimitResponse = { used: number; @@ -104,6 +105,7 @@ export function GenerateRoadmap() { const [isConfiguring, setIsConfiguring] = useState(false); const openAPIKey = getOpenAIKey(); + const isKeyOnly = IS_KEY_ONLY_ROADMAP_GENERATION; const renderRoadmap = async (roadmap: string) => { const { nodes, edges } = generateAIRoadmapFromText(roadmap); @@ -372,6 +374,7 @@ export function GenerateRoadmap() { limit={roadmapLimit} limitUsed={roadmapLimitUsed} loadAIRoadmapLimit={loadAIRoadmapLimit} + isKeyOnly={isKeyOnly} onLoadTerm={(term: string) => { setRoadmapTerm(term); loadTermRoadmap(term).finally(() => {}); @@ -427,63 +430,93 @@ export function GenerateRoadmap() { )} {!isLoading && ( -
+ We do not store your API key on our servers. +
+ {hasError && (Please enter a valid OpenAI API key diff --git a/src/components/GenerateRoadmap/RoadmapSearch.tsx b/src/components/GenerateRoadmap/RoadmapSearch.tsx index 1797608c5..152b067cc 100644 --- a/src/components/GenerateRoadmap/RoadmapSearch.tsx +++ b/src/components/GenerateRoadmap/RoadmapSearch.tsx @@ -21,6 +21,7 @@ type RoadmapSearchProps = { onLoadTerm: (topic: string) => void; limit: number; limitUsed: number; + isKeyOnly: boolean; }; export function RoadmapSearch(props: RoadmapSearchProps) { @@ -32,16 +33,18 @@ export function RoadmapSearch(props: RoadmapSearchProps) { limitUsed = 0, onLoadTerm, loadAIRoadmapLimit, + isKeyOnly, } = props; const canGenerateMore = limitUsed < limit; const [isConfiguring, setIsConfiguring] = useState(false); const openAPIKey = getOpenAIKey(); + const isAuthenticatedUser = isLoggedIn(); const randomTerms = ['OAuth', 'APIs', 'UX Design', 'gRPC']; return ( -
- You have generated{' '} - - {limitUsed} of {limit} - {' '} - roadmaps. -
-- {limit > 0 && !isLoggedIn() && ( + {!isAuthenticatedUser && ( +
- {limit > 0 && isLoggedIn() && !openAPIKey && (
-
+
- By-pass all limits by{' '}
-
- adding your own OpenAI API key
-
-
+ Explore AI Generated Roadmaps
+ We have hit the limit for AI roadmap generation. Please try
+ again later or{' '}
+
+ You have added your own OpenAI API key.{' '}
+
+ You have generated{' '} + + {limitUsed} of {limit} + {' '} + roadmaps. +
+ {isAuthenticatedUser && ( +
+ {!openAPIKey && (
+