Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Administrator
/
chatgpt.ai-pro.org
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
3
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
ac377197
authored
2023-02-07 10:42:37 +0800
by
RSA
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
WIP
1 parent
33b89a1e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
4 deletions
client/src/App.js
client/src/ChatBox.js
client/src/SideMenu.js
client/src/App.js
View file @
ac37719
...
...
@@ -45,6 +45,7 @@ function App() {
let
chatLogNew
=
[...
chatLog
,
{
user
:
"me"
,
message
:
`
${
chatInput
}
`
}
]
setChatInput
(
""
);
setChatLog
(
chatLogNew
)
console
.
log
(
chatInput
)
// fetch response to the api combining the chat log array of messages and seinding it as a message to localhost:3000 as a post
const
messages
=
chatLogNew
.
map
((
message
)
=>
message
.
message
).
join
(
"\n"
)
...
...
@@ -60,7 +61,7 @@ function App() {
});
const
data
=
await
response
.
json
();
const
parsedData
=
data
.
message
.
trim
();
console
.
log
(
parsedData
)
//
console.log(parsedData)
const
programmingKeywords
=
[
'code'
,
'application'
,
'controller'
,
'rails'
,
'PHP'
,
'java'
,
'javascript'
,
'script'
,
'console'
,
'python'
,
'programming'
,
'table'
];
const
regex
=
new
RegExp
(
`\\b(
${
programmingKeywords
.
join
(
'|'
)}
)\\b`
,
'gi'
);
...
...
client/src/ChatBox.js
View file @
ac37719
import
OpenAISVGLogo
from
'./OpenAISVGLogo'
//
import OpenAISVGLogo from './OpenAISVGLogo'
// Primary Chat Window
const
ChatBox
=
({
chatLog
,
setChatInput
,
handleSubmit
,
chatInput
})
=>
...
...
@@ -26,7 +26,7 @@ const ChatMessage = ({ message }) => {
<
div
className
=
{
`chat-message
${
message
.
user
===
"gpt"
&&
"chatgpt"
}
`
}
>
<
div
className
=
"chat-message-center"
>
<
div
className
=
{
`avatar
${
message
.
user
===
"gpt"
&&
"chatgpt"
}
`
}
>
{
message
.
user
===
"gpt"
?
<
img
className
=
"ai-logo"
src
=
"../assets/images/bot.png"
width
=
"30px"
/>
:
<
img
className
=
"ai-logo
"
src
=
"../assets/images/user.svg"
/>
}
{
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"
/>
}
<
/div
>
{
/* <div className="message">
{message.message}
...
...
client/src/SideMenu.js
View file @
ac37719
const
SideMenu
=
({
clearChat
,
currentModel
,
setCurrentModel
,
models
,
setTemperature
,
temperature
})
=>
<
aside
className
=
"sidemenu"
>
<
div
className
=
"ai-logo-container"
>
<
img
className
=
"ai-logo"
src
=
"../assets/images/AIPRO-WHITE.png"
height
=
"50px"
/>
<
img
className
=
"ai-logo"
alt
=
"Ai-pro logo"
src
=
"../assets/images/AIPRO-WHITE.png"
height
=
"50px"
/>
<
/div
>
<
div
className
=
"side-menu-button"
onClick
=
{
clearChat
}
>
<
span
>+<
/span
>
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment