Skip to content
Snippets Groups Projects
Commit 4f10840f authored by Marcus Schiesser's avatar Marcus Schiesser
Browse files

fix: word-smith YAML comments

parent 9ca343c3
No related branches found
No related tags found
No related merge requests found
...@@ -253,7 +253,7 @@ export const installPythonTemplate = async ({ ...@@ -253,7 +253,7 @@ export const installPythonTemplate = async ({
}); });
} }
const loaderConfigs = new Document({}); const loaderConfig = new Document({});
const loaderPath = path.join(enginePath, "loaders"); const loaderPath = path.join(enginePath, "loaders");
// Copy loaders to enginePath // Copy loaders to enginePath
...@@ -275,27 +275,28 @@ export const installPythonTemplate = async ({ ...@@ -275,27 +275,28 @@ export const installPythonTemplate = async ({
depth: dsConfig.depth, depth: dsConfig.depth,
}; };
}); });
// Create YamlNode from array of YAMLMap // Add documentation to web loader config
const node = loaderConfigs.createNode(webLoaderConfig); const node = loaderConfig.createNode(webLoaderConfig);
node.commentBefore = ` node.commentBefore = ` base_url: The URL to start crawling with
Config for web loader prefix: Only crawl URLs matching the specified prefix
- base_url: The url to start crawling with depth: The maximum depth for BFS traversal
- prefix: the prefix of next URLs to crawl You can add more websites by adding more entries (don't forget the - prefix from YAML)`;
- depth: the maximum depth in DFS loaderConfig.set("web", node);
You can add more web loaders by adding more config below`;
loaderConfigs.set("web", node);
} }
// File loader config // File loader config
if (dataSources.some((ds) => ds.type === "file")) { if (dataSources.some((ds) => ds.type === "file")) {
loaderConfigs.set("file", { // Add documentation to web loader config
const node = loaderConfig.createNode({
use_llama_parse: useLlamaParse, use_llama_parse: useLlamaParse,
}); });
node.commentBefore = ` use_llama_parse: Use LlamaParse if \`true\`. Needs a \`LLAMA_CLOUD_API_KEY\` from https://cloud.llamaindex.ai set as environment variable`;
loaderConfig.set("file", node);
} }
// Write loaders config // Write loaders config
if (Object.keys(loaderConfigs).length > 0) { if (Object.keys(loaderConfig).length > 0) {
const loaderConfigPath = path.join(root, "config/loaders.yaml"); const loaderConfigPath = path.join(root, "config/loaders.yaml");
await fs.mkdir(path.join(root, "config"), { recursive: true }); await fs.mkdir(path.join(root, "config"), { recursive: true });
await fs.writeFile(loaderConfigPath, yaml.stringify(loaderConfigs)); await fs.writeFile(loaderConfigPath, yaml.stringify(loaderConfig));
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment