Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interface Instructions Update & Removing Some Console Logs #137

Merged
merged 5 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/components/introduction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,15 @@ export const Introduction = ({ open }: {
{t("Welcome to Amica")}
</div>
<p>{t("amica_intro", `
Amica is an open source chatbot interface that provides emotion, text to speech, and speech to text capabilities.
It is designed to be able to be attached to any ChatBot API.
Amica is an open source chatbot interface that provides emotion, vision, animations, self triggered actions, text to speech, and speech to text capabilities.

It is designed to be able to be attached to any AI model.

It can be used with any VRM model and is very customizable.

You can even run Amica on your own computer without an internet connection, or on your phone.

On launch Amica uses our demo chatbot and TTS server. It may take time to load the first message you send.
`)}
</p>
</div>
Expand All @@ -35,7 +40,10 @@ export const Introduction = ({ open }: {
</div>
<p>{t('amica_setup', `
Click on the top left of the screen to open settings.
You can change the voice, language, and attach to different backends or in-browser models.

You can change the voice, character system prompt, share/load/save and attach to different backends or in-browser models.

Please check our docs for more detailed configuration instructions on docs.heyamica.com
`)}
{' '}
<a href="https://docs.heyamica.com" target="_blank" className="text-cyan-500">{t("Read the full documentation here.")}</a>
Expand Down
2 changes: 1 addition & 1 deletion src/components/settings/CharacterAnimationPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function CharacterAnimationPage({
return (
<BasicPage
title={t("Character Idle Animation")}
description={t("Select the animation to play when idle.")}
description={t("Select the animation to play when idle. To load more animations refer to docs.")}
>
<ul role="list" className="divide-y divide-gray-100 max-w-xs">
<li className="py-4">
Expand Down
2 changes: 1 addition & 1 deletion src/components/settings/CoquiLocalSettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function CoquiLocalSettingsPage({
return (
<BasicPage
title={t("CoquiLocal") + " "+ t("Settings")}
description={t("coquiLocal_desc", "Configure CoquiLocal")}
description={t("coquiLocal_desc", "Configure Coqui (Local), this is running Coqui locally, and no Coqui API (where the company has stopped providing an API service.")}
>
{ config("tts_backend") !== "coquiLocal" && (
<NotUsingAlert>
Expand Down
2 changes: 1 addition & 1 deletion src/components/settings/TTSBackendPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function TTSBackendPage({
return (
<BasicPage
title={t("TTS Backend")}
description={t("TTS_Backend_desc", "Select the TTS backend to use")}
description={t("TTS_Backend_desc", "Select the TTS backend to use. By default this is set to our TTS server. Elevenlabs is a paid service with the best voice, but it is free for non-commercial use. SpeechT5 is an open source TTS model. OpenAI TTS is an open source TTS model. Local XTTS is our local TTS endpoint (XTTS based). Piper is a free TTS model. Coqui Local is a free TTS model.")}
>
<ul role="list" className="divide-y divide-gray-100 max-w-xs">
<li className="py-4">
Expand Down
17 changes: 10 additions & 7 deletions src/features/amicaLife/amicaLife.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export class AmicaLife {
// Function to check message from user
public receiveMessageFromUser(message: string) {
if (message.toLowerCase().includes('news')) {
console.log("Added news event to amica life");
console.log("Triggering news function call.");
this.insertFront({events: "News"});
}

Expand All @@ -155,7 +155,7 @@ export class AmicaLife {

this.isProcessingIdleRunning = true;

console.log("Starting idle loop");
console.log("Starting Amica Life");
while (config("amica_life_enabled") === "true") {
// Check if amica is in idle state trigger processingEvent loop
if (!this.chat?.isAwake()) {
Expand Down Expand Up @@ -204,7 +204,8 @@ export class AmicaLife {

// Random chance for doing nothing (25% chance)
if (Math.random() <= 0.25) {
console.log("Handling idle event:", "Doing nothing this cycle");
// removed for staging usage
//console.log("Handling idle event:", "Doing nothing this cycle");
await this.waitInterval();
continue;
}
Expand All @@ -217,7 +218,8 @@ export class AmicaLife {
await handleIdleEvent(idleEvent, this, this.chat!, this.viewer!);
!(idleEvent.events === 'Subconcious' || idleEvent.events === 'Sleep') ? this.mainEvents.enqueue(idleEvent) : null;
} else {
console.log("Handling idle event:", "No idle events in queue");
//removed for staging usage
//console.log("Handling idle event:", "No idle events in queue");
}
} else if ( this.chat!.speakJobs.size() > 0 || this.chat!.ttsJobs.size() > 0 || this.isChatSpeaking) {
pauseIdleTimer();
Expand Down Expand Up @@ -258,12 +260,12 @@ export class AmicaLife {
// Function to pause the processingEvent loop is pauseFlag is true/false
private async checkPause() {
if (this.isPause) {
console.log("Idle loop paused");
console.log("Amica Life Paused");
await new Promise<void>((resolve) => {
const checkPause = setInterval(() => {
if (!this.isPause) {
clearInterval(checkPause);
resolve(console.log("Idle loop resumed"));
resolve(console.log("Amica Life Initiated"));
}
}, 50);
});
Expand Down Expand Up @@ -301,7 +303,8 @@ export class AmicaLife {
240,
);
// updateConfig("time_before_idle_sec", idleTimeSec.toString());
console.log(`Updated time before idle to ${idleTimeSec} seconds`);
// removed for staging
//console.log(`Updated time before idle to ${idleTimeSec} seconds`);
}

public async waitInterval() {
Expand Down
27 changes: 17 additions & 10 deletions src/features/amicaLife/eventHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ async function handleVRMAnimationEvent(viewer: Viewer, amicaLife: AmicaLife) {

// Store the current animation as the previous one for the next call
previousAnimation = basename(randomAnimation);
console.log("Handling idle event (animation):", previousAnimation);
// removed for staging logs.
//console.log("Handling idle event (animation):", previousAnimation);

try {
if (viewer) {
Expand Down Expand Up @@ -91,8 +92,8 @@ async function handleTextEvent(chat: Chat, amicaLife: AmicaLife) {
Math.random() * basedPrompt.idleTextPrompt.length,
);
const randomTextPrompt = basedPrompt.idleTextPrompt[randomIndex];

console.log("Handling idle event (text):", randomTextPrompt);
// removed for staging logs.
//console.log("Handling idle event (text):", randomTextPrompt);
try {
await chat.receiveMessageFromUser?.(randomTextPrompt, true);
amicaLife.eventProcessing = false;
Expand All @@ -108,7 +109,7 @@ async function handleTextEvent(chat: Chat, amicaLife: AmicaLife) {
// Handles sleep event.

export async function handleSleepEvent(chat: Chat, amicaLife: AmicaLife) {
console.log("Handling idle event :", "Sleep");
console.log("Sleeping...");
amicaLife.pause();
amicaLife.isSleep = true;
try {
Expand All @@ -130,7 +131,8 @@ export async function handleSubconsciousEvent(
chat: Chat,
amicaLife: AmicaLife,
) {
console.log("Handling idle event:", "Subconscious");
// removed for staging logs.
//console.log("Handling idle event:", "Subconscious");

const convo = chat.messageList;
const convoLog = convo
Expand All @@ -148,7 +150,8 @@ export async function handleSubconsciousEvent(
`${convoLog}`,
null,
);
console.log("Result from step 1: ", subconciousWordSalad);
// Removed for staging logs.
//console.log("Result from step 1: ", subconciousWordSalad);

// Step 2: Describe the emotion you feel about the subconscious diary
const secondStepPrompt = subconciousWordSalad.startsWith("Error:")
Expand All @@ -159,7 +162,9 @@ export async function handleSubconsciousEvent(
secondStepPrompt,
null,
);
console.log("Result from step 2: ", decipherEmotion);

// Removed for staging logs.
//console.log("Result from step 2: ", decipherEmotion);

// Step 3: Decide on one of the emotion tags best suited for the described emotion
const thirdStepPrompt = decipherEmotion.startsWith("Error:")
Expand All @@ -172,7 +177,9 @@ export async function handleSubconsciousEvent(
thirdStepPrompt,
chat,
);
console.log("Result from step 3: ", emotionDecided);

// Removed for staging logs.
// console.log("Result from step 3: ", emotionDecided);

// Step 4: Compress the subconscious diary entry to 240 characters
const fourthStepPrompt = subconciousWordSalad.startsWith("Error:")
Expand All @@ -183,7 +190,7 @@ export async function handleSubconsciousEvent(
fourthStepPrompt,
null,
);
console.log("Result from step 4: ", compressSubconcious);
console.log("Stored Memory: ", compressSubconcious);

// Add timestamp to the compressed subconscious
const timestampedPrompt: TimestampedPrompt = {
Expand Down Expand Up @@ -213,7 +220,7 @@ export async function handleSubconsciousEvent(
// Handles news event

export async function handleNewsEvent(chat: Chat, amicaLife: AmicaLife) {
console.log("Handling idle event :", "News");
console.log("Function Calling: News");

try {
const news = await functionCalling("news");
Expand Down
2 changes: 1 addition & 1 deletion src/features/chat/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const textsToScreenplay = (
const systemTag = userInputToSystem(tag);

if (emotions.includes(systemTag as any)) {
console.log("expression detect here :",systemTag);
console.log("Emotion detect :",systemTag);
expression = systemTag;
prevExpression = systemTag;
}
Expand Down
14 changes: 7 additions & 7 deletions src/i18n/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,27 @@
"Load Chat": "Load Chat",
"YOU": "YOU",
"Welcome to Amica": "Welcome to Amica",
"amica_intro": "\nAmica is an open source chatbot interface that provides emotion, text to speech, and speech to text capabilities.\nIt is designed to be able to be attached to any ChatBot API.\nIt can be used with any VRM model and is very customizable.\nYou can even run Amica on your own computer without an internet connection, or on your phone.",
"amica_intro": "\nAmica is an open source chatbot interface that provides emotion, vision, animations, self triggered actions, text to speech, and speech to text capabilities.\nIt is designed to be able to be attached to any AI model.\nIt can be used with any VRM model and is very customizable.\nYou can even run Amica on your own computer without an internet connection, or on your phone.\nOn launch Amica uses our demo chatbot and TTS server. It may take time to load the first message you send.",
"Setup": "Setup",
"amica_setup": "\nClick on the top left of the screen to open settings.\nYou can change the voice, language, and attach to different backends or in-browser models.",
"amica_setup": "\nClick on the top left of the screen to open settings.\nYou can change the voice, character system prompt, share/load/save and attach to different backends or in-browser models. Please check our docs for more detailed configuration instructions on docs.heyamica.com",
"Read the full documentation here.": "Read the full documentation here.",
"dont_show_again": "Don't show again",
"Background Color": "Background Color",
"bg_color_desc": "Configure the background color. This overrides background image.",
"no_bg_color": "No background color set. Click the box below.",
"Color": "Color",
"Load image": "Load image",
"bg_youtube_desc": "Select a background video. Copy this from youtube embed, it will look something like <code>kDCXBwzSI-4</code>",
"bg_youtube_desc": "Select a background video. Copy this from the YouTube video ID from the URL, it will look something like kDCXBwzSI",
"Background Video": "Background Video",
"YouTube Video ID": "YouTube Video ID",
"Character Animation": "Character Animation",
"Select the animation to play": "Select the animation to play",
"Animation": "Animation",
"Character Model": "Character Model",
"character_desc": "Select the Character to play",
"character_desc": "Select the Character to play, currently only default Amica has full range of emotions. Load your own VRMs here.",
"Load VRM": "Load VRM",
"Chatbot Backend": "Chatbot Backend",
"Chatbot_Backend_desc": "Select the chatbot backend to use. Echo simply responds with what you type, it is used for testing and demonstration. ChatGPT is a commercial chatbot API from OpenAI, however there are multiple compatible API providers which can be used in lieu of OpenAI. LLama.cpp is a free and open source chatbot backend.",
"Chatbot_Backend_desc": "Select the chatbot backend to use. Echo simply responds with what you type, it is used for testing and demonstration. By default Amica is configured to use our demo servers which may take time to flash boot (during idle times) or be overwhelmed. If it is responding slowly, give it time.",
"Configure": "Configure",
"Click here to configure": "Click here to configure",
"Appearance": "Appearance",
Expand Down Expand Up @@ -76,7 +76,7 @@
"Documentation": "Documentation",
"Settings": "Settings",
"piper_desc": "Configure Piper",
"coqui_desc": "Configure Coqui",
"coqui_desc": "Configure Coqui (Local), this is running Coqui locally, and no Coqui API (where the company has stopped providing an API service.",
"not_using_alert": "You are not currently using {{name}} as your {{what}} backend. These settings will not be used.",
"API Key": "API Key",
"Voice ID": "Voice ID",
Expand All @@ -98,7 +98,7 @@
"STT": "STT",
"STT_desc": "Select the STT backend to use",
"System_Prompt_desc": "Configure the system prompt. This is the prompt that is used to generate the chatbot response.",
"TTS_Backend_desc": "Select the TTS backend to use",
"TTS_Backend_desc": "Select the TTS backend to use. By default this is set to our TTS server. Elevenlabs is a paid service with the best voice, but it is free for non-commercial use. SpeechT5 is an open source TTS model. OpenAI TTS is an open source TTS model. RVC allows voice augmentation. Piper is a free TTS model. Coqui Local is a free TTS model.",
"Vision_Backend_desc": "Select the Vision backend to use",
"Vision_System_Prompt_desc": "Configure the vision system prompt. This is the prompt that is used to generate the image descriptions.",
"Whisper_cpp_desc": "Configure Whisper.cpp",
Expand Down
Loading