Spaces:
Paused
Paused
matt HOFFNER
commited on
Commit
·
5b465ac
1
Parent(s):
2c2081c
tweak prompt
Browse files
components/Playground/index.tsx
CHANGED
|
@@ -18,6 +18,8 @@ import { SendIcon } from "../../constants/icon";
|
|
| 18 |
import ReactMarkdown from "react-markdown";
|
| 19 |
import { ChatRequestOptions } from "ai";
|
| 20 |
|
|
|
|
|
|
|
| 21 |
const Playground = () => {
|
| 22 |
const dispatch = useAppDispatch();
|
| 23 |
const formRef = useRef<HTMLFormElement>(null);
|
|
@@ -32,7 +34,7 @@ const Playground = () => {
|
|
| 32 |
const [selectedModel, setSelectedModel] = useState("GPT-4");
|
| 33 |
|
| 34 |
const [systemMessage, setSystemMessage] = useState(
|
| 35 |
-
|
| 36 |
);
|
| 37 |
|
| 38 |
const isValidCodeBlock = (markdownCode: string) => {
|
|
@@ -70,8 +72,9 @@ const Playground = () => {
|
|
| 70 |
};
|
| 71 |
|
| 72 |
await append(systemMessageToAdd);
|
|
|
|
|
|
|
| 73 |
}
|
| 74 |
-
await handleSubmit(e, chatRequestOptions);
|
| 75 |
};
|
| 76 |
|
| 77 |
useEffect(() => {
|
|
|
|
| 18 |
import ReactMarkdown from "react-markdown";
|
| 19 |
import { ChatRequestOptions } from "ai";
|
| 20 |
|
| 21 |
+
const DEFAULT_PROMPT = "You are a helpful AI assistant. Assist the user in writing React code, ensuring that all logic is contained within a single app component file and that the output is rendered to the DOM's root element. Always write React using inline styles and end the code snippet with rendering to root: ReactDOM.render(<App />, document.getElementById('root'));"
|
| 22 |
+
|
| 23 |
const Playground = () => {
|
| 24 |
const dispatch = useAppDispatch();
|
| 25 |
const formRef = useRef<HTMLFormElement>(null);
|
|
|
|
| 34 |
const [selectedModel, setSelectedModel] = useState("GPT-4");
|
| 35 |
|
| 36 |
const [systemMessage, setSystemMessage] = useState(
|
| 37 |
+
DEFAULT_PROMPT
|
| 38 |
);
|
| 39 |
|
| 40 |
const isValidCodeBlock = (markdownCode: string) => {
|
|
|
|
| 72 |
};
|
| 73 |
|
| 74 |
await append(systemMessageToAdd);
|
| 75 |
+
} else {
|
| 76 |
+
handleSubmit(e, chatRequestOptions);
|
| 77 |
}
|
|
|
|
| 78 |
};
|
| 79 |
|
| 80 |
useEffect(() => {
|