* docs: add docs and schema for "OS" provider (#1536) * ignore .env * ✨ use and cache imports for autocomplete (#1456) * ✨ use and cache imports for autocomplete * fix tsc * add voyage rerank-1 * import Handlebars * feat: open pane on install (#1564) * feat: open pane on activation * comment out testing code * chore: add telemetry for pageviews (#1576) * feat: update onboarding w/ embeddings model (#1570) * chore(gui): remove unused pages * feat: add embeddings step * feat: update styles * feat: copy button updates * fix: correct pull command for embed model * fix: remove commented code * fix: remove commented code * feat: simplify copy btn props * chore: rename onboarding selection event * feat: add provider config * fix: undo msg name * remove dead code * fix: invalid mode check * fix: remove testing logic * fix: fullscreen gui retains context when hidden, fixed fullscreen focusing (#1582) * small UI tweaks * media query * feat: add best experience onboarding * small fixes * feat: add free trial card to onboarding (#1600) * feat: add free trial card to onboarding * add import * chore: add telemetry for full screen toggle (#1618) * rerank-lite-1 * remove doccs * basic tests for VS Code extension * improved testing of VS Code extension * manually implement stop tokens for hf inference api * chore: onboarding metrics (#1626) * fix: pageview tracking * feat: add onboarding telemetry * create single `onboardingStatus` type * improved var naming * remove console logs * fix windows performance issue * rename vscodeExtension.ts * migration of onboarding variables --------- Co-authored-by: Patrick Erichsen <patrick.a.erichsen@gmail.com> Co-authored-by: Jonah Wagner <jonahwagner231@gmail.com>
40 lines
891 B
TypeScript
40 lines
891 B
TypeScript
import { Chunk } from "../../index.js";
|
|
|
|
const request = require("request");
|
|
|
|
export async function downloadFromS3(
|
|
bucket: string,
|
|
fileName: string,
|
|
region: string,
|
|
): Promise<string> {
|
|
return new Promise<string>((resolve, reject) => {
|
|
let data = "";
|
|
|
|
const download = request({
|
|
url: `https://${bucket}.s3.${region}.amazonaws.com/${fileName}`,
|
|
});
|
|
download.on("response", (response: any) => {
|
|
if (response.statusCode !== 200) {
|
|
reject(new Error("No body returned when downloading from S3 bucket"));
|
|
}
|
|
});
|
|
|
|
download.on("error", (err: any) => {
|
|
reject(err);
|
|
});
|
|
|
|
download.on("data", (chunk: any) => {
|
|
data += chunk;
|
|
});
|
|
|
|
download.on("end", () => {
|
|
resolve(data);
|
|
});
|
|
});
|
|
}
|
|
|
|
export interface SiteIndexingResults {
|
|
chunks: (Chunk & { embedding: number[] })[];
|
|
url: string;
|
|
title: string;
|
|
}
|