Skip to content

Commit 1d65a36

Browse files
authored
migrate to chat file instead variable
1 parent 48a8316 commit 1d65a36

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

main_chat_blessed.js

+15-16
Original file line numberDiff line numberDiff line change
@@ -3090,7 +3090,7 @@ const logCommand = async (command, args) => {
30903090
// function to log preprefix
30913091
const logPrePrefix = async (prePrefix) => {
30923092
const currentPath = path.join(logsFolderPath, 'current_logic.txt');
3093-
// const completePath = path.join(logsFolderPath, 'complete_log.txt');
3093+
// const completePath = path.join(logsFolderPath, 'complete_logic.txt');
30943094

30953095
await createFolderIfNotExists(logsFolderPath);
30963096

@@ -3101,7 +3101,7 @@ const logPrePrefix = async (prePrefix) => {
31013101
// function to log prefix
31023102
const logPrefix = async (prefix) => {
31033103
const currentPath = path.join(logsFolderPath, 'current_logic.txt');
3104-
// const completePath = path.join(logsFolderPath, 'complete_log.txt');
3104+
// const completePath = path.join(logsFolderPath, 'complete_logic.txt');
31053105

31063106
await createFolderIfNotExists(logsFolderPath);
31073107

@@ -3112,7 +3112,7 @@ const logPrefix = async (prefix) => {
31123112
// function to log user input
31133113
const newLogic = async (userInput) => {
31143114
const currentPath = path.join(logsFolderPath, 'current_logic.txt');
3115-
// const completePath = path.join(logsFolderPath, 'complete_log.txt');
3115+
// const completePath = path.join(logsFolderPath, 'complete_logic.txt');
31163116

31173117
await createFolderIfNotExists(logsFolderPath);
31183118

@@ -3123,7 +3123,7 @@ const newLogic = async (userInput) => {
31233123
// function to log suffix
31243124
const logSuffix = async (suffix) => {
31253125
const currentPath = path.join(logsFolderPath, 'current_logic.txt');
3126-
// const completePath = path.join(logsFolderPath, 'complete_log.txt');
3126+
// const completePath = path.join(logsFolderPath, 'complete_logic.txt');
31273127

31283128
await createFolderIfNotExists(logsFolderPath);
31293129

@@ -3134,7 +3134,7 @@ const logSuffix = async (suffix) => {
31343134
// function to log semantic
31353135
// const logSemantic = async (semantic) => {
31363136
// const currentPath = path.join(logsFolderPath, 'current_logic.txt');
3137-
// const completePath = path.join(logsFolderPath, 'complete_log.txt');
3137+
// const completePath = path.join(logsFolderPath, 'complete_logic.txt');
31383138

31393139
// await createFolderIfNotExists(logsFolderPath);
31403140

@@ -3490,19 +3490,21 @@ function saveMultiNotes() {
34903490
const selectedDropDown = dropDownOptions[dropDown.selected];
34913491
const { prePrefix, prefix, suffix } = await getPrefixSuffix(selectedDropDown);
34923492
const userInput = text; // store user input in a separate variable
3493-
// await logPrePrefix(prePrefix);
3494-
// await logPrefix(prefix);
3495-
// await newLogic(userInput);
3496-
// await logSuffix(suffix);
3493+
3494+
const historyEnabled = historyCheckbox.checked;
3495+
const checkBoxPath = historyEnabled ? path.join(logsFolderPath, 'complete_logic.txt') : path.join(logsFolderPath, 'current_logic.txt');
3496+
34973497
await logAll(prePrefix, prefix, userInput, suffix);
3498+
3499+
// await logAll(prePrefix, prefix, userInput, suffix);
34983500
const modelPath = path.join(modelsFolder, selectedModel);
34993501
if (!isValidModelPath(modelPath)) {
35003502
outputBox.insertBottom('Error: Invalid model path. Please select a .bin file.');
35013503
screen.render();
35023504
return;
35033505
}
35043506

3505-
const historyEnabled = historyCheckbox.checked;
3507+
// const historyEnabled = historyCheckbox.checked;
35063508
let gptInput = text;
35073509
let gptOutput = '';
35083510

@@ -3592,14 +3594,15 @@ function saveMultiNotes() {
35923594
} else if (radioSet.children[2].checked) {
35933595
args.push('--mirostat', '2');
35943596
}
3595-
args.push('-p', `${gptInput}`);
3597+
// args.push('-p', `${gptInput}`);
3598+
// args.push('-f', currentPath);
3599+
args.push('-f', checkBoxPath);
35963600
logCommand(command, args);
35973601

35983602
child = spawn(command, args, { stdio: ['inherit', 'pipe', 'pipe'] });
35993603

36003604

36013605
let output = ''; // variable for saving the output
3602-
// let dialogHistory = ''; // variable for saving the dialogue course
36033606
let isFirstChunk = true;
36043607
let formattedOutput = '';
36053608

@@ -3618,16 +3621,12 @@ child.stdout.on('data', (data) => {
36183621

36193622
// let formattedOutput;
36203623
if (isFirstChunk) {
3621-
// dialogHistory += `\n\nYou\n${text}\n\nAssistant${userOutput}\n`;
3622-
36233624
// formattedOutput = `\n\u001b[1;30mYou\n\u001b[0m\u001b[1;90m${text}\u001b[0m\n\n\u001b[1;30mAssistant\u001b[0m\u001b[1;90m${userOutput}\n\u001b[0m`;
36243625

36253626
formattedOutput = `\n\nYou\n${text}\n\nAssistant${userOutput}\n`;
36263627

36273628
isFirstChunk = false;
36283629
} else {
3629-
// dialogHistory += `${userOutput}`;
3630-
36313630
formattedOutput = `${userOutput}`;
36323631
}
36333632
//

0 commit comments

Comments
 (0)