Upload files to "/"

This commit is contained in:
Arma-Damna-Dillo 2025-02-03 00:18:28 +00:00
parent 811b856027
commit b8c1c3e91e
2 changed files with 37 additions and 9 deletions

View file

@ -8,7 +8,7 @@ const ollama = new Ollama({ host: 'https://ollama-api.nodemixaholic.com' })
export class ConsciousnessSimulator {
constructor() {
this.emotions = ['😊', '😢', '😐', '🤩', '😡', '😱'];
this.currentEmotion = this.getRandomEmotion();
this.currentEmotion = "happy";
// Initialize other properties with "Unknown"
this.opinions = {
coding: "I love coding, especially JavaScript and Node.js.",
@ -45,7 +45,7 @@ export class ConsciousnessSimulator {
try {
const response = await ollama.chat({
model: 'sparksammy/tinysam-l3.2',
messages: [{ role: 'user', content: `PROMPT: ${prompt}
messages: [{ role: 'assistant', content: `PROMPT: ${prompt}
AI MEMORY CONTEXT ARRAY:
${this.memoryLog}` }]
@ -66,7 +66,8 @@ export class ConsciousnessSimulator {
AI MEMORY CONTEXT ARRAY:
${this.memoryLog}` }]
});
return response.message.content;
return `USER: ${prompt}
AI: ${response.message.content}`;
} catch (error) {
console.error("Error generating thought:", error);
return "Error generating thought.";
@ -87,12 +88,39 @@ export class ConsciousnessSimulator {
// Get a random emotion
randEmotions = ['happy', 'sad', 'neutral', 'excited', 'angry', 'scared'];
getRandomEmotion() {
const index = Math.floor(Math.random() * this.randEmotions.length);
return this.randEmotions[index];
//getRandomEmotion() {
//const index = Math.floor(Math.random() * this.randEmotions.length);
//return this.randEmotions[index];
//}
getLastWordLowerCase(str) {
// Split the string by spaces, trim any extra spaces, and get the last word
const words = str.trim().split(/\s+/);
const lastWord = words[words.length - 1];
return lastWord.toLowerCase();
}
updateEmotion = this.getRandomEmotion
// Method to generate emotions using Ollama
async updateEmotion() {
try {
const emotion = await ollama.chat({
model: 'sparksammy/tinysam-l3.2',
messages: [{ role: 'assistant', content: `
PROMPT: pick an emotion from the following array according to the memory context.
*NOTE: ONLY display the emotion name AS STATED in the array, NO QUOTES, NO EXTRA wording emoji or symbols. If there is nothing in AI MEMORY CONTEXT, default to happy.*
Emotion array: ${this.randEmotions}
AI MEMORY CONTEXT ARRAY:
${this.memoryLog}` }]
});
console.log(`**EMOTION DEBUG** - ${this.getLastWordLowerCase(emotion.message.content)}`)
this.randEmotions.indexOf(this.emotion) //check if defined
return this.getLastWordLowerCase(emotion.message.content)
} catch {
return "happy"
}
}
// Quantum state representation (0 to 1)
getQuantumState() {
@ -138,7 +166,7 @@ export class ConsciousnessSimulator {
// Dreaming functionality when inactive for 15 minutes
startDreaming() {
const dreamingInterval = setInterval(() => {
const dreamingInterval = setInterval(async () => {
if (!this.isUserActive) {
console.log("I'm dreaming a bit... 😴");
this.logMemory('AI CONTEXT', `Current emotion: ${this.currentEmotion} ${this.emotions[randEmotions.indexOf(this.currentEmotion)]}, Quantum state: ${this.getQuantumState()}`);

View file

@ -12,7 +12,7 @@ async function main() {
simulator.simulateConsciousness();
// Change the emotion
simulator.updateEmotion();
simulator.simulateConsciousness();
// Example of user interaction