mirror of
https://github.com/run-llama/nextjs-rsc.git
synced 2026-07-01 21:34:16 -04:00
4e1e986e79
* feat: sync with latest CL * declare use client
25 lines
560 B
TypeScript
25 lines
560 B
TypeScript
import {
|
|
FILE_EXT_TO_READER,
|
|
SimpleDirectoryReader,
|
|
} from "llamaindex/readers/index";
|
|
|
|
export const DATA_DIR = "./data";
|
|
|
|
export function getExtractors() {
|
|
return FILE_EXT_TO_READER;
|
|
}
|
|
|
|
export async function getDocuments() {
|
|
const documents = await new SimpleDirectoryReader().loadData({
|
|
directoryPath: DATA_DIR,
|
|
});
|
|
// Set private=false to mark the document as public (required for filtering)
|
|
for (const document of documents) {
|
|
document.metadata = {
|
|
...document.metadata,
|
|
private: "false",
|
|
};
|
|
}
|
|
return documents;
|
|
}
|