Skip to content

Latest commit

ย 

History

History
272 lines (215 loc) ยท 7.24 KB

File metadata and controls

272 lines (215 loc) ยท 7.24 KB

Personal CIA

An AI-powered business intelligence and market research application that leverages Auto-GPT to conduct automated research missions. Personal CIA helps entrepreneurs and businesses gather competitive intelligence, market insights, and strategic analysis through autonomous AI agents.

๐ŸŽฏ Features

  • Automated Research Missions: Create custom research tasks that Auto-GPT executes autonomously
  • Mission Dashboard: Track and manage multiple research missions with real-time status updates
  • AI-Powered Summaries: Generate comprehensive summaries from multiple research outputs using OpenAI
  • Flexible Research Parameters: Configure research scope, timeframe, business type, and focus areas
  • Mission Management: View, filter, and delete completed or failed missions
  • Status Tracking: Monitor missions with three states: Processing, Completed, and Failed

๐Ÿ› ๏ธ Technology Stack

Backend

  • Flask - Python web framework for REST API
  • Flask-CORS - Cross-origin resource sharing
  • OpenAI API - GPT-3 integration for summarization
  • Auto-GPT - Autonomous AI agent for research execution

Frontend

  • React 18 - UI framework
  • Material-UI (MUI) - Component library
  • React Router - Navigation
  • Create React App - Build tooling

๐Ÿ“‹ Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js (v14 or higher) and npm
  • Python 3 (v3.8 or higher)
  • Flask
  • Auto-GPT (installation guide)
  • OpenAI API Key

๐Ÿš€ Installation

1. Clone the Repository

git clone https://github.com/CodeamonCat/Personal_CIA.git
cd Personal_CIA

2. Backend Setup

Install Python Dependencies

pip install flask flask-cors openai

Configure OpenAI API Key

Create a file at backend/openai.api_key and add your OpenAI API key:

echo "your-openai-api-key-here" > backend/openai.api_key

Configure Auto-GPT Path

Edit backend/app.py and update the AUTO_GPT_PATH variable to point to your Auto-GPT installation:

AUTO_GPT_PATH = '/path/to/your/Auto-GPT'

3. Frontend Setup

Install Dependencies

cd web
npm install
cd ..

Or install from the root directory:

npm install --prefix ./web/

๐ŸŽฎ Usage

Starting the Application

You'll need two terminal windows to run both the backend and frontend.

Terminal 1: Start the Backend (Flask API)

sh flask_init.sh

The backend server will start on http://localhost:5000

Terminal 2: Start the Frontend (React App)

npm start --prefix ./web/

The web application will open automatically at http://localhost:3000

Using the Application

  1. Access the Dashboard: Navigate to http://localhost:3000 and click "LOG IN"
  2. Create a New Mission: Click "Add new session" to create a research mission
  3. Configure Research Parameters:
    • Search timeframe (start and end dates)
    • Number of attempts (0 = unlimited)
    • Business type (B2B, B2C, P2P)
    • Business description (1-2 sentences)
    • Business focus (geo location, age group, income group, industry)
    • Research type (market size, competitors, trends, etc.)
  4. Submit: Click "Start Search" to launch the mission
  5. Monitor Progress: Return to the dashboard to track mission status
  6. Generate Summaries: Select completed missions and click "Summarize" to generate an AI summary

๐Ÿ”Œ API Endpoints

All endpoints return JSON responses.

Create New Mission

POST /api/new_mission

Request Body:

{
  "businessDescription": "string - user's research prompt",
  "numberOfAttempts": "int - number of attempts"
}

Response:

{
  "name": "string",
  "date": "YYYY-MM-DD-HH:MM:SS",
  "status": 0
}

List All Missions

GET /api/missions

Response:

[
  {
    "id": 0,
    "selected": false,
    "name": "string",
    "status": "Completed|Processing|Failed",
    "createdAt": "YYYY-MM-DD-HH:MM:SS"
  }
]

Check Mission Progress

GET /api/scan_process

Response:

{
  "agent_status": [0, 1, -1, ...]
}

Status codes: 1 = Completed, 0 = Processing, -1 = Failed

Delete Mission

POST /api/delete_mission

Request Body:

{
  "index": "int - mission index"
}

Generate Summary

POST /api/summary

Request Body:

{
  "indices": [0, 1, 2]
}

Response:

{
  "summary": "string - AI-generated summary"
}

Get Summary Text

GET /get_text

Response:

{
  "text": "string - content from summary.txt"
}

๐Ÿ“ Project Structure

Personal_CIA/
โ”œโ”€โ”€ backend/
โ”‚   โ”œโ”€โ”€ app.py              # Main Flask application
โ”‚   โ”œโ”€โ”€ server.py           # Alternative server (development)
โ”‚   โ”œโ”€โ”€ summary.txt         # Sample summary output
โ”‚   โ””โ”€โ”€ openai.api_key      # OpenAI API key (not tracked)
โ”œโ”€โ”€ web/
โ”‚   โ”œโ”€โ”€ public/             # Static assets
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ Containers/     # React page components
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Landing.js  # Landing page
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Dashboard.js # Mission dashboard
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Session.js   # New mission form
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ...
โ”‚   โ”‚   โ”œโ”€โ”€ App.js          # Main React component
โ”‚   โ”‚   โ””โ”€โ”€ index.js        # React entry point
โ”‚   โ””โ”€โ”€ package.json        # Frontend dependencies
โ”œโ”€โ”€ flask_init.sh           # Backend startup script
โ”œโ”€โ”€ package.json            # Root package.json
โ””โ”€โ”€ README.md              # This file

๐ŸŽฅ Demo

Personal_CIA_demo.mp4

โš™๏ธ Configuration

Debug Mode

To enable debug mode in the backend, edit backend/app.py:

debug_mode = True  # Set to True to skip Auto-GPT execution

CORS Configuration

The backend is configured to accept requests from http://localhost:3000. To change this, edit the CORS settings in backend/app.py:

app.config['CORS_RESOURCES'] = {r"/api/*": {"origins": "your-origin-here"}}

OpenAI Model Configuration

Adjust OpenAI parameters in backend/app.py:

model = "text-davinci-003"  # OpenAI model
temperature = 0.5           # Creativity level (0.0 - 1.0)
max_tokens = 4096          # Maximum response length

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

๐Ÿ“ License

This project is open source and available under the MIT License.

๐Ÿ› Troubleshooting

Backend Issues

  • Error: OpenAI API key not found: Ensure backend/openai.api_key exists and contains a valid API key
  • Error: Auto-GPT path invalid: Update AUTO_GPT_PATH in backend/app.py to point to your Auto-GPT installation
  • CORS errors: Verify the frontend is running on http://localhost:3000 or update CORS settings

Frontend Issues

  • Cannot connect to backend: Ensure the Flask server is running on port 5000
  • Dependencies missing: Run npm install in the web directory
  • Port 3000 already in use: Stop other applications using port 3000 or specify a different port

๐Ÿ“ง Support

For issues and questions, please open an issue on the GitHub repository.