diff --git a/.github/workflows/deploy_lambda.yml b/.github/workflows/deploy_lambda.yml new file mode 100644 index 00000000..17b27c69 --- /dev/null +++ b/.github/workflows/deploy_lambda.yml @@ -0,0 +1,36 @@ +name: Deploy Lambda Function + +on: + push: + branches: + - chat-box # Trigger the workflow on push to the main branch + +jobs: + build-and-deploy: + runs-on: ubuntu-latest # Set the runner to Ubuntu + + steps: + - name: Checkout code + uses: actions/checkout@v2 # Checks out your repository under $GITHUB_WORKSPACE + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: '20' # Set this to the Node.js version you are using + + - name: Install dependencies + run: npm install # Install dependencies defined in package.json + + - name: Zip Lambda function + run: zip -r function.zip . # Zip all files in the project directory including node_modules + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} # Set up your AWS credentials as secrets + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-1 # Your Lambda function's AWS region + + - name: Deploy to AWS Lambda + run: aws lambda update-function-code --function-name my-lambda-function --zip-file fileb://function.zip + # Replace 'my-lambda-function' with your actual Lambda function name diff --git a/chat.html b/chat.html new file mode 100644 index 00000000..640455b8 --- /dev/null +++ b/chat.html @@ -0,0 +1,51 @@ + + + + + + Chatbot Page + + + +

Welcome to My Chatbot

+
+ + + + + + diff --git a/package.json b/package.json new file mode 100644 index 00000000..16b9cd8d --- /dev/null +++ b/package.json @@ -0,0 +1,29 @@ +{ + "name": "lambda-openai-chatbot", + "version": "1.0.0", + "description": "A Lambda function to handle requests and interact with OpenAI's API.", + "main": "index.js", + "scripts": { + "test": "echo \"No tests specified\" && exit 0" + }, + "dependencies": { + "openai": "^2.0.1" + }, + "author": "", + "license": "ISC" +} +{ + "name": "lambda-openai-chatbot", + "version": "1.0.0", + "description": "A Lambda function to handle requests and interact with OpenAI's API.", + "main": "index.js", + "scripts": { + "test": "echo \"No tests specified\" && exit 0" + }, + "dependencies": { + "openai": "^2.0.1" + }, + "author": "", + "license": "ISC" +} +