Skip to content

bmercan/ChatGPTClone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chat GPT Mobile App

App for Chat GPT, This project build with flutter and Dall-E 2 will be added.

Packages used in this project


Before You Start

You have to create .env file into base of your project and give your OpenAI API Key as BEARER = 'API_KEY'

OR

Go to file lib/config/constants/api_constants.dart then

Change this

import 'package:flutter_dotenv/flutter_dotenv.dart' show dotenv; // Remove this line

class APIConstants {
     //..
     static String authToken = 'Bearer ${dotenv.env['BEARER_TOKEN']}'
     //..
}

to this

class APIConstants {
     //..
     static String authToken = 'Bearer API_KEY'
     //..
}

Hive

I used hive for save chat history. I firstly tried save history of messages as List<Message?> but because of limitation of Dart it was not possible to save generic list to Hive so i created a Class named HiveChatModel and saved it as is.

class HiveChatModel{
  String? title;
  DateTime? date;
  List<Message?>? chat;
}

Ability to load history messages and continue to chat then saved it again i used Hive.put()

Hive.put(sesionName,messages)

when you load a chat, you also get sessionName

sessionName is generated as session_${lengthOfHiveHistoryList}


Screenshots

rmb rml

Releases

No releases published

Packages

No packages published