diff --git a/helpers/datasources.ts b/helpers/datasources.ts index 2735eb8db62de24e6d43505771d20d3cd1cfbabb..c8a47e22154000abf5075cf26bb9b43c108993a6 100644 --- a/helpers/datasources.ts +++ b/helpers/datasources.ts @@ -1,9 +1,12 @@ +import path from "path"; +import { templatesDir } from "./dir"; import { TemplateDataSource } from "./types"; -// Example file has an empty config export const EXAMPLE_FILE: TemplateDataSource = { type: "file", - config: {}, + config: { + path: path.join(templatesDir, "components", "data", "101.pdf"), + }, }; export function getDataSources( diff --git a/helpers/index.ts b/helpers/index.ts index b3ba62b7e04f56dfd64e2e655ffa4f0d54f2d6e5..79ba8dc0438ff13ec6173499f59f1ac77f67a686 100644 --- a/helpers/index.ts +++ b/helpers/index.ts @@ -4,7 +4,6 @@ import path from "path"; import { cyan } from "picocolors"; import fsExtra from "fs-extra"; -import { templatesDir } from "./dir"; import { createBackendEnvFile, createFrontendEnvFile } from "./env-variables"; import { PackageManager } from "./get-pkg-manager"; import { installLlamapackProject } from "./llama-pack"; @@ -79,8 +78,8 @@ const copyContextData = async ( for (const dataSource of dataSources) { const dataSourceConfig = dataSource?.config as FileSourceConfig; // Copy local data - const dataPath = - dataSourceConfig.path ?? path.join(templatesDir, "components", "data"); + const dataPath = dataSourceConfig.path; + const destPath = path.join(root, "data", path.basename(dataPath)); console.log("Copying data from path:", dataPath); await fsExtra.copy(dataPath, destPath); diff --git a/helpers/types.ts b/helpers/types.ts index c1276602c61c3a00e2ad66779c1d1776aaad75d0..c524825dbcffc8fa1b0d78629fffca215efdd777 100644 --- a/helpers/types.ts +++ b/helpers/types.ts @@ -18,7 +18,7 @@ export type TemplateDataSourceType = "file" | "web"; export type TemplateObservability = "none" | "opentelemetry"; // Config for both file and folder export type FileSourceConfig = { - path?: string; + path: string; }; export type WebSourceConfig = { baseUrl?: string;