Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add multiple data sources #19

Merged
merged 17 commits into from
Mar 27, 2024
2 changes: 1 addition & 1 deletion helpers/python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ export const installPythonTemplate = async ({
});
}

if (dataSources.length > 0 && dataSources[0].type !== "none") {
if (dataSources.length === 0) {
const loaderConfigs: Record<string, any> = {};
const loaderPath = path.join(enginePath, "loaders");

Expand Down
2 changes: 1 addition & 1 deletion helpers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export type TemplateDataSource = {
type: TemplateDataSourceType;
config: TemplateDataSourceConfig;
};
export type TemplateDataSourceType = "none" | "file" | "folder" | "web";
export type TemplateDataSourceType = "file" | "folder" | "web";
export type TemplateObservability = "none" | "opentelemetry";
// Config for both file and folder
export type FileSourceConfig = {
Expand Down
2 changes: 1 addition & 1 deletion helpers/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export const installTSTemplate = async ({

// copy loader component
const dataSourceType = dataSources[0]?.type;
marcusschiesser marked this conversation as resolved.
Show resolved Hide resolved
if (dataSourceType && dataSourceType !== "none") {
if (dataSourceType) {
let loaderFolder: string;
if (dataSourceType === "file" || dataSourceType === "folder") {
loaderFolder = useLlamaParse ? "llama_parse" : "file";
Expand Down
19 changes: 3 additions & 16 deletions questions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -683,12 +683,7 @@ export const askQuestions = async (

if (selectedSource === "none") {
// Selected simple chat
program.dataSources = [
{
type: "none",
config: {},
},
];
program.dataSources = [];
// Stop asking for another data source
break;
}
Expand Down Expand Up @@ -790,10 +785,7 @@ export const askQuestions = async (
}
}

if (
program.dataSources.length === 0 ||
program.dataSources[0].type === "none"
) {
if (program.dataSources.length === 0) {
program.engine = "simple";
} else {
program.engine = "context";
Expand All @@ -809,12 +801,7 @@ export const askQuestions = async (
},
];
} else if (program.engine === "simple") {
program.dataSources = [
{
type: "none",
config: {},
},
];
program.dataSources = [];
}
}

Expand Down
Loading