forked from CopilotKit/CopilotKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-content.ts
More file actions
31 lines (27 loc) · 828 Bytes
/
Copy pathsetup-content.ts
File metadata and controls
31 lines (27 loc) · 828 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
export interface SetupContentEntry {
framework: string;
concept: string;
source: string;
}
export interface SetupContentBundle {
version: 1;
concepts: Record<string, SetupContentEntry>;
}
export function setupContentKey(framework: string, concept: string): string {
return `${framework}::${concept}`;
}
const SETUP_CONTENT_FALLBACKS: Record<string, string[]> = {
"langgraph-fastapi": ["langgraph-python"],
};
export function resolveBundledSetupConcept(
framework: string,
concept: string,
bundle: SetupContentBundle,
): string | null {
const candidates = [framework, ...(SETUP_CONTENT_FALLBACKS[framework] ?? [])];
for (const candidate of candidates) {
const source = bundle.concepts[setupContentKey(candidate, concept)]?.source;
if (source !== undefined) return source;
}
return null;
}