UNPKG

ai-code-writer

Version:

An AI code writer application using OpenAI APIs for audio transcription and chat completion.

39 lines (38 loc) 1.99 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const Container_1 = __importDefault(require("./DependencyInjection/Container")); class App { static run() { return __awaiter(this, void 0, void 0, function* () { try { if (!process.env.OPENAI_API_KEY) { console.error('OPENAI_API_KEY is not set in environment variables.'); console.error('Please set it directly in your shell before running the command:'); console.error('export OPENAI_API_KEY=your_openai_api_key_here'); console.error('Then run the application using npx:'); console.error('npx ts-node src/index.ts'); // noinspection ExceptionCaughtLocallyJS throw new Error('OPENAI_API_KEY is not set in environment variables'); } yield Container_1.default.startController.start(); } catch (error) { console.error('AI Code Writer runtime error:', error); process.exit(1); } }); } } App.run().then();