Skip to content

Commit

Permalink
reorganize dirs for dockerize
Browse files Browse the repository at this point in the history
  • Loading branch information
danny-avila committed Mar 6, 2023
1 parent 6ae154c commit fca546a
Show file tree
Hide file tree
Showing 38 changed files with 1,074 additions and 1,988 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public/main.js.LICENSE.txt
# Deployed apps should consider commenting these lines out:
# see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git
node_modules/
api/node_modules/
client/node_modules/
bower_components/

# Floobits
Expand All @@ -40,7 +42,7 @@ bower_components/
# Environment
.env
cache.json
data/
api/data/
.eslintrc.js

src/style - official.css
12 changes: 12 additions & 0 deletions api/DockerFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM node:latest
WORKDIR /api
# copy package.json into the container at /api
COPY package*.json /api/
# install dependencies
RUN npm install
# Copy the current directory contents into the container at /api
COPY . /api/
# Make port 80 available to the world outside this container
EXPOSE 80
# Run the app when the container launches
CMD ["npm", "start"]
2 changes: 1 addition & 1 deletion app/bingai.js → api/app/bingai.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const askBing = async ({ text, progressCallback, convo }) => {
// If the above doesn't work, provide all your cookies as a string instead
// cookies: '',
debug: false,
store: new KeyvFile({ filename: './data/cache.json' })
store: new KeyvFile({ filename: './api/data/cache.json' })
});

let options = {
Expand Down
2 changes: 1 addition & 1 deletion app/chatgpt-browser.js → api/app/chatgpt-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const browserClient = async ({ text, progressCallback, convo }) => {
const { ChatGPTBrowserClient } = await import('@waylaidwanderer/chatgpt-api');

const store = {
store: new KeyvFile({ filename: './data/cache.json' })
store: new KeyvFile({ filename: './api/data/cache.json' })
};

const client = new ChatGPTBrowserClient(clientOptions, store);
Expand Down
2 changes: 1 addition & 1 deletion app/chatgpt-client.js → api/app/chatgpt-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const clientOptions = {
const askClient = async ({ text, progressCallback, convo }) => {
const ChatGPTClient = (await import('@waylaidwanderer/chatgpt-api')).default;
const store = {
store: new KeyvFile({ filename: './data/cache.json' })
store: new KeyvFile({ filename: './api/data/cache.json' })
};

const client = new ChatGPTClient(process.env.OPENAI_KEY, clientOptions, store);
Expand Down
2 changes: 1 addition & 1 deletion app/chatgpt-custom.js → api/app/chatgpt-custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const clientOptions = {
const customClient = async ({ text, progressCallback, convo, promptPrefix, chatGptLabel }) => {
const ChatGPTClient = (await import('@waylaidwanderer/chatgpt-api')).default;
const store = {
store: new KeyvFile({ filename: './data/cache.json' })
store: new KeyvFile({ filename: './api/data/cache.json' })
};

clientOptions.chatGptLabel = chatGptLabel;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
38 changes: 38 additions & 0 deletions api/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "chatgpt-clone",
"version": "1.0.0",
"description": "",
"main": "server/index.js",
"scripts": {
"start": "npx node server/index.js",
"server-dev": "npx nodemon server/index.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/danny-avila/chatgpt-clone.git"
},
"keywords": [],
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/danny-avila/chatgpt-clone/issues"
},
"homepage": "https://github.com/danny-avila/chatgpt-clone#readme",
"dependencies": {
"@keyv/mongo": "^2.1.8",
"@waylaidwanderer/chatgpt-api": "^1.15.1",
"cors": "^2.8.5",
"dotenv": "^16.0.3",
"keyv": "^4.5.2",
"keyv-file": "^0.2.0",
"mongoose": "^6.9.0",
"openai": "^3.1.0",
"swr": "^2.0.3",
"tailwind-merge": "^1.9.1",
"tailwindcss-animate": "^1.0.5"
},
"devDependencies": {
"nodemon": "^2.0.20",
"path": "^0.12.7"
}
}
4 changes: 2 additions & 2 deletions server/index.js → api/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const path = require('path');
const cors = require('cors');
const routes = require('./routes');
const app = express();
const port = 3050;
const projectPath = path.join(__dirname, '..');
const port = process.env.PORT || 3050;
const projectPath = path.join(__dirname, '..', '..');
dbConnect().then(() => console.log('Connected to MongoDB'));

app.use(cors());
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit fca546a

Please sign in to comment.