Skip to content

Latest commit

Β 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Chatbot AI πŸ€–

Welcome to this repository. This is a "so-so" Chatbot AI hosted to AWS Service.

Frontend Setup

This project need an environment variable during the build phase. Never upload the .env file to the Git repository or you will lose the point.

NEXT_PUBLIC_COGNITO_AUTHORITY="YOUR_COGNITO_IDP_URL"
NEXT_PUBLIC_COGNITO_CLIENT_ID="YOUR_COGNITO_APP_CLIENT_ID"
NEXT_PUBLIC_REDIRECT_URI="YOUR_AMPLIFY_URL/login/callback"
NEXT_PUBLIC_APIGW_URL="YOUR_API_GATEWAY_URL"

Backend Setup

API Endpoint

You need to configure API Endpoint. The specification you can check on Document detail.

Single Conversation Format

{
    "conversation": {
        "role": "user" | "assistant",
        "content": "Hello, there?"
    }
}

{uid} is User ID (Generated when user is registered to cognito) and {id} is Conversation ID (Generate using UUID)

Lambda Source Code

You can use all Lambda requirements in /serverless/src but don't forget to configure your database in the next section.

Database Configuration

For storing all conversation, we need database. Now, we're using DynamoDB. This is a schema of database configuration:

  • Primary Key: user_id (string | uuid)

  • Sort Key: conversation_id (string | uuid)

  • Keys: created_at (ISO String), updated_at (ISO String), messages (array)

messages Format

{
    "messages": [{
        "role": "user",
        "content": "Siapa presiden ketujuh indonesia?"
    }, {
        "role": "assistant",
        "content": "Presiden ke-7 Indonesia adalah **Joko Widodo**, atau yang sering disebut Jokowi."
    }, ...]
}

AI Worker Setup

All configurations for AI Worker should be managed using Ansible playbook for automated configuration. You can use the playbook located at /serverless/playbook.yml for automate the configuration. Before running, you need to adjust the necessary variables for s3_filesystem_id.

You can execute the playbook using AWS System Manager (SSM).

About

Create your own Chatbot AI using AWS Services! πŸ˜±πŸ€–

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages