diff --git a/src/games/ai/assets/style.css b/src/games/ai/assets/style.css
index 890c9ff..da4c5be 100644
--- a/src/games/ai/assets/style.css
+++ b/src/games/ai/assets/style.css
@@ -53,6 +53,12 @@ button {
background-color: var(--backgroundColor);
color: var(--color);
cursor: pointer;
+ user-select: none;
+
+ &.disabled {
+ pointer-events: none;
+ opacity: 0.5;
+ }
}
body {
diff --git a/src/games/ai/components/input.tsx b/src/games/ai/components/input.tsx
index 9094c38..5ccbfb6 100644
--- a/src/games/ai/components/input.tsx
+++ b/src/games/ai/components/input.tsx
@@ -7,6 +7,8 @@ export const Input = () => {
const { input, setInput, addMessage, continueMessage } = useContext(StateContext);
const { generating } = useContext(LLMContext);
+ console.log({generating});
+
const handleChange = useCallback((e: Event) => {
if (e.target instanceof HTMLTextAreaElement) {
setInput(e.target.value);
@@ -36,7 +38,7 @@ export const Input = () => {
return (
-
+
);
}
\ No newline at end of file
diff --git a/src/games/ai/components/minichat/minichat.tsx b/src/games/ai/components/minichat/minichat.tsx
index 5acefb0..da8680d 100644
--- a/src/games/ai/components/minichat/minichat.tsx
+++ b/src/games/ai/components/minichat/minichat.tsx
@@ -27,17 +27,22 @@ export const MiniChat = ({ history = [], buttons = {}, open, onClose }: IProps)
ref.current?.querySelectorAll('textarea').forEach(height ? DOMTools.fixHeight : DOMTools.scrollDown);
}, []);
+ const handleInit = useCallback((force = false) => {
+ if (force || confirm('Clear chat?')) {
+ setMessages([MessageTools.create('', 'user', true)]);
+ }
+ }, []);
+
useEffect(() => {
fitTextareas();
}, [messages]);
useEffect(() => {
+ if (messages.length === 0) {
+ handleInit(true);
+ }
DOMTools.scrollDown(ref.current);
- }, [messages.length]);
-
- useEffect(() => {
- setMessages([MessageTools.create('', 'user', true)]);
- }, [open])
+ }, [messages.length, handleInit]);
const handleGenerate = useCallback(async () => {
if (messages.length > 0 && !generating) {
@@ -97,11 +102,18 @@ export const MiniChat = ({ history = [], buttons = {}, open, onClose }: IProps)
-