Giter Club home page Giter Club logo

chat-yw's Introduction

ChatGPT Clone

This project is a ChatGPT clone that allows users to chat with an AI language model trained by OpenAI. It's powered by the github.com/orhanerday/OpenAI php library, which provides an easy-to-use interface for communicating with the OpenAI API.

Important Notice

This project was created to highlight the Stream Example feature of OpenAI GPT-3 Api Client in PHP by Orhan Erday, please don't have too high expectations about the project.

Using Docker


Clone this repository to your local machine

git clone https://github.com/mentorwan/Chat-YW.git

Navigate to the project directory

cd ChatGPT

Build the image

docker build -t chatgpt .

Run the app

docker run -p 80:80 -e OPENAI_API_KEY=<key> chatgpt

Open your web browser and go

http://localhost


Configuration

Environment Variable Description Default Value
OPENAI_API_KEY API key for the OpenAI API. None (required)
OPENAI_MODEL Name of the OpenAI model to use. gpt-3.5-turbo
OPENAI_TEMPERATURE Temperature value for generating text using the OpenAI API. 1.0
OPENAI_MAX_TOKENS Maximum number of tokens to generate when using the OpenAI API. 100
OPENAI_FREQUENCY_PENALTY Frequency penalty value when generating text using the OpenAI API. 0.0
OPENAI_PRESENCE_PENALTY Presence penalty value when generating text using the OpenAI API. 0.0
DB_FILE Path to the SQLite database file. db.sqlite

Prerequisites

Before running this project, you should have the following:

  • PHP 7.4 or later with SQLite3 enabled
  • Composer
  • An OpenAI API key (which should be set to the $open_ai_key variable in event-stream.php) Getting Started

Get Started

Enable sqlite3

  • Open the php.ini file. This file is usually located in the PHP installation directory.

  • Find the following line: ;extension=php_sqlite3.dll

  • Remove the semicolon at the beginning of the line to uncomment it.

  • Save the file.

  • Restart the web server.

  • Clone this repository to your local machine

git clone https://github.com/orhanerday/ChatGPT.git
  • Navigate to the project directory

cd ChatGPT
  • Install OrhanErday/OpenAI

composer require orhanerday/open-ai
  • Set your OpenAI API key as the $open_ai_key variable in event-stream.php

$open_ai_key = ""; 
  • Start the PHP built-in web server

php -S localhost:80 -t .
  • Open your web browser and go to http://localhost

  • You should now see the ChatGPT clone interface, where you can chat with the OpenAI language model.

Chat History

This project saves chat history using cookies by default. If you want to change this to use authentication instead, you can modify the code in index.php to save chat history in a database or other storage mechanism.

Credits

This project is forked from the github.com/orhanerday/OpenAI php library, which provides an easy-to-use interface for communicating with the OpenAI API.

chat-yw's People

Contributors

mentorwan avatar orhanerday avatar abcdog-code avatar thomasleveil avatar orhan-cmd avatar

chat-yw's Issues

Interface update

This issue will document interface update. It will keep updating if three is a new item.

  1. Update msg header with old format which has icon.

Feat: Support memory for each mode and others

  1. The current implementation supports memory for the last 5 questions/responses, but this may be subject to change in the future.
  2. On desktop, it will display the number of questions that have been responded to. If there is a reconnection for any reason, the database will be cleared and the number of answered questions will reset to 1. This status message does not appear on mobile.

Side navigation drawer for mobile

Implement something like twitter mobile, If you drag side bar from left, it will show options. If you drag back, the side bar will disappear.

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.