Skip to content

Commit

Permalink
enableDir
Browse files Browse the repository at this point in the history
  • Loading branch information
chatbookai committed Jun 2, 2024
1 parent 4860a53 commit 7b1068b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
10 changes: 9 additions & 1 deletion express/main.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { app, BrowserWindow, Menu, ipcMain, dialog } from 'electron';
import isDev from 'electron-is-dev'
import settings from 'electron-settings';
import os from 'os';

import { server, getPort } from './src/app.js';
import { initChatBookSetting, ChatBookDbInit } from './src/utils/db.js';
import { enableDir } from './src/utils/utils.js';


const PORT = getPort();

Expand All @@ -21,7 +24,12 @@ function createMainWindow() {
});

//Start Setting Page
mainWindow.loadFile('src/settings/index.html');
//mainWindow.loadFile('src/settings/index.html');
const userHomeDir = os.homedir()
enableDir(userHomeDir + '/ChatBookData')
initChatBookSetting({NodeStorageDirectory: userHomeDir + '/ChatBookData'})
ChatBookDbInit();
mainWindow.loadURL('http://localhost:' + PORT);

ipcMain.on('start-chatbook', async (event, data) => {
ChatBookSetting = await settings.get('chatbook');
Expand Down
3 changes: 2 additions & 1 deletion express/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ const __dirname = dirname(__filename);
//import getimgRouter from './router/Backup/getimg'
//import seaartRouter from './router/seaart'


//Start Express Server
const app = express();
const port = 1988;
app.use(cors());
app.use(bodyParser.json());
dotenv.config();

console.log("process.env: ", process.env);
// console.log("process.env: ", process.env);

//Initial Database and Folder

Expand Down
2 changes: 1 addition & 1 deletion express/src/utils/lancedb.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { DataDir } from './const.js';
import dotenv from 'dotenv';
dotenv.config();

console.log("process.env: ", process.env);
// console.log("process.env: ", process.env);

const OPENAI_API_KEY = process.env.OPENAI_API_KEY ?? ''

Expand Down
2 changes: 1 addition & 1 deletion express/src/utils/llms.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import { createEmbeddingsFromList, getWebsiteUrlContext, formatMessage, rephrase
import dotenv from 'dotenv';
dotenv.config();

console.log("process.env: ", process.env);
// console.log("process.env: ", process.env);

const OPENAI_BASE_URL = process.env.OPENAI_BASE_URL ?? "https://openkey.cloud/v1";
const OPENAI_API_KEY = process.env.OPENAI_API_KEY ?? "sk-Bm6p9ej7BIZU3F5tFe2e1f899097474aBeA3E7E034A723B8";
Expand Down
2 changes: 1 addition & 1 deletion express/src/utils/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

dotenv.config();

console.log("process.env: ", process.env);
// console.log("process.env: ", process.env);

import { ChatBookDbPool } from './db.js'

Expand Down

0 comments on commit 7b1068b

Please sign in to comment.