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

Updating Amica to 1.2 (New Version) (To be streamlined for speed) #132

Merged
merged 105 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
7b5a7dc
amica life, basic event queue
flukexp Jun 3, 2024
c0d10df
New bubble message, loop fixed, remove unnecessary console
flukexp Jun 3, 2024
5a324db
added setting page, amica poked detection
flukexp Jun 5, 2024
adca7d2
clean up
flukexp Jun 6, 2024
3aad419
time before idle increases on curve everytime it gets ignored
flukexp Jun 7, 2024
345624d
fixed delay loop after turn off amica life
flukexp Jun 10, 2024
5adcc96
Expand animation emotion type
flukexp Jun 6, 2024
d583f0b
added the mapping of user expression tags to the system format
flukexp Jun 7, 2024
61be4b7
small fixed
flukexp Jun 7, 2024
2fb3d7d
Sus to Suspicious
flukexp Jun 7, 2024
7f6b549
fix poke break
flukexp Jun 11, 2024
64bd5d4
added pause/resume mechanism for idle loop
flukexp Jun 12, 2024
101449e
pause/resume when the setting page trigger
flukexp Jun 12, 2024
127625f
fixed deployment fail
flukexp Jun 12, 2024
5772d1b
fixed deployment fail
flukexp Jun 12, 2024
d63f103
remove trigger vrma animation
flukexp Jun 12, 2024
36b5ed2
change the amica life initialization
flukexp Jun 12, 2024
f8ad76f
added trigger vrma animation from amica life idle queue
flukexp Jun 12, 2024
eadad4e
play animation one time
flukexp Jun 12, 2024
9f34e86
remove extra vrma file
flukexp Jun 13, 2024
b394666
added error handling in loading animation
flukexp Jun 13, 2024
88f7384
added sample vrma for test
flukexp Jun 13, 2024
7ed5792
updated increase time before idle
flukexp Jun 13, 2024
d7bc0e0
clean up
flukexp Jun 17, 2024
ddd0110
sleep after being idle for 2 min and fixed character shift position
flukexp Jun 19, 2024
710a54e
merge expand emotion and added setting for sleep
flukexp Jun 19, 2024
ba3debb
Merge branch 'test-amica-1.2' into amica-life
flukexp Jun 19, 2024
bbf0515
fixed sleep
flukexp Jun 19, 2024
193c920
Updating Test Branch with Amica Life and Animations
slowsynapse Jun 20, 2024
efa2626
implemented json file uploader for idle text prompt,few shot prompt o…
flukexp Jun 24, 2024
52b9486
small fixed on json file uploader
flukexp Jun 24, 2024
78fce24
Idle text prompt fixed
flukexp Jun 24, 2024
a8f916d
small fixed
flukexp Jun 24, 2024
d32259a
comment out handlePoked
flukexp Jun 25, 2024
dc6f90f
Subconcious thought from llm and small fixed on idle text prompt
flukexp Jun 27, 2024
832bba1
remove process response in ask llm
flukexp Jun 27, 2024
aaa2c20
small fixed on sunconsious event
flukexp Jun 27, 2024
86d1728
move amica life setting page and log the result for each step in subc…
flukexp Jul 2, 2024
35b5bc7
added new model and thumbnail
flukexp Jul 2, 2024
4f116a7
refactor chat.ts
flukexp Jul 3, 2024
f692e66
added basic news fn calling on amica life
flukexp Jul 5, 2024
2534dab
fixed api
flukexp Jul 5, 2024
b43845b
refactor the code in functionCalling and change the api
flukexp Jul 8, 2024
bbb48af
Merging updated subconcious subroutine and idle prompt handler for te…
slowsynapse Jul 8, 2024
58982b0
Optimising default idle prompts
slowsynapse Jul 8, 2024
71c2d20
Revert "Optimising default idle prompts"
slowsynapse Jul 8, 2024
5c62d10
Idle Prompt Optimising Typo Fix
slowsynapse Jul 8, 2024
a65c70a
tested subconcious subroutine disable idle prompt
flukexp Jul 10, 2024
39dccfe
Merge branch 'test-amica-1.2' into amica-life
flukexp Jul 10, 2024
61107be
remove increase time before idle every curve its get ignored
flukexp Jul 10, 2024
7ba7197
Update Subconcious Prompts
slowsynapse Jul 10, 2024
e64d64d
Fixed Line Break
slowsynapse Jul 10, 2024
647dc4e
Further Optimizing Subconcious Prompts
slowsynapse Jul 10, 2024
91c411a
Subconcious Subroutine Rewrite #1
slowsynapse Jul 11, 2024
77cefb1
Update #2
slowsynapse Jul 11, 2024
21a32fc
restore idle prompt
flukexp Jul 11, 2024
8265699
test subconcious subroutine
flukexp Jul 11, 2024
eb900a9
test subconcious subroutine
flukexp Jul 11, 2024
3ce820d
restore idle prompt
flukexp Jul 11, 2024
f145399
test subconcious subroutine
flukexp Jul 11, 2024
93606f4
restore idle prompt
flukexp Jul 11, 2024
756a095
fixed idle text prompts
flukexp Jul 12, 2024
d519c6f
smoother the transition between each VRMA animation
flukexp Jul 13, 2024
5839ed4
Merge branch 'fn-calling' into amica-life
flukexp Jul 14, 2024
ecf90d4
Merge pull request #1 from flukexp/amica-life
flukexp Jul 14, 2024
e466dca
merge amica life
flukexp Jul 14, 2024
a749f79
Merge pull request #2 from flukexp/fn-calling
flukexp Jul 14, 2024
a6db50b
refactor chat.ts and amicaLife.ts
flukexp Jul 17, 2024
7aa2d9f
fixed duplicate loop
flukexp Jul 17, 2024
2c526d9
fixed input tag error in Amica life setting page
flukexp Jul 18, 2024
59ab29a
news function calling
flukexp Jul 18, 2024
530607e
fixed sleep event
flukexp Jul 26, 2024
d74e84b
fixed save chat log included emotion tag
flukexp Jul 29, 2024
b681f48
fixed vrma animation transition
flukexp Jul 30, 2024
d4f8af0
removed unnecessary log
flukexp Jul 30, 2024
c8433a8
fixed stop timer when amica speaking
flukexp Jul 30, 2024
a9245b1
removed unnecessary log
flukexp Jul 30, 2024
02a2c5d
Merging update to 1.2 main branch.
slowsynapse Aug 6, 2024
1472ed9
Merge branch 'test-amica-1.2' into function_calling
flukexp Aug 7, 2024
9582b96
chat mode
flukexp Aug 7, 2024
c96dfda
Replaced debug button with brain button to log result in stored subco…
flukexp Aug 8, 2024
423a777
System Prompt and Amica Timer Default Settings
slowsynapse Aug 8, 2024
c9862a5
Setting descriptions updated.
slowsynapse Aug 8, 2024
1784938
Update default background
slowsynapse Aug 8, 2024
4c30918
Default configration update and settings instructions improved.
slowsynapse Aug 8, 2024
1a9f41e
Create dance.vrma
slowsynapse Aug 8, 2024
4321815
Added Dance to Animation
slowsynapse Aug 8, 2024
2b6e468
Added subconcious text displayer
flukexp Aug 9, 2024
c9c058c
Refactor function calling
flukexp Aug 9, 2024
51fd0e4
Fixed UI on subconcious logs displayer
flukexp Aug 9, 2024
cd06f51
Merged Experimental Function Calling (News) to 1.2
slowsynapse Aug 9, 2024
0a54010
added chat mode, brain botton and chat log state manager
flukexp Aug 11, 2024
f2e222c
Merged Brain Icon and Chat Mode
slowsynapse Aug 12, 2024
07c196f
Removed line 54 (repeat variable declaration)
slowsynapse Aug 12, 2024
a3d6607
fixed wake word
flukexp Aug 13, 2024
af4d8ab
fixed subconcious to be 1 per idle cycle
flukexp Aug 13, 2024
19e39fc
Reduced occuring of subconcious subroutine (based on user input)
slowsynapse Aug 20, 2024
85c4b7f
Fixed camera upload window should close image upload
flukexp Aug 20, 2024
bf437c1
Close Camera Window After Image Upload
slowsynapse Aug 27, 2024
278e87c
Fixed wake word conflict when amica life turn on and not receive trig…
flukexp Aug 30, 2024
ea1b668
Fixed Wake Word + Amica Wakes Up on Wake Word.
slowsynapse Sep 12, 2024
d22d36d
Configuration Update (Hacky)
slowsynapse Sep 12, 2024
8269e9f
fixed config variables
slowsynapse Sep 12, 2024
47e1124
fixed typo
slowsynapse Sep 12, 2024
63a5ec8
Corrected Wake Word Idle Time
slowsynapse Sep 12, 2024
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
38 changes: 38 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@pixiv/three-vrm": "^2.0.7",
"@ricky0123/vad-react": "^0.0.17",
"@supabase/supabase-js": "^2.39.0",
"@tabler/icons-react": "^3.11.0",
"@tailwindcss/forms": "^0.5.6",
"@tailwindcss/line-clamp": "^0.4.4",
"@xenova/transformers": "^2.7.0",
Expand Down
Binary file added public/animations/dance.vrma
Binary file not shown.
Binary file added public/animations/greeting.vrma
Binary file not shown.
Binary file added public/animations/modelPose.vrma
Binary file not shown.
Binary file added public/animations/peaceSign.vrma
Binary file not shown.
Binary file added public/animations/shoot.vrma
Binary file not shown.
Binary file added public/animations/showFullBody.vrma
Binary file not shown.
Binary file added public/animations/spin.vrma
Binary file not shown.
Binary file added public/animations/squat.vrma
Binary file not shown.
Binary file modified public/vrm/AvatarSample_A.vrm
Binary file not shown.
Binary file modified public/vrm/AvatarSample_B.vrm
Binary file not shown.
Binary file modified public/vrm/AvatarSample_C.vrm
Binary file not shown.
Binary file added public/vrm/AvatarSample_D.vrm
Binary file not shown.
Binary file modified public/vrm/thumb-AvatarSample_A.vrm.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/vrm/thumb-AvatarSample_B.vrm.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/vrm/thumb-AvatarSample_C.vrm.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/vrm/thumb-AvatarSample_D.vrm.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/components/assistantText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export const AssistantText = ({ message }: { message: string }) => {
const scrollRef = useRef<HTMLDivElement>(null);
const [unlimited, setUnlimited] = useState(false)

// Replace all of the emotion tag in message with ""
message = message.replace(/\[(.*?)\]/g, "");

useEffect(() => {
scrollRef.current?.scrollIntoView({
behavior: "smooth",
Expand Down Expand Up @@ -45,3 +48,4 @@ export const AssistantText = ({ message }: { message: string }) => {
</div>
);
};

16 changes: 8 additions & 8 deletions src/components/chatLog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const ChatLog = ({

const handleResumeButtonClick = (num: number, newMessage: string) => {
bot.setMessageList(messages.slice(0, num));
bot.receiveMessageFromUser(newMessage);
bot.receiveMessageFromUser(newMessage,false);
};

const txtFileInputRef = useRef<HTMLInputElement>(null);
Expand Down Expand Up @@ -56,7 +56,7 @@ export const ChatLog = ({
bot.setMessageList(parsedChat.slice(0, parsedChat.length - 1));

if (lastMessage.role === "user") {
bot.receiveMessageFromUser(lastMessage.content);
bot.receiveMessageFromUser(lastMessage.content,false);
} else {
bot.bubbleMessage(lastMessage.role, lastMessage.content);
}
Expand Down Expand Up @@ -132,7 +132,7 @@ export const ChatLog = ({
<div key={i} ref={messages.length - 1 === i ? chatScrollRef : null}>
<Chat
role={msg.role}
message={msg.content}
message={msg.content.replace(/\[(.*?)\]/g, "")}
num={i}
onClickResumeButton={handleResumeButtonClick}
/>
Expand Down Expand Up @@ -165,10 +165,10 @@ function Chat({
onClickResumeButton: (num: number, message: string) => void;
}) {
const { t } = useTranslation();
const [textAreaValue, setTextAreaValue] = useState(message);
// const [textAreaValue, setTextAreaValue] = useState(message);

const onClickButton = () => {
const newMessage = textAreaValue
const newMessage = message
onClickResumeButton(num, newMessage);
};

Expand Down Expand Up @@ -203,11 +203,11 @@ function Chat({
<div className="px-4 py-2 bg-white/80 backdrop-blur-lg rounded-b-lg shadow-sm">
<div className='typography-16 font-M_PLUS_2 font-bold text-gray-800'>
{role === "assistant" ? (
<div>{textAreaValue}</div>
<div>{message}</div>
) : (
<FlexTextarea
value={textAreaValue}
onChange={setTextAreaValue}
value={message}
// onChange={setTextAreaValue}
/>
)}
</div>
Expand Down
117 changes: 117 additions & 0 deletions src/components/chatModeText.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
import { useEffect, useRef, useState } from "react";
import { clsx } from "clsx";
import { config } from "@/utils/config";
import { IconButton } from "./iconButton";
import { useTranslation } from "react-i18next";
import { Message } from "@/features/chat/messages";

export const ChatModeText = ({ messages }: { messages: Message[] }) => {
const chatScrollRef = useRef<HTMLDivElement>(null);

useEffect(() => {
chatScrollRef.current?.scrollIntoView({
behavior: "smooth",
block: "center",
});
}, [messages]);

return (
<div className="fixed bottom-0 w-full h-[90%] mb-20 flex flex-col justify-end">
<div className="w-full h-full overflow-y-auto flex flex-col-reverse">

<div className="w-full max-w-full mx-auto px-4 md:px-16 flex flex-col">
{messages.map((msg, i) => {
return (
<div key={i} ref={messages.length - 1 === i ? chatScrollRef : null}>
<Chat
role={msg.role}
message={msg.content.replace(/\[(.*?)\]/g, "")}
num={i}
/>
</div>
);
})}
</div>
</div>
</div>

);
};

function Chat({
role,
message,
num,
}: {
role: string;
message: string;
num: number;
}) {
const { t } = useTranslation();
const scrollRef = useRef<HTMLDivElement>(null);
const [unlimited, setUnlimited] = useState(false);

// useEffect(() => {
// scrollRef.current?.scrollIntoView({
// behavior: "smooth",
// block: "center",
// });
// });

return (
<div className={clsx(
'mx-auto max-w-4xl my-2',
role === "assistant" ? "pr-10 sm:pr-20" : "pl-10 sm:pl-20",
)}>
<div className="backdrop-blur-lg rounded-lg">
<div className="shadow-lg backdrop-blur-lg rounded-lg bg-white/70">

<div className={clsx(
'pr-1 py-3 bg-rose/90 rounded-t-lg text-white font-bold tracking-wider',
role === "assistant" ? "px-8" : "px-8",
)}>
<span className={clsx(
"p-4 rounded-lg rounded-tl-none rounded-tr-none shadow-sm",
role === "assistant" ? "bg-pink-600/80" : "bg-cyan-600/80",
)}>
{role === "assistant" && config('name').toUpperCase()}
{role === "user" && t("YOU")}
</span>

{role === "assistant" && (
<IconButton
iconName="24/FrameSize"
className="bg-transparent hover:bg-transparent active:bg-transparent disabled:bg-transparent float-right"
isProcessing={false}
onClick={() => setUnlimited(!unlimited)}
/>

)}
</div>
{role === "assistant" && (
<div className={clsx(
"px-8 py-4 overflow-y-auto",
unlimited ? 'max-h-32' : 'max-h-[calc(75vh)]',
)}>
<div className="min-h-8 max-h-full typography-16 font-bold text-gray-600">
{message.replace(/\[([a-zA-Z]*?)\]/g, "")}
<div ref={scrollRef} />
</div>
</div>
)}
{role === "user" && (
<div className="px-8 py-4 max-h-32 overflow-y-auto">
<div className="min-h-8 max-h-full typography-16 font-bold text-gray-600">
{message.replace(/\[([a-zA-Z]*?)\]/g, "")}
<div ref={scrollRef} />
</div>
</div>
)}
</div>
</div>


</div>

);
}
1 change: 1 addition & 0 deletions src/components/embeddedWebcam.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export function EmbeddedWebcam({
await bot.getVisionResponse(fixedImageData);
setCameraDisabled(false);
setImageData("");
setWebcamEnabled(false);
}
};

Expand Down
45 changes: 38 additions & 7 deletions src/components/messageInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { openaiWhisper } from "@/features/openaiWhisper/openaiWhisper";
import { whispercpp } from "@/features/whispercpp/whispercpp";
import { config } from "@/utils/config";
import { WaveFile } from "wavefile";
import { AmicaLifeContext } from "@/features/amicaLife/amicaLifeContext";

export default function MessageInput({
userMessage,
Expand All @@ -32,6 +33,7 @@ export default function MessageInput({
const [whisperCppOutput, setWhisperCppOutput] = useState<any | null>(null);
const { chat: bot } = useContext(ChatContext);
const { alert } = useContext(AlertContext);
const { amicaLife } = useContext(AmicaLifeContext);

const vad = useMicVAD({
startOnLoad: false,
Expand Down Expand Up @@ -119,25 +121,54 @@ export default function MessageInput({
const textStartsWithWakeWord = wakeWordEnabled && cleanFromPunctuation(cleanText).startsWith(cleanFromPunctuation(config("wake_word")));
const text = wakeWordEnabled && textStartsWithWakeWord ? cleanFromWakeWord(cleanText, config("wake_word")) : cleanText;

if (textStartsWithWakeWord) {
bot.updateAwake();
if (wakeWordEnabled) {
// Text start with wake word
if (textStartsWithWakeWord) {
// Pause amicaLife and update bot's awake status when speaking
if (config("amica_life_enabled") === "true") {
amicaLife.pause();
}
bot.updateAwake();
// Case text doesn't start with wake word and not receive trigger message in amica life
} else {
if (config("amica_life_enabled") === "true" && amicaLife.triggerMessage !== true && !bot.isAwake()) {
bot.updateAwake();
}
}
} else {
// If wake word off, update bot's awake when speaking
if (config("amica_life_enabled") === "true") {
amicaLife.pause();
bot.updateAwake();
}
}


if (text === "") {
return;
}


if (config("autosend_from_mic") === 'true') {
if (!wakeWordEnabled || bot.isAwake()) {
bot.receiveMessageFromUser(text);
}
if (!wakeWordEnabled || bot.isAwake()) {
bot.receiveMessageFromUser(text,false);
}
} else {
setUserMessage(text);
}
console.timeEnd('performance_transcribe');
}

function handleInputChange(event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) {
onChangeUserMessage(event);

// Pause amicaLife and update bot's awake status when typing
if (config("amica_life_enabled") === "true") {
amicaLife.pause();
bot.updateAwake();
}
}

// for whisper_browser
useEffect(() => {
if (transcriber.output && ! transcriber.isBusy) {
Expand All @@ -163,7 +194,7 @@ export default function MessageInput({
}, [whisperCppOutput]);

function clickedSendButton() {
bot.receiveMessageFromUser(userMessage);
bot.receiveMessageFromUser(userMessage,false);
// only if we are using non-VAD mode should we focus on the input
if (! vad.listening) {
inputRef.current?.focus();
Expand All @@ -189,7 +220,7 @@ export default function MessageInput({
type="text"
ref={inputRef}
placeholder="Write message here..."
onChange={onChangeUserMessage}
onChange={handleInputChange}
onKeyDown={(e) => {
if (e.key === "Enter") {
if (userMessage === "") {
Expand Down
2 changes: 2 additions & 0 deletions src/components/numberInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ export const NumberInput = ({
/>
);
};


Loading
Loading