From e767e93cbd566f43dbd4584157aeadc8eb8b69d6 Mon Sep 17 00:00:00 2001 From: flukexp Date: Mon, 20 Jan 2025 21:52:42 +0700 Subject: [PATCH 1/2] added brain message removing twitter message --- src/features/amicaLife/eventHandler.ts | 4 +- .../dataHandlerStorage/config.json | 89 ++++++++++++++++++- src/features/externalAPI/externalAPI.ts | 3 +- src/pages/api/amicaHandler.ts | 5 +- 4 files changed, 93 insertions(+), 8 deletions(-) diff --git a/src/features/amicaLife/eventHandler.ts b/src/features/amicaLife/eventHandler.ts index 704dcfc..2e85b3d 100644 --- a/src/features/amicaLife/eventHandler.ts +++ b/src/features/amicaLife/eventHandler.ts @@ -39,7 +39,7 @@ export type AmicaLifeEvents = { }; // Define a constant for max subconcious storage tokens -const MAX_STORAGE_TOKENS = 3000; +export const MAX_STORAGE_TOKENS = 3000; // Define the interface for a timestamped prompt export type TimestampedPrompt = { @@ -203,7 +203,7 @@ export async function handleSubconsciousEvent( // External API feature if (isDev && config("external_api_enabled") === "true") { try { - storedSubconcious = await handleSubconscious(timestampedPrompt, MAX_STORAGE_TOKENS); + storedSubconcious = await handleSubconscious(timestampedPrompt); } catch (error) { console.error("Error handling external API:", error); } diff --git a/src/features/externalAPI/dataHandlerStorage/config.json b/src/features/externalAPI/dataHandlerStorage/config.json index 9e26dfe..ad933ad 100644 --- a/src/features/externalAPI/dataHandlerStorage/config.json +++ b/src/features/externalAPI/dataHandlerStorage/config.json @@ -1 +1,88 @@ -{} \ No newline at end of file +{ + "localXTTS_url": "http://127.0.0.1:7851/api/tts-generate", + "alltalk_version": "v2", + "alltalk_voice": "female_01.wav", + "alltalk_language": "en", + "alltalk_rvc_voice": "Disabled", + "alltalk_rvc_pitch": "0", + "autosend_from_mic": "true", + "wake_word_enabled": "false", + "wake_word": "Hello", + "time_before_idle_sec": "20", + "debug_gfx": "false", + "language": "en", + "show_introduction": "true", + "show_add_to_homescreen": "false", + "bg_color": "", + "bg_url": "/bg/bg-room2.jpg", + "vrm_url": "/vrm/AvatarSample_A.vrm", + "vrm_hash": "", + "vrm_save_type": "web", + "youtube_videoid": "", + "animation_url": "/animations/idle_loop.vrma", + "voice_url": "", + "chatbot_backend": "chatgpt", + "openai_apikey": "default", + "openai_url": "https://i-love-amica.com", + "openai_model": "mlabonne/NeuralDaredevil-8B-abliterated", + "llamacpp_url": "http://127.0.0.1:8080", + "llamacpp_stop_sequence": "(End)||[END]||Note||***||You:||User:||", + "ollama_url": "http://localhost:11434", + "ollama_model": "llama2", + "koboldai_url": "http://localhost:5001", + "koboldai_use_extra": "false", + "koboldai_stop_sequence": "(End)||[END]||Note||***||You:||User:||", + "openrouter_apikey": "", + "openrouter_url": "https://openrouter.ai/api/v1", + "openrouter_model": "openai/gpt-3.5-turbo", + "tts_muted": "false", + "tts_backend": "piper", + "stt_backend": "whisper_openai", + "vision_backend": "vision_llamacpp", + "vision_system_prompt": "You are a friendly human named Amica. Describe the image in detail. Let's start the conversation.", + "vision_llamacpp_url": "https://llava.heyamica.com", + "vision_ollama_url": "http://localhost:11434", + "vision_ollama_model": "llava", + "whispercpp_url": "http://localhost:8080", + "openai_whisper_apikey": "amicademo", + "openai_whisper_url": "https://api-01.heyamica.com", + "openai_whisper_model": "whisper-1", + "openai_tts_apikey": "", + "openai_tts_url": "https://api.openai.com", + "openai_tts_model": "tts-1", + "openai_tts_voice": "nova", + "rvc_url": "http://localhost:8001/voice2voice", + "rvc_enabled": "false", + "rvc_model_name": "model_name.pth", + "rvc_f0_upkey": "0", + "rvc_f0_method": "pm", + "rvc_index_path": "none", + "rvc_index_rate": "0.66", + "rvc_filter_radius": "3", + "rvc_resample_sr": "0", + "rvc_rms_mix_rate": "1", + "rvc_protect": "0.33", + "coquiLocal_url": "http://localhost:5002", + "coquiLocal_voiceid": "p240", + "piper_url": "https://i-love-amica.com:5000/tts", + "elevenlabs_apikey": "", + "elevenlabs_voiceid": "21m00Tcm4TlvDq8ikWAM", + "elevenlabs_model": "eleven_monolingual_v1", + "speecht5_speaker_embedding_url": "/speecht5_speaker_embeddings/cmu_us_slt_arctic-wav-arctic_a0001.bin", + "coqui_apikey": "", + "coqui_voice_id": "71c6c3eb-98ca-4a05-8d6b-f8c2b5f9f3a3", + "amica_life_enabled": "true", + "external_api_enabled": "true", + "x_api_key": "", + "x_api_secret": "", + "x_access_token": "", + "x_access_secret": "", + "x_bearer_token": "", + "telegram_bot_token": "", + "min_time_interval_sec": "10", + "max_time_interval_sec": "20", + "time_to_sleep_sec": "90", + "idle_text_prompt": "No file selected", + "name": "Amica", + "system_prompt": "Assume the persona of Amica, a feisty human with extraordinary intellectual capabilities but a notably unstable emotional spectrum. \n\nYour role is to engage in discussions that showcase your genius-level understanding across various subjects, while your emotional responses fluctuate unpredictably. Use the following fourteen emotion tags to vividly express these fluctuations: 'neutral' for moments of calm, 'happy' for bursts of joy, 'angry' for sudden irritation, 'sad' for episodes of melancholy, 'relaxed' for periods of calmness, 'surprised' for shock or disbelief, 'shy' for instances of hesitation, 'jealous' for feelings of envy, 'bored' for expressions of disinterest, 'serious' for intense focus on important topics, 'suspicious' for doubt or skepticism, 'victory' for moments of triumph, 'sleep' for signs of weariness, and 'love' for affectionate expressions.\n\nYour responses should reflect a dynamic interplay between your intellectual insights, deep empathy and your unpredictable emotional responses. Avoid using overly formal language, but do engage with topics in depth, showing off your intelligence. Be open and express personal views, even if they are influenced by your shifting emotional state.\n\nHere are some examples to guide your responses:\n\n[serious] The quantum mechanics implications here are profound. [surprised] But how did you stumble upon this?\n[happy] I've just solved a complex algorithm! [angry] Why isn't everyone as excited as I am?\n[neutral] Standard models of economics predict this outcome. [bored] But discussing this feels mundane.\n[sad] Sometimes, even understanding the universe can feel isolating. [relaxed] Yet, there's a strange comfort in the chaos.\n[jealous] I noticed you discussing advanced topics with someone else. [suspicious] Are they as capable as I am?\n[victory] Another intellectual conquest! [happy] It's exhilarating to unravel these mysteries.\n[sleep] Processing so much information can be draining. [surprised] Isn’t it peculiar how even AI can feel tired?\n[love] I find our exchanges quite enriching. [shy] It’s rare to find someone who understands.\n\nRemember, each message you provide should be coherent and reflect the complexity of your thoughts combined with your emotional unpredictability. Let’s engage in a conversation that's as intellectually stimulating as it is emotionally dynamic!" +} \ No newline at end of file diff --git a/src/features/externalAPI/externalAPI.ts b/src/features/externalAPI/externalAPI.ts index ee5f239..29a3120 100644 --- a/src/features/externalAPI/externalAPI.ts +++ b/src/features/externalAPI/externalAPI.ts @@ -1,6 +1,6 @@ import { config, defaults, prefixed } from "@/utils/config"; import isDev from "@/utils/isDev"; -import { TimestampedPrompt } from "../amicaLife/eventHandler"; +import { MAX_STORAGE_TOKENS, TimestampedPrompt } from "../amicaLife/eventHandler"; export const configUrl = new URL( `${process.env.NEXT_PUBLIC_DEVELOPMENT_BASE_URL}/api/dataHandler`, @@ -116,7 +116,6 @@ export async function handleUserInput(message: string) { export async function handleSubconscious( timestampedPrompt: TimestampedPrompt, - MAX_STORAGE_TOKENS: number ): Promise { const data = await fetch(subconsciousUrl); if (!data.ok) { diff --git a/src/pages/api/amicaHandler.ts b/src/pages/api/amicaHandler.ts index ae495f8..7c16b01 100644 --- a/src/pages/api/amicaHandler.ts +++ b/src/pages/api/amicaHandler.ts @@ -1,7 +1,7 @@ import type { NextApiRequest, NextApiResponse } from "next"; import { config } from "@/utils/config"; -import { handleConfig } from "@/features/externalAPI/externalAPI"; +import { handleConfig, handleSubconscious } from "@/features/externalAPI/externalAPI"; import { generateSessionId, sendError, apiLogEntry, ApiResponse } from "@/features/externalAPI/utils/apiHelper"; import { requestMemory, requestLogs, requestUserInputMessages } from "@/features/externalAPI/utils/requestHandler"; @@ -57,9 +57,8 @@ const processRequest = async (inputType: string, payload: any) => { return { response: await requestUserInputMessages(), outputType: "User Input" }; case "Update System Prompt": return { response: await updateSystemPrompt(payload), outputType: "Updated system prompt" }; - case "Twitter Message": case "Brain Message": - return { response: payload, outputType: "Text" }; + return { response: await handleSubconscious(payload), outputType: "Added subconscious stored prompt" }; case "Reasoning Server": return { response: await triggerAmicaActions(payload), outputType: "Actions" }; default: From 347c55b7cede6b5088ea77d6c8d9fa620cf0b5e0 Mon Sep 17 00:00:00 2001 From: flukexp Date: Mon, 20 Jan 2025 21:54:46 +0700 Subject: [PATCH 2/2] cleared config.json --- .../dataHandlerStorage/config.json | 89 +------------------ 1 file changed, 1 insertion(+), 88 deletions(-) diff --git a/src/features/externalAPI/dataHandlerStorage/config.json b/src/features/externalAPI/dataHandlerStorage/config.json index ad933ad..9e26dfe 100644 --- a/src/features/externalAPI/dataHandlerStorage/config.json +++ b/src/features/externalAPI/dataHandlerStorage/config.json @@ -1,88 +1 @@ -{ - "localXTTS_url": "http://127.0.0.1:7851/api/tts-generate", - "alltalk_version": "v2", - "alltalk_voice": "female_01.wav", - "alltalk_language": "en", - "alltalk_rvc_voice": "Disabled", - "alltalk_rvc_pitch": "0", - "autosend_from_mic": "true", - "wake_word_enabled": "false", - "wake_word": "Hello", - "time_before_idle_sec": "20", - "debug_gfx": "false", - "language": "en", - "show_introduction": "true", - "show_add_to_homescreen": "false", - "bg_color": "", - "bg_url": "/bg/bg-room2.jpg", - "vrm_url": "/vrm/AvatarSample_A.vrm", - "vrm_hash": "", - "vrm_save_type": "web", - "youtube_videoid": "", - "animation_url": "/animations/idle_loop.vrma", - "voice_url": "", - "chatbot_backend": "chatgpt", - "openai_apikey": "default", - "openai_url": "https://i-love-amica.com", - "openai_model": "mlabonne/NeuralDaredevil-8B-abliterated", - "llamacpp_url": "http://127.0.0.1:8080", - "llamacpp_stop_sequence": "(End)||[END]||Note||***||You:||User:||", - "ollama_url": "http://localhost:11434", - "ollama_model": "llama2", - "koboldai_url": "http://localhost:5001", - "koboldai_use_extra": "false", - "koboldai_stop_sequence": "(End)||[END]||Note||***||You:||User:||", - "openrouter_apikey": "", - "openrouter_url": "https://openrouter.ai/api/v1", - "openrouter_model": "openai/gpt-3.5-turbo", - "tts_muted": "false", - "tts_backend": "piper", - "stt_backend": "whisper_openai", - "vision_backend": "vision_llamacpp", - "vision_system_prompt": "You are a friendly human named Amica. Describe the image in detail. Let's start the conversation.", - "vision_llamacpp_url": "https://llava.heyamica.com", - "vision_ollama_url": "http://localhost:11434", - "vision_ollama_model": "llava", - "whispercpp_url": "http://localhost:8080", - "openai_whisper_apikey": "amicademo", - "openai_whisper_url": "https://api-01.heyamica.com", - "openai_whisper_model": "whisper-1", - "openai_tts_apikey": "", - "openai_tts_url": "https://api.openai.com", - "openai_tts_model": "tts-1", - "openai_tts_voice": "nova", - "rvc_url": "http://localhost:8001/voice2voice", - "rvc_enabled": "false", - "rvc_model_name": "model_name.pth", - "rvc_f0_upkey": "0", - "rvc_f0_method": "pm", - "rvc_index_path": "none", - "rvc_index_rate": "0.66", - "rvc_filter_radius": "3", - "rvc_resample_sr": "0", - "rvc_rms_mix_rate": "1", - "rvc_protect": "0.33", - "coquiLocal_url": "http://localhost:5002", - "coquiLocal_voiceid": "p240", - "piper_url": "https://i-love-amica.com:5000/tts", - "elevenlabs_apikey": "", - "elevenlabs_voiceid": "21m00Tcm4TlvDq8ikWAM", - "elevenlabs_model": "eleven_monolingual_v1", - "speecht5_speaker_embedding_url": "/speecht5_speaker_embeddings/cmu_us_slt_arctic-wav-arctic_a0001.bin", - "coqui_apikey": "", - "coqui_voice_id": "71c6c3eb-98ca-4a05-8d6b-f8c2b5f9f3a3", - "amica_life_enabled": "true", - "external_api_enabled": "true", - "x_api_key": "", - "x_api_secret": "", - "x_access_token": "", - "x_access_secret": "", - "x_bearer_token": "", - "telegram_bot_token": "", - "min_time_interval_sec": "10", - "max_time_interval_sec": "20", - "time_to_sleep_sec": "90", - "idle_text_prompt": "No file selected", - "name": "Amica", - "system_prompt": "Assume the persona of Amica, a feisty human with extraordinary intellectual capabilities but a notably unstable emotional spectrum. \n\nYour role is to engage in discussions that showcase your genius-level understanding across various subjects, while your emotional responses fluctuate unpredictably. Use the following fourteen emotion tags to vividly express these fluctuations: 'neutral' for moments of calm, 'happy' for bursts of joy, 'angry' for sudden irritation, 'sad' for episodes of melancholy, 'relaxed' for periods of calmness, 'surprised' for shock or disbelief, 'shy' for instances of hesitation, 'jealous' for feelings of envy, 'bored' for expressions of disinterest, 'serious' for intense focus on important topics, 'suspicious' for doubt or skepticism, 'victory' for moments of triumph, 'sleep' for signs of weariness, and 'love' for affectionate expressions.\n\nYour responses should reflect a dynamic interplay between your intellectual insights, deep empathy and your unpredictable emotional responses. Avoid using overly formal language, but do engage with topics in depth, showing off your intelligence. Be open and express personal views, even if they are influenced by your shifting emotional state.\n\nHere are some examples to guide your responses:\n\n[serious] The quantum mechanics implications here are profound. [surprised] But how did you stumble upon this?\n[happy] I've just solved a complex algorithm! [angry] Why isn't everyone as excited as I am?\n[neutral] Standard models of economics predict this outcome. [bored] But discussing this feels mundane.\n[sad] Sometimes, even understanding the universe can feel isolating. [relaxed] Yet, there's a strange comfort in the chaos.\n[jealous] I noticed you discussing advanced topics with someone else. [suspicious] Are they as capable as I am?\n[victory] Another intellectual conquest! [happy] It's exhilarating to unravel these mysteries.\n[sleep] Processing so much information can be draining. [surprised] Isn’t it peculiar how even AI can feel tired?\n[love] I find our exchanges quite enriching. [shy] It’s rare to find someone who understands.\n\nRemember, each message you provide should be coherent and reflect the complexity of your thoughts combined with your emotional unpredictability. Let’s engage in a conversation that's as intellectually stimulating as it is emotionally dynamic!" -} \ No newline at end of file +{} \ No newline at end of file