GithubHelp home page GithubHelp logo

youngtiger1 / django-chatbot-auth Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jezbravo/django-chatbot

0.0 0.0 0.0 44 KB

ChatGPT Clone

Home Page: https://django-chatbot-production.up.railway.app/login

Python 60.56% HTML 39.20% Procfile 0.24%

django-chatbot-auth's Introduction

DJANGO CHATBOT

Description

This is a general-purpose chatbot application, similar to Open AI's famous ChatGPT, but instead uses Google's Gemini 1.0 Pro model. It also has the advantage of being able to be configured to provide personalized responses.

Stack

  • HTML
  • CSS
  • Django
  • PostrgeSQL
  • Railway

Setup

First of all you must clone the repository:

git clone https://github.com/jezbravo/django-chatbot.git
cd django-chatbot

Create a virtual environment to install dependencies in and activate it:

python.exe -m venv venv
.\venv\Scripts\activate

Then install the dependencies:

(venv)pip install -r requirements.txt

Note the (venv) in front of the prompt. This indicates that this terminal session operates in a virtual environment set up by "venv".

Environment Variables

To make the program work, it is necessary to configure the following environment variables in an .env file at the root of the project:

SECRET_KEY=
GENAI_API_KEY=
DATABASE_URL=

The SECRET_KEY is the Django project key and can be generated by:

(venv)python.exe .\manage.py shell

from django.core.management.utils import get_random_secret_key
print(get_random_secret_key())

The GENAI_API_KEY and the DATABASE_URL are provided by the Google API and by the database service (in this case, PostgreSQL) respectively.

Database configuration

Perform the migration of the tables:

(venv)python.exe .\manage.py migrate

Once everything is ready:

(venv)python.exe .\manage.py runserver

And navigate to: http://localhost:8000/login

Additional settings

Administrator credentials

Run the following command:

(venv)python.exe .\manage.py createsuperuser

and follow the instructions. Then navigate to: http://localhost:8000/admin and log in to manage the project from the Django administration panel.

AI Assistant Name and Custom Responses

In the views.py file from "chatbot" folder, edit the ask_genai function, for example:

   {
        "role": "user",
        "parts": ["You are an AI virtual assistant. Your name is Luna."]
    },

Walkthrough

There are two simple login and register templates to access the chat page. Once inside, the virtual assistant will answer all questions and each user's conversation history will be stored privately so they can consult it. You can test a version deployed to production at the following link: https://django-chatbot-production.up.railway.app/login

django-chatbot-auth's People

Contributors

jezbravo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.