WIP
Showing
3 changed files
with
5 additions
and
4 deletions
| ... | @@ -45,6 +45,7 @@ function App() { | ... | @@ -45,6 +45,7 @@ function App() { |
| 45 | let chatLogNew = [...chatLog, { user: "me", message: `${chatInput}`} ] | 45 | let chatLogNew = [...chatLog, { user: "me", message: `${chatInput}`} ] |
| 46 | setChatInput(""); | 46 | setChatInput(""); |
| 47 | setChatLog(chatLogNew) | 47 | setChatLog(chatLogNew) |
| 48 | console.log(chatInput) | ||
| 48 | // fetch response to the api combining the chat log array of messages and seinding it as a message to localhost:3000 as a post | 49 | // fetch response to the api combining the chat log array of messages and seinding it as a message to localhost:3000 as a post |
| 49 | const messages = chatLogNew.map((message) => message.message).join("\n") | 50 | const messages = chatLogNew.map((message) => message.message).join("\n") |
| 50 | 51 | ||
| ... | @@ -60,7 +61,7 @@ function App() { | ... | @@ -60,7 +61,7 @@ function App() { |
| 60 | }); | 61 | }); |
| 61 | const data = await response.json(); | 62 | const data = await response.json(); |
| 62 | const parsedData = data.message.trim(); | 63 | const parsedData = data.message.trim(); |
| 63 | console.log(parsedData) | 64 | // console.log(parsedData) |
| 64 | const programmingKeywords = ['code', 'application', 'controller', 'rails' , 'PHP', 'java', 'javascript', 'script', 'console', 'python', 'programming', 'table']; | 65 | const programmingKeywords = ['code', 'application', 'controller', 'rails' , 'PHP', 'java', 'javascript', 'script', 'console', 'python', 'programming', 'table']; |
| 65 | 66 | ||
| 66 | const regex = new RegExp(`\\b(${programmingKeywords.join('|')})\\b`, 'gi'); | 67 | const regex = new RegExp(`\\b(${programmingKeywords.join('|')})\\b`, 'gi'); | ... | ... |
| 1 | import OpenAISVGLogo from './OpenAISVGLogo' | 1 | // import OpenAISVGLogo from './OpenAISVGLogo' |
| 2 | 2 | ||
| 3 | // Primary Chat Window | 3 | // Primary Chat Window |
| 4 | const ChatBox = ({chatLog, setChatInput, handleSubmit, chatInput}) => | 4 | const ChatBox = ({chatLog, setChatInput, handleSubmit, chatInput}) => |
| ... | @@ -26,7 +26,7 @@ const ChatMessage = ({ message }) => { | ... | @@ -26,7 +26,7 @@ const ChatMessage = ({ message }) => { |
| 26 | <div className={`chat-message ${message.user === "gpt" && "chatgpt"}`}> | 26 | <div className={`chat-message ${message.user === "gpt" && "chatgpt"}`}> |
| 27 | <div className="chat-message-center"> | 27 | <div className="chat-message-center"> |
| 28 | <div className={`avatar ${message.user === "gpt" && "chatgpt"}`}> | 28 | <div className={`avatar ${message.user === "gpt" && "chatgpt"}`}> |
| 29 | {message.user === "gpt" ? <img className="ai-logo" src="../assets/images/bot.png" width="30px"/> : <img className="ai-logo" src="../assets/images/user.svg" />} | 29 | {message.user === "gpt" ? <img className="ai-logo" alt="Ai-pro bot" src="../assets/images/bot.png" width="30px"/> : <img className="ai-logo" alt="Ai-pro user" src="../assets/images/user.svg" />} |
| 30 | </div> | 30 | </div> |
| 31 | {/* <div className="message"> | 31 | {/* <div className="message"> |
| 32 | {message.message} | 32 | {message.message} | ... | ... |
| 1 | const SideMenu = ({ clearChat, currentModel, setCurrentModel, models, setTemperature, temperature }) => | 1 | const SideMenu = ({ clearChat, currentModel, setCurrentModel, models, setTemperature, temperature }) => |
| 2 | <aside className="sidemenu"> | 2 | <aside className="sidemenu"> |
| 3 | <div className="ai-logo-container"> | 3 | <div className="ai-logo-container"> |
| 4 | <img className="ai-logo" src="../assets/images/AIPRO-WHITE.png" height="50px"/> | 4 | <img className="ai-logo" alt="Ai-pro logo" src="../assets/images/AIPRO-WHITE.png" height="50px"/> |
| 5 | </div> | 5 | </div> |
| 6 | <div className="side-menu-button" onClick={clearChat}> | 6 | <div className="side-menu-button" onClick={clearChat}> |
| 7 | <span>+</span> | 7 | <span>+</span> | ... | ... |
-
Please register or sign in to post a comment