Spaces:
Paused
Paused
matt HOFFNER
commited on
Commit
·
c6bfbcd
1
Parent(s):
fe82d96
fix
Browse files
components/Playground/index.tsx
CHANGED
|
@@ -58,14 +58,13 @@ const Playground = () => {
|
|
| 58 |
setLastAppendedSystemMessage(systemMessage);
|
| 59 |
};
|
| 60 |
|
| 61 |
-
useEffect(() => {
|
| 62 |
-
appendSystemMessage();
|
| 63 |
-
}, []);
|
| 64 |
-
|
| 65 |
const modifiedHandleSubmit = async (e: FormEvent<HTMLFormElement>, chatRequestOptions?: ChatRequestOptions) => {
|
| 66 |
e.preventDefault();
|
| 67 |
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
| 69 |
await appendSystemMessage();
|
| 70 |
}
|
| 71 |
|
|
|
|
| 58 |
setLastAppendedSystemMessage(systemMessage);
|
| 59 |
};
|
| 60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
const modifiedHandleSubmit = async (e: FormEvent<HTMLFormElement>, chatRequestOptions?: ChatRequestOptions) => {
|
| 62 |
e.preventDefault();
|
| 63 |
|
| 64 |
+
// Append the system message if:
|
| 65 |
+
// 1. This is the first message in the chat.
|
| 66 |
+
// 2. The system message has changed.
|
| 67 |
+
if (messages.length === 0 || systemMessage !== lastAppendedSystemMessage) {
|
| 68 |
await appendSystemMessage();
|
| 69 |
}
|
| 70 |
|