Skip to content

Commit

Permalink
Upload all files
Browse files Browse the repository at this point in the history
  • Loading branch information
danigbaameiro committed Apr 9, 2023
1 parent 8e3e3f2 commit fa1a670
Show file tree
Hide file tree
Showing 9 changed files with 1,752 additions and 2 deletions.
86 changes: 84 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,84 @@
# ChatGPT-Desktop
A desktop application for <a href="https://chat.openai.com/">ChatGPT</a> based on <a href="https://www.electronjs.org/">Electron</a>.
# ChatGPT Desktop

<div align=center>
<img src="https://img.shields.io/badge/Electron-191970?style=for-the-badge&logo=Electron&logoColor=white" alt="Electron" style="margin-right: 10px;">
<img src="https://img.shields.io/badge/Node.js-43853D?style=for-the-badge&logo=node.js&logoColor=white" alt="NodeJS">
</div>

</br><p align="center">
A desktop application for <a href="https://chat.openai.com/">ChatGPT</a> based on <a href="https://www.electronjs.org/">Electron</a>.
<br>
</p>

<p align="center">
<img src="assets/img/chat_gpt.png" alt="Screenshot de ChatGPT Desktop">
</p>


## Features

- Clean and modern user interface for ChatGPT.
- Works on Windows, macOS and Linux.
- Download conversations in PDF format (under development).
- Easy to install and update.

## Installation

To install the ChatGPT Desktop application on your computer, you have two options. The first one is more direct and the second one is more manual.

As the first option, the following steps are detailed below:
1. Go to the [releases page](https://github.com/Sawyer13/chatgpt-desktop/releases) of this repository.
2. Download the binary for your distribution/operating system.
3. Give it execute permissions and/or run it.

As a second option, the following steps are detailed:
1. Download the code by using the `git clone https://github.com/Sawyer13/chatgpt-desktop` command.
2. Enter the folder with the command `cd chatgpt-desktop` and install all the dependencies from the `npm install .` repository. It is important to have the `nodejs` and `npm` packages installed.
3. To generate the binary, which will be saved in a folder named dist, run the following command `npm run dist`. For all platforms execute `npm run dist -- --mac --win --linux`.

All in one:
```sh
sudo apt update
sudo apt install nodejs npm git electron-packager
git clone https://github.com/Sawyer13/chatgpt-desktop
cd chatgpt-desktop
npm install .
# npm audit fix --force # in case of vulnerabilities
npm run dist
```

After the command `npm run dist`, if you are a GNU/Linux us(lov)er and you want to execute this app using your terminal or searching in the application menu, just execute the following commands:
```sh
sudo cp assets/icons/icon.png /usr/share/icons/chatgpt.png
echo "[Desktop Entry]
Type=Application
Name=ChatGPT Desktop
Icon=/usr/share/icons/chatgpt.png
Exec=/usr/local/bin/ChatGPT_Desktop.AppImage" > /tmp/chatgpt_desktop.desktop
sudo cp /tmp/chatgpt_desktop.desktop /usr/share/applications
sudo cp dist/ChatGPT_Desktop.AppImage /usr/local/bin/chatgpt
sudo chmod +x /usr/local/bin/chatgpt
sudo update-desktop-database
```

After that, you can search for the application.

<div align=center>
<img src="assets/img/chatgpt_gnome.png" alt="Electron GNOME" style="border-radius: 5px">
</div>

## How to use it

To launch the application, find "ChatGPT Desktop" in your installed applications and click on its icon. The application will open and you will be able to interact with ChatGPT as you would in the web version. Another option is to execute the command `electron <path_to_repository>`.

(Under development)</br>
To download a conversation as a PDF, select the conversation and click the "Download Conversation" button at the top of the window. You will be prompted to choose a location to save the PDF file.

## License

ChatGPT Desktop está licenciado bajo la [Licencia MIT](LICENSE). Consulta el archivo LICENSE para obtener más información.

## Credits

- [OpenAI](https://openai.com/)
- [Sawyer13](https://github.com/Sawyer13)
1,556 changes: 1,556 additions & 0 deletions assets/icons/icon.icns

Large diffs are not rendered by default.

Binary file added assets/icons/icon.ico
Binary file not shown.
Binary file added assets/icons/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/chat_gpt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/chatgpt_gnome.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<html>
<head>
<meta
http-equiv="Content-Security-Policy"
content="default-src 'self'; style-src 'self' 'unsafe-inline';"
/>
<style>
#webview {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: inline-flex !important;
}
</style>
</head>
<body>
<webview
id="webview"
autosize="on"
src="https://chat.openai.com/chat"
></webview>
</body>
</html>
42 changes: 42 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
const { app, BrowserWindow, globalShortcut } = require('electron');

app.allowRendererProcessReuse = true;

let win;

function createBrowserWindow() {
win = new BrowserWindow({
width: 1024,
height: 768,
minWidth: 400,
minHeight: 600,
backgroundColor: "#fff",
autoHideMenuBar: true,
webPreferences: {
devTools: true,
contextIsolation: true,
webviewTag: true,
enableRemoteModule: true,
nodeIntegration: false,
nativeWindowOpen: true,
webSecurity: true,
allowRunningInsecureContent: true
}
})

win.loadURL(`file://${__dirname}/index.html`, { userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36' });
}

app.whenReady().then(() => {
createBrowserWindow();

globalShortcut.register('Alt+X', () => {
console.log('Alt+X is pressed') // Test for download button
})
})

app.on("window-all-closed", () => {
if (process.platform !== 'darwin') {
app.quit()
}
});
45 changes: 45 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "chatgpt-desktop",
"version": "1.0.0",
"description": "Do you love ChatGPT? Do you want to have it more at hand? Then nothing better than your own desktop application!",
"main": "main.js",
"scripts": {
"start": "electron .",
"pack": "electron-builder --dir",
"dist": "electron-builder"
},
"author": "Daniel García Baameiro",
"license": "MIT",
"build": {
"appId": "com.invented.chatgpt",
"productName": "ChatGPT_Desktop",
"artifactName": "${productName}.AppImage",
"files": [
"main.js",
"index.html",
"assets/css/main.css"
],
"extraResources": [
"assets"
],
"icon": "assets/icons/icon.ico",
"directories": {
"buildResources": "resources"
},
"mac": {
"target": "dmg",
"icon": "assets/icons/icon.icns"
},
"win": {
"target": "nsis"
},
"linux": {
"target": ["AppImage", "dir"],
"icon": "assets/icons/icon.png"
}
},
"devDependencies": {
"electron-builder": "^22.10.3",
"electron": "^22.0.0"
}
}

0 comments on commit fa1a670

Please sign in to comment.