mongodb-rag-core
Version:
Common elements used by MongoDB Chatbot Framework components.
26 lines • 933 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.chunkPage = void 0;
const chunkOpenApiSpecYaml_1 = require("./chunkOpenApiSpecYaml");
const chunkMd_1 = require("./chunkMd");
const chunkCode_1 = require("./chunkCode");
/**
Returns chunked of a content page.
*/
const chunkPage = async (page, chunkOptions) => {
// Handle code file formats
if ((0, chunkCode_1.isSupportedLanguage)(page.format)) {
return await (0, chunkCode_1.chunkCode)(page, chunkOptions);
}
// Handle remaining formats
switch (page.format) {
case "openapi-yaml":
return await (0, chunkOpenApiSpecYaml_1.chunkOpenApiSpecYaml)(page, chunkOptions);
case "md": // fallthrough
case "txt": // fallthrough
default:
return await (0, chunkMd_1.chunkMd)(page, chunkOptions);
}
};
exports.chunkPage = chunkPage;
//# sourceMappingURL=chunkPage.js.map