AelfGPT is a powerful tool designed to enhance the development experience for Aelf blockchain developers. This application integrates advanced AI technologies to offer intelligent code debugging, code generation, and blockchain exploration functionalities.
aelf-gpt-demo.mp4
-
Smart Contract Debugger: Analyze and debug Aelf smart contract code written in C#. Get detailed insights into potential issues and suggestions for code improvements.
-
Smart Contract Generator: Generate and enhance Aelf smart contract code based on user input. Receive AI-driven suggestions for code enhancements.
-
Chat with Aelf Documentation: Interact with the Aelf documentation through an AI-powered chat interface. Ask questions and get responses based on the Aelf documentation.
-
Aelf Block Explorer: Explore and retrieve Aelf blockchain data, including:
- Chain Status: View the current status of the blockchain.
- Block Information: Retrieve block information by block hash or block height.
- Transaction Details: Get details of specific transactions.
- Transaction Pool Status: Check the status of transactions in the pool.
-
Fork this repository on GitHub to your own account.
-
Clone your forked repository:
git clone https://github.com/your-username/aelfgpt.git cd aelfgpt
Create a .env
file in the root directory of your project using the provided example:
-
Copy the example
.env
file:cp .env.example .env
-
Fill in the environment variables:
- MONGODB_CONN_URI: Your MongoDB connection URI.
- EDEN_AI_API_KEY: Your Eden AI API key. Obtain it from Eden AI.
- AI_ML_API_KEY: Your GPT-4 API key from AIML API.
- GOOGLE_API_KEY: Your Google API key from Google Cloud.
Install the required dependencies:
pip install -r requirements.txt
-
Run the Jupyter notebook provided to create and store embeddings into MongoDB.
-
Configure MongoDB Atlas:
-
Create a Vector Search:
-
Go to MongoDB Atlas and navigate to the search section.
-
Create a new vector search with the provided JSON configuration:
{ "fields": [ { "numDimensions": 1536, "path": "embedding", "similarity": "cosine", "type": "vector" } ] }
-
-
Create Atlas Search:
- Select the
docs
collection and create an Atlas Search. - This process may take 1-2 minutes. Once done, your vector search should have status 'Active' and its ready for use.
- Select the
-
Run the Streamlit application:
streamlit run Home.py
This guide provides step-by-step instructions to deploy your Streamlit application on Google Cloud Platform (GCP) using Cloud Run.
- Google Cloud Account: If you don't have a Google Cloud account, create one here.
-
Create a Google Cloud Project:
- Sign in to the Google Cloud Console.
- Create a new project or select an existing one.
- Enable the billing account (free trial recommended to avoid unintended costs).
-
Clone the Repository:
git clone https://github.com/codingis4noobs2/aelfGPT.git cd aelfGPT
-
Authenticate with Google Cloud:
gcloud auth login
-
Initialize Your Project:
gcloud init
-
Dockerfile: Create a
Dockerfile
with the following content:# Use an official Python runtime as a parent image FROM python:3.10-slim # Set the working directory in the container WORKDIR /app # Copy the requirements file into the container COPY requirements.txt /app/ # Install the required dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy the rest of the application code into the container COPY . /app # Expose the port that the app runs on EXPOSE 80 # Command to run the app CMD ["streamlit", "run", "Home.py", "--server.enableCORS", "false", "--browser.serverAddress", "0.0.0.0", "--browser.gatherUsageStats", "false", "--server.port", "80"]
-
app.yaml: Create an
app.yaml
file with the following content:runtime: python310 entrypoint: streamlit run Home.py --server.enableCORS false --browser.serverAddress 0.0.0.0 --browser.gatherUsageStats false --server.port $PORT
-
Build the Container:
gcloud builds submit --tag gcr.io/PROJECT-ID/streamlit-app
Replace
PROJECT-ID
with your actual project ID, which can be found in the top left dropdown in the Google Cloud Console. -
Deploy the Container:
gcloud run deploy --image gcr.io/PROJECT-ID/streamlit-app --platform managed --allow-unauthenticated
If you encounter the error Cloud Run – Failed to start and then listen on the port defined by the PORT
:
- Execute the following command:
docker buildx build --platform linux/amd64 -t {project-name} .
- Then, redeploy the container.
You can also deploy the container via the Cloud Run UI in the Google Cloud Console:
- Navigate to Cloud Run
- Click on create "+ Create Service" Button.
- In the Cloud Run UI, select the latest container image and enter a service name for the application.
- Click on the radio button "Allow unauthenticated invocations" so that others can visit your app.
- Select the appropriate machine configuration based on your estimated traffic handling and click "Create."
You will receive a link to your application in a few minutes.
Contributions are welcome! Please open an issue or submit a pull request if you have suggestions or improvements.