Upload files to "/"
This commit is contained in:
parent
660666eb4b
commit
14d681d6b1
1 changed files with 16 additions and 1 deletions
17
brain.mjs
17
brain.mjs
|
@ -30,6 +30,16 @@ export class ConsciousnessSimulator {
|
||||||
this.isUserActive = true;
|
this.isUserActive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Function to load the array from a text file
|
||||||
|
loadArrayFromFile(filename) {
|
||||||
|
// Read the file synchronously
|
||||||
|
const data = fs.readFileSync(filename, 'utf8');
|
||||||
|
|
||||||
|
// Split the data by newline and return as an array
|
||||||
|
return data.split('\n').map(item => item.trim()); // `.map(item => item.trim())` to remove any extra spaces
|
||||||
|
}
|
||||||
|
|
||||||
// Method to generate thoughts using Ollama
|
// Method to generate thoughts using Ollama
|
||||||
async generateThought(prompt) {
|
async generateThought(prompt) {
|
||||||
try {
|
try {
|
||||||
|
@ -111,7 +121,12 @@ export class ConsciousnessSimulator {
|
||||||
|
|
||||||
// Continuity check and load from log
|
// Continuity check and load from log
|
||||||
loadMemory() {
|
loadMemory() {
|
||||||
return this.memoryLog;
|
try {
|
||||||
|
this.memoryLog = this.loadArrayFromFile("consciousness.log")
|
||||||
|
return this.memoryLog;
|
||||||
|
} catch {
|
||||||
|
return this.memoryLog;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper method for emotions array access
|
// Helper method for emotions array access
|
||||||
|
|
Loading…
Reference in a new issue