61372a96 by RSA

fixes

1 parent a5bb9937
...@@ -208,4 +208,61 @@ ...@@ -208,4 +208,61 @@
208 } 208 }
209 .submit:hover { 209 .submit:hover {
210 background:#066d55; 210 background:#066d55;
211 }
...\ No newline at end of file ...\ No newline at end of file
211 }
212
213 .suggested {
214 display: block;
215 z-index: 99999999;
216 color: #000;
217 position: absolute;
218 text-align: center;
219 padding: 25px;
220
221 top: 0;
222 right: 0;
223 bottom: 89px;
224 left: 0;
225 overflow-y: scroll;
226 }
227
228 .suggestedcol {
229 width: 30%;
230 display: inline-block;
231 margin: 0;
232 text-align: center;
233 vertical-align: top;
234 }
235
236 .suggestedcol ul {
237 list-style: none;
238 padding: 0 25px;
239 }
240
241 .suggestedrow.title {
242 padding: 100px 20px;
243 }
244
245 .suggestedcol ul li {
246 background: #5c6aa529;
247 padding: 10px;
248 border-radius: 5px;
249 margin: 10px 0;
250 margin-top: 10px;
251 margin-right: 0px;
252 margin-bottom: 10px;
253 margin-left: 0px;
254 }
255
256 ul.suggested-options {
257 cursor: pointer;
258 }
259
260
261 @media (max-width: 991px) {
262 .suggestedcol {
263 width: 100%;
264 }
265 .suggestedrow.title {
266 padding: 10px 10px 0 10px;
267 }
268 }
......
1 // import OpenAISVGLogo from './OpenAISVGLogo' 1 import React, { useState } from "react";
2 import SuggestedOptions from './suggestedOptions'
2 3
3 // Primary Chat Window 4 const ChatBox = ({chatLog, setChatInput, handleSubmit, chatInput}) => {
4 const ChatBox = ({chatLog, setChatInput, handleSubmit, chatInput}) => 5
5 <section className="chatbox"> 6 const [startedInteraction, setStartedInteraction] = useState(false);
6 <SuggestedOptions /> 7
7 <div className="chat-log"> 8 return (
8 {chatLog.map((message, index) => ( 9 <section className="chatbox">
9 <ChatMessage key={index} message={message} /> 10 {!startedInteraction ? (
10 ))} 11 <SuggestedOptions setChatInput={setChatInput}/>
11 </div> 12 ) : (
12 <div className="chat-input-holder"> 13 <>
13 <form className="form" onSubmit={handleSubmit}> 14 <div className="chat-log">
14 <input 15 {chatLog.map((message, index) => (
15 rows="1" 16 <ChatMessage key={index} message={message} />
16 value={chatInput} 17 ))}
17 onChange={(e)=> setChatInput(e.target.value)}
18 className="chat-input-textarea" ></input>
19 <button className="submit" type="submit">Submit</button>
20 </form>
21 </div> 18 </div>
22 </section>
23 19
24 // Individual Chat Message 20 </>
21 )}
22 <div className="chat-input-holder">
23 <form className="form" onSubmit={handleSubmit }>
24 <input
25 rows="1"
26 value={chatInput}
27 onChange={(e)=> {
28 setChatInput(e.target.value);
29 }}
30 className="chat-input-textarea" >
31 </input>
32 <button className="submit" type="submit" onClick={(e)=> {
33 setStartedInteraction(true);
34 }}>Submit</button>
35 </form>
36 </div>
37 </section>
38 )
39 }
40
25 const ChatMessage = ({ message }) => { 41 const ChatMessage = ({ message }) => {
26 return ( 42 return (
27 <div className={`chat-message ${message.user === "gpt" && "chatgpt"}`}> 43 <div className={`chat-message ${message.user === "gpt" && "chatgpt"}`}>
......
1 const SuggestedOptions = () => ( 1 const SuggestedOptions = ({ setChatInput }) => {
2 <div> 2 const examples = ["What is the capital of France?", "Generate a poem about love", "Tell me a joke"];
3 <h1>Welcome to ChatGPT Clone</h1> 3 const handleExampleClick = (example) => {
4 <p>This chatbot is capable of answering questions and generating text based on the input you provide.</p> 4 setChatInput(example);
5 <h2>Examples</h2> 5 };
6 <ul> 6
7 <li>What is the capital of France?</li> 7 return (
8 <li>Generate a poem about love</li> 8 <div className="suggested">
9 <li>What is the most populous country in the world?</li> 9 <div className="suggestedrow title">
10 </ul> 10 <h1>Welcome to AI-PRO</h1>
11 <h2>Capabilities</h2> 11 <p>This chatbot is capable of answering questions and generating text based on the input you provide.</p>
12 <ul> 12 </div>
13 <li>Answering questions</li> 13 <div className="suggestedcol rack1">
14 <li>Generating text</li> 14 <h2>Examples</h2>
15 <li>Providing information on a variety of topics</li> 15 <ul className="suggested-options">
16 </ul> 16 {examples.map((example, index) => (
17 <h2>Limitations</h2> 17 <li key={index}
18 <ul> 18 onClick={() => handleExampleClick(example)}>
19 <li>The chatbot may not have the latest information</li> 19 {example}
20 <li>The chatbot may not be able to answer all questions</li> 20 </li>
21 <li>The chatbot may not provide information in the desired format</li> 21 ))}
22 </ul> 22 </ul>
23 </div> 23 </div>
24 ); 24 <div className="suggestedcol rack2">
25 <h2>Capabilities</h2>
26 <ul>
27 <li>Answering questions</li>
28 <li>Generating text</li>
29 <li>Providing information on a variety of topics</li>
30 </ul>
31 </div>
32 <div className="suggestedcol rack3">
33 <h2>Limitations</h2>
34 <ul>
35 <li>The chatbot may not have the latest information</li>
36 <li>The chatbot may not be able to answer all questions</li>
37 <li>The chatbot may not provide information in the desired format</li>
38 </ul>
39 </div>
40 </div>
41 );
42
43 };
25 44
26 export default SuggestedOptions; 45 export default SuggestedOptions;
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -28,7 +28,8 @@ app.post('/api', async (req, res) => { ...@@ -28,7 +28,8 @@ app.post('/api', async (req, res) => {
28 const { message, currentModel, temperature } = req.body; 28 const { message, currentModel, temperature } = req.body;
29 const response = await openai.createCompletion({ 29 const response = await openai.createCompletion({
30 model: `${currentModel}`,// "text-davinci-003", 30 model: `${currentModel}`,// "text-davinci-003",
31 prompt: `${message}`, 31 prompt: `Converse as if you were an AI assistant. Be friendly and creative. Provide your answer in paragraph. If the answer have line of codes, enclose it with code tag.
32 ${message}`,
32 max_tokens: 2500, 33 max_tokens: 2500,
33 temperature, 34 temperature,
34 }); 35 });
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!