mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
32 lines
828 B
TypeScript
32 lines
828 B
TypeScript
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;
|
|
}
|