Skip to content

Commit

Permalink
Changed file paths to dev mode
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpinel committed May 23, 2024
1 parent a0353af commit 0556a88
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ ipcMain.on('show-context-menu', (event) => {
})
// RUNS DOT THROUGHT script.py

//let currentScript = path.join(__dirname, '..', 'llm', 'scripts', 'docdot.py')
let currentScript = path.join(process.resourcesPath, 'llm', 'scripts', 'docdot.py')
let currentScript = path.join(__dirname, '..', 'llm', 'scripts', 'docdot.py')
//let currentScript = path.join(process.resourcesPath, 'llm', 'scripts', 'docdot.py')

// Default script

Expand Down Expand Up @@ -201,12 +201,12 @@ ipcMain.on('switch-script', (event, selectedScript) => {
// Toggle between 'script.py' and 'normalchat.py'
console.log('Switching script to:', selectedScript)

currentScript = currentScript.endsWith('docdot.py')
? path.join(process.resourcesPath, 'llm', 'scripts', 'bigdot.py')
: path.join(process.resourcesPath, 'llm', 'scripts', 'docdot.py');
/*currentScript = currentScript.endsWith('docdot.py')
? path.join(process.resourcesPath, 'llm', 'scripts', 'bigdot.py')
: path.join(process.resourcesPath, 'llm', 'scripts', 'docdot.py');*/
currentScript = currentScript.endsWith('docdot.py')
? path.join(__dirname, '..', 'llm', 'scripts', 'bigdot.py')
: path.join(__dirname, '..', 'llm', 'scripts', 'docdot.py');*/
: path.join(__dirname, '..', 'llm', 'scripts', 'docdot.py');

// If the Python process is running, kill it and spawn a new one with the updated script
if (pythonProcess) {
Expand Down Expand Up @@ -285,8 +285,8 @@ const createWindow = () => {


function createTtsProcess() {
let ttsProcessorPath = path.join(process.resourcesPath, 'llm', 'vits-piper-en_US-glados', 'ttsProcessor.js');
//let ttsProcessorPath = path.join(__dirname, '..', 'llm', 'vits-piper-en_US-glados', 'ttsProcessor.js');
//let ttsProcessorPath = path.join(process.resourcesPath, 'llm', 'vits-piper-en_US-glados', 'ttsProcessor.js');
let ttsProcessorPath = path.join(__dirname, '..', 'llm', 'vits-piper-en_US-glados', 'ttsProcessor.js');
return fork(ttsProcessorPath);
}

Expand Down Expand Up @@ -436,19 +436,19 @@ ipcMain.handle('execute-python-script', async (event, directory) => {
try {
// Construct paths relative to the script's location

const pythonScriptPath = path.join(
/*const pythonScriptPath = path.join(
process.resourcesPath,
'llm',
'scripts',
'embeddings.py'
)
/*const pythonScriptPath = path.join(
)*/
const pythonScriptPath = path.join(
__dirname,
'..',
'llm',
'scripts',
'embeddings.py'
)*/
)

// Quote the directory path to handle spaces
const quotedDirectory = `"${directory}"`
Expand Down Expand Up @@ -761,17 +761,17 @@ ipcMain.handle('open-file-dialog', async (event) => {
let streamProcess = null;

ipcMain.on('run-stream-model', (event) => {
//const modelPath = path.join(__dirname, '..', 'llm', 'whisper', 'models', 'ggml-model-whisper-base.bin');
const modelPath = path.join(process.resourcesPath, 'llm', 'whisper', 'models', 'ggml-model-whisper-base.bin');
const modelPath = path.join(__dirname, '..', 'llm', 'whisper', 'models', 'ggml-model-whisper-base.bin');
//const modelPath = path.join(process.resourcesPath, 'llm', 'whisper', 'models', 'ggml-model-whisper-base.bin');
const args = [
'-m', modelPath,
'-t', '8',
'--step', '500',
'--length', '5000'
];

//const streamPath = path.join(__dirname, '..', 'llm', 'whisper', 'stream');
const streamPath = path.join(process.resourcesPath, 'llm', 'whisper', 'stream');
const streamPath = path.join(__dirname, '..', 'llm', 'whisper', 'stream');
//const streamPath = path.join(process.resourcesPath, 'llm', 'whisper', 'stream');

streamProcess = spawn(streamPath, args, { shell: true });

Expand Down

0 comments on commit 0556a88

Please sign in to comment.