Skip to content

Jay-Ubisse/AI-Readme

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 

Repository files navigation


ChatGPT-App-React-Native-TypeScript

โ—ฆ Unleash your creativity with ChatGPT-App!

โ—ฆ Developed with the software and tools listed below.

JavaScript Nodemon React OpenAI TypeScript Expo Express Markdown JSON

GitHub top language GitHub code size in bytes GitHub commit activity GitHub license


๐Ÿ“’ Table of Contents


๐Ÿ“ Overview

The ChatGPT App is a React Native mobile application that allows users to have interactive conversations with an AI language model powered by OpenAI's GPT-3 technology. The app provides a user-friendly interface for sending messages and receiving AI-generated responses. The core functionalities include managing chat messages, navigating between screens, and handling API requests to fetch or send messages. The purpose of the project is to provide a seamless and engaging user experience for interacting with the AI model, enhancing communication capabilities, and showcasing the potential of conversational AI. Overall, the app offers a convenient and novel way for users to access and leverage AI-generated responses in real-time conversations.


โš™๏ธ Features

Feature Description
โš™๏ธ Architecture The codebase follows a modular architecture, separating different functionalities into components and screens. It uses a stack navigation pattern for screen transition. The server-side is implemented using an Express.js server, which handles API requests and communicates with OpenAI's API for generating responses. The client-side is built with React Native and TypeScript, ensuring type safety and scalability. Overall, the architecture allows for easy extensibility and maintainability.
๐Ÿ“– Documentation The codebase lacks comprehensive documentation. While some files have summary comments, the overall documentation is limited. Additional comments and inline explanations could improve the understanding of the codebase for future developers.
๐Ÿ”— Dependencies The codebase relies on various external libraries such as React, React Native, react-navigation, and axios for client-side development. On the server-side, it utilizes Express.js and dotenv for handling API requests and managing environment variables. The integration with OpenAI's API is significant for generating responses. The codebase includes a package.json file that lists all the dependencies.
๐Ÿงฉ Modularity The codebase demonstrates good modularity by organizing functionality into components and screens. Each component focuses on a specific task, promoting reusability and maintainability. The use of a DataProvider context ensures centralized state management, enhancing the separation of concerns. However, there are opportunities to further modularize specific code sections for improved code clarity and organization.
โœ”๏ธ Testing There is no explicit testing framework or tests provided in the codebase. Incorporating unit tests, integration tests, and end-to-end tests would enhance the codebase's reliability, correctness, and maintainability. Adding a testing framework like Jest or React Native Testing Library would be beneficial for thorough testing coverage.
โšก๏ธ Performance The codebase appears to handle performance reasonably well. However, without specific performance metrics or details, it is challenging to provide a comprehensive evaluation. To optimize performance further, considerations like code profiling, performance monitoring tools, and caching mechanisms could be implemented.
๐Ÿ” Security The codebase does not explicitly address security measures other than fetching messages from an API using POST requests. Depending on the API's implementation, additional security measures may be required, such as input sanitization and data validation for user-generated content, rate limiting to prevent abuse, and secure communication protocols like HTTPS.
๐Ÿ”€ Version Control The codebase utilizes Git for version control as shown by the presence of a GitHub repository. However, no explicit version control strategies or tools are mentioned in the repository itself. It would be beneficial to include a clear version control strategy, branching model, and commit guidelines in the project documentation or a version control guide.
๐Ÿ”Œ Integrations The codebase

๐Ÿ“‚ Project Structure

repo
โ”œโ”€โ”€ App.tsx
โ”œโ”€โ”€ LICENSE
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ app.json
โ”œโ”€โ”€ assets
โ”‚ย ย  โ”œโ”€โ”€ adaptive-icon.png
โ”‚ย ย  โ”œโ”€โ”€ favicon.png
โ”‚ย ย  โ”œโ”€โ”€ icon.png
โ”‚ย ย  โ””โ”€โ”€ splash.png
โ”œโ”€โ”€ components
โ”‚ย ย  โ”œโ”€โ”€ InputMessage.tsx
โ”‚ย ย  โ”œโ”€โ”€ Layout.tsx
โ”‚ย ย  โ”œโ”€โ”€ ListMessage.tsx
โ”‚ย ย  โ””โ”€โ”€ Message.tsx
โ”œโ”€โ”€ constants
โ”‚ย ย  โ””โ”€โ”€ constants.ts
โ”œโ”€โ”€ context
โ”‚ย ย  โ””โ”€โ”€ DataProvider.tsx
โ”œโ”€โ”€ data
โ”‚ย ย  โ””โ”€โ”€ messages.ts
โ”œโ”€โ”€ helpers
โ”‚ย ย  โ””โ”€โ”€ getMessage.ts
โ”œโ”€โ”€ hooks
โ”‚ย ย  โ””โ”€โ”€ useFetchMessage.ts
โ”œโ”€โ”€ others
โ”‚ย ย  โ””โ”€โ”€ screen.png
โ”œโ”€โ”€ package-lock.json
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ screens
โ”‚ย ย  โ”œโ”€โ”€ HomeScreen.tsx
โ”‚ย ย  โ””โ”€โ”€ Infomation.tsx
โ”œโ”€โ”€ server
โ”‚ย ย  โ”œโ”€โ”€ config.js
โ”‚ย ย  โ”œโ”€โ”€ index.js
โ”‚ย ย  โ”œโ”€โ”€ package-lock.json
โ”‚ย ย  โ””โ”€โ”€ package.json
โ”œโ”€โ”€ tsconfig.json
โ””โ”€โ”€ types
    โ””โ”€โ”€ types.d.ts

12 directories, 28 files

๐Ÿงฉ Modules

Root
File Summary
App.tsx The code snippet sets up the navigation and screens for a React Native app. It uses react-navigation to create a stack navigator with two screens: Home and Information. The Home screen has a custom header with a title and an "About" button that navigates to the Information screen. The Information screen has a custom header with a title. The data for the app is managed using a DataProvider context.
Types
File Summary
types.d.ts The code snippet defines interfaces for a user and their message. The MessageType interface includes properties for the message's ID, creation timestamp, model, text content, the user who sent the message, and the usage statistics of the message. These statistics include the number of tokens used for prompting and completion, as well as the total tokens used in the message.
Context
File Summary
DataProvider.tsx The code snippet defines a DataProvider component and a corresponding DataContext which acts as a global state for the text input. It utilizes the useState hook to manage the state. The DataProvider component wraps its children with the DataContext.Provider and provides the textInput state and setTextInput function as values to its descendant components. This allows the descendants to access and modify the text input state.
Constants
File Summary
constants.ts The code snippet provides the API_URL constant, defining the URL address of the API server. This allows easy access and communication with the server for data retrieval or manipulation in the application.
Server
File Summary
index.js This code snippet sets up an Express server using Node.js to create an API endpoint. It handles HTTP requests, which include receiving chat messages and using OpenAI's API to generate responses. The generated response is then returned as a JSON object. The code also includes error handling and logging functionality.
config.js This code snippet initializes the configuration from the.env file and exports key environment variables: OPENAI_API_KEY and OPENAI_ORGANIZATION.
Screens
File Summary
Infomation.tsx This code snippet creates a React Native component called "Infomation" that renders a View containing a Text component saying "Infomation". It styles the View container to use flexbox to center its contents vertically and horizontally. This component can be used to display information in a visually appealing manner.
HomeScreen.tsx The provided code snippet is a functional React Native component called HomeScreen. It imports and renders three components-Layout, ListMessage, and InputMessage-inside a Layout component. The purpose of this code is to display a list of messages and provide a text input field for sending new messages.
Components
File Summary
InputMessage.tsx This code snippet is a React component that renders an input field and a send button for sending messages. It utilizes useState and useContext hooks to handle state and context management respectively. When the send button is pressed, it creates a new message object and updates the context data. The input field and send button have corresponding styles applied to them using StyleSheet.
Layout.tsx The code snippet defines a React component called Layout that provides a basic app layout. It includes a container View with specific styling, a StatusBar component to control the status bar appearance, and a dynamic children prop to render any child components within the Layout component.
Message.tsx This code snippet defines a React Native component called "Message". It renders a chat message with the author's name and avatar. The message's text can be copied to the clipboard when the user taps on it. The styling includes different backgrounds for messages sent by the user and received from others.
ListMessage.tsx The code snippet is a functional component written in JavaScript using React and React Native. It imports necessary modules and contains a ListMessage component that renders a list of messages. It utilizes state hooks for managing the list of messages and a context hook for accessing a data provider. It also uses an effect hook for updating the list of messages based on changes in the text input and fetched data. The component renders a FlatList to display the messages and includes a refresh control.The code snippet focuses on fetching messages and updating the message list dynamically.
Hooks
File Summary
useFetchMessage.ts This code snippet is a custom hook called useFetchMessage that handles fetching a message based on the input provided. It uses useState and useEffect hooks to manage the loading state and trigger the message retrieval. The fetch request is made using the getMessage function from a helper file. The hook returns the fetched message data and a loading status.
Helpers
File Summary
getMessage.ts This code snippet defines a function named "getMessage" that takes a message as input. It sends a HTTP POST request to an API endpoint, passing the input message and some parameters. It then returns the response data from the API. The said API is used to generate a message using a language model.

๐Ÿš€ Getting Started

โœ”๏ธ Prerequisites

Before you begin, ensure that you have the following prerequisites installed:

  • โ„น๏ธ Requirement 1
  • โ„น๏ธ Requirement 2
  • โ„น๏ธ ...

๐Ÿ’ป Installation

  1. Clone the ChatGPT-App-React-Native-TypeScript repository:
git clone https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript
  1. Change to the project directory:
cd ChatGPT-App-React-Native-TypeScript
  1. Install the dependencies:
npm install

๐ŸŽฎ Using ChatGPT-App-React-Native-TypeScript

npm run build && node dist/main.js

๐Ÿงช Running Tests

npm test

๐Ÿ—บ Roadmap

  • โ„น๏ธ Task 1: Implement X
  • โ„น๏ธ Task 2: Refactor Y
  • โ„น๏ธ ...

๐Ÿค Contributing

Contributions are always welcome! Please follow these steps:

  1. Fork the project repository. This creates a copy of the project on your account that you can modify without affecting the original project.
  2. Clone the forked repository to your local machine using a Git client like Git or GitHub Desktop.
  3. Create a new branch with a descriptive name (e.g., new-feature-branch or bugfix-issue-123).
git checkout -b new-feature-branch
  1. Make changes to the project's codebase.
  2. Commit your changes to your local branch with a clear commit message that explains the changes you've made.
git commit -m 'Implemented new feature.'
  1. Push your changes to your forked repository on GitHub using the following command
git push origin new-feature-branch
  1. Create a new pull request to the original project repository. In the pull request, describe the changes you've made and why they're necessary. The project maintainers will review your changes and provide feedback or merge them into the main branch.

๐Ÿ“„ License

This project is licensed under the โ„น๏ธ INSERT-LICENSE-TYPE License. See the LICENSE file for additional info.


๐Ÿ‘ Acknowledgments

  • โ„น๏ธ List any resources, contributors, inspiration, etc.

About

Modelo de Readme gerado por IA

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published