diff --git a/e2e/utils.ts b/e2e/utils.ts index 2ec35e40b9f31dc2b82e8f98d5431de3f45c5d7f..87a6df8e00b14b3ee55a7ccce89779997dab2d1d 100644 --- a/e2e/utils.ts +++ b/e2e/utils.ts @@ -121,7 +121,7 @@ export async function runCreateLlama( "none", ].join(" "); console.log(`running command '${command}' in ${cwd}`); - let appProcess = exec(command, { + const appProcess = exec(command, { cwd, env: { ...process.env, diff --git a/helpers/index.ts b/helpers/index.ts index 70a112444f03b7c4083e23664b007f9fb50c59b0..21d9f86a45976af0a0d18afe996c17b7a2749289 100644 --- a/helpers/index.ts +++ b/helpers/index.ts @@ -70,7 +70,7 @@ const createEnvLocalFile = async ( switch (opts?.dataSource?.type) { case "web": { - let webConfig = opts?.dataSource.config as WebSourceConfig; + const webConfig = opts?.dataSource.config as WebSourceConfig; content += `# web loader config\n`; content += `BASE_URL=${webConfig.baseUrl}\n`; content += `URL_PREFIX=${webConfig.baseUrl}\n`; @@ -102,7 +102,7 @@ const generateContextData = async ( if (framework === "fastapi") { if (hasOpenAiKey && !hasVectorDb && isHavingPoetryLockFile()) { console.log(`Running ${runGenerate} to generate the context data.`); - let result = tryPoetryRun("python app/engine/generate.py"); + const result = tryPoetryRun("python app/engine/generate.py"); if (!result) { console.log(`Failed to run ${runGenerate}.`); process.exit(1); @@ -134,7 +134,7 @@ const copyContextData = async ( ) => { const destPath = path.join(root, "data"); - let dataSourceConfig = dataSource?.config as FileSourceConfig; + const dataSourceConfig = dataSource?.config as FileSourceConfig; // Copy file if (dataSource?.type === "file") { @@ -154,7 +154,7 @@ const copyContextData = async ( // Copy folder if (dataSource?.type === "folder") { - let srcPath = + const srcPath = dataSourceConfig.path ?? path.join(templatesDir, "components", "data"); console.log(`\nCopying data to ${cyan(destPath)}\n`); await copy("**", destPath, { diff --git a/helpers/python.ts b/helpers/python.ts index 39be2f32e8eacbf8b8213558aeb89373770465b8..8047d523543df56fb7eb76130560cad480bad901 100644 --- a/helpers/python.ts +++ b/helpers/python.ts @@ -244,7 +244,7 @@ export const installPythonTemplate = async ({ const dataSourceType = dataSource?.type; if (dataSourceType !== undefined && dataSourceType !== "none") { - let loaderPath = + const loaderPath = dataSourceType === "folder" ? path.join(compPath, "loaders", "python", "file") : path.join(compPath, "loaders", "python", dataSourceType); diff --git a/helpers/run-app.ts b/helpers/run-app.ts index dbadda0badb6102b9a0d9efe076b2f720f23f5be..616787a7398af4fed2bada689a07d0944f01cdbd 100644 --- a/helpers/run-app.ts +++ b/helpers/run-app.ts @@ -33,7 +33,7 @@ export async function runApp( ): Promise<any> { let backendAppProcess: ChildProcess; let frontendAppProcess: ChildProcess | undefined; - let frontendPort = port || 3000; + const frontendPort = port || 3000; let backendPort = externalPort || 8000; // Callback to kill app processes diff --git a/helpers/tools.ts b/helpers/tools.ts index f7b844cbb195bfc4c69ebf390a78d884887df2e3..49559253776d3fef308b130e14a067fd6481db6a 100644 --- a/helpers/tools.ts +++ b/helpers/tools.ts @@ -45,7 +45,7 @@ export const getTool = (toolName: string): Tool | undefined => { }; export const getTools = (toolsName: string[]): Tool[] => { - let tools: Tool[] = []; + const tools: Tool[] = []; for (const toolName of toolsName) { const tool = getTool(toolName); if (!tool) { diff --git a/questions.ts b/questions.ts index c6bf438b0e256055cb3e338e94eed5d65aab8c8e..395773cd0719175a0bf1418a7b6e85cd2004449c 100644 --- a/questions.ts +++ b/questions.ts @@ -108,7 +108,7 @@ const getVectorDbChoices = (framework: TemplateFramework) => { }; const getDataSourceChoices = (framework: TemplateFramework) => { - let choices = [ + const choices = [ { title: "No data, just a simple chat", value: "simple", @@ -159,7 +159,7 @@ const selectLocalContextData = async (type: TemplateDataSourceType) => { } selectedPath = execSync(execScript, execOpts).toString().trim(); if (type === "file") { - let fileType = path.extname(selectedPath); + const fileType = path.extname(selectedPath); if (!supportedContextFileTypes.includes(fileType)) { console.log( red( @@ -204,7 +204,7 @@ export const askQuestions = async ( if (ciInfo.isCI) { program.postInstallAction = getPrefOrDefault("postInstallAction"); } else { - let actionChoices = [ + const actionChoices = [ { title: "Just generate code (~1 sec)", value: "none", @@ -535,7 +535,7 @@ export const askQuestions = async ( if (!baseUrl.includes("://")) { baseUrl = `https://${baseUrl}`; } - let checkUrl = new URL(baseUrl); + const checkUrl = new URL(baseUrl); if (checkUrl.protocol !== "https:" && checkUrl.protocol !== "http:") { throw new Error("Invalid protocol"); } diff --git a/templates/components/vectordbs/typescript/none/index.ts b/templates/components/vectordbs/typescript/none/index.ts index c3b65ce2366f26ad74c4a66f9ce53ab9347fafdd..e335446cfd72e9da910eab3228848e32e1e0475a 100644 --- a/templates/components/vectordbs/typescript/none/index.ts +++ b/templates/components/vectordbs/typescript/none/index.ts @@ -14,7 +14,7 @@ async function getDataSource(llm: LLM) { chunkSize: CHUNK_SIZE, chunkOverlap: CHUNK_OVERLAP, }); - let storageContext = await storageContextFromDefaults({ + const storageContext = await storageContextFromDefaults({ persistDir: `${STORAGE_CACHE_DIR}`, });