Skip to content

Backend for my application. Using FastAPI, combining the google calendar and chatGPT API's

License

Notifications You must be signed in to change notification settings

Valentin387/VGCC_backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VGCC_backend

FastAPI Python GitHub last commit Issues Pull Requests

Backend for a versatile application combining Google Calendar and OpenAI's ChatGPT APIs, using FastAPI.

My tutorial: https://www.youtube.com/watch?v=wN4u0xLywMY

Just run main.py and that's it!

Features

  1. Chat with AI: Utilizes OpenAI's powerful models to answer queries.
  2. Google Calendar Integration: Manage and view your Google Calendar events.
  3. RESTful API: Easily integrate with frontends such as Angular or React.

Structure

VGCC_backend/
│
├── main.py                # Entry point of the application, runs the FastAPI app
├── app/
│   ├── __init__.py        # Initializes the FastAPI app object
│   ├── config.py          # Configuration settings and constants
│   ├── dependencies.py    # Dependency-related items like DB connections
│   ├── routers/           # Contains all router definitions
│   │   ├── __init__.py
│   │   ├── openai_router.py
│   │   └── calendar_router.py
│   └── services/          # Business logic/service layer
│       ├── __init__.py
│       ├── openai_service.py
│       └── calendar_service.py
└── models/
    ├── __init__.py
    ├── openAIModels.py
    └── calendarModels.py

Caution

  • The calendar_service utilizes a file named credentials.json for Google Calendar API authentication:
    • Ensure this file is present as either credentials.json or src/credentials.json depending on the environment setup.
    • The authentication flow cannot be interrupted once started, which might be cumbersome for users.

Docker

docker build -t vgcc_backend .
docker run -d --name vgcc_backend_app -p 8000:8000 vgcc_backend

Integration with Frontend

Frontend requirements:

  • Conversation Chat Interface:

    • Utilize the endpoint /openAI/llm/response for processing user inputs through ChatGPT.
  • Google Calendar Account Management:

    • Manage accounts using the /calendar/authorize endpoint.
    • Fetch events with /calendar/get-calendar-events using calendar input for dates in the format YYYY-MM-DDThh:mm:ssZ.
  • Application Context Reset:

    • Reset all settings using /calendar/delete-tokens, /openAI/delete-text, and /openAI/create-text endpoints.

Running the Application

To run the application:

uvicorn main:app --reload

This will host the API on http://127.0.0.1:8000 by default, accessible via your specified front-end application.

Documentation

Access detailed API documentation generated by FastAPI at http://127.0.0.1:8000/docs after running the application.

About

Backend for my application. Using FastAPI, combining the google calendar and chatGPT API's

Resources

License

Stars

Watchers

Forks

Packages

No packages published