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
1e0ad578
authored
2023-02-09 11:07:39 +0800
by
RSA
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'master' of
https://gitlab.baytech.ph/baytech/chatgpt.ai-pro.org
in…
…to 26797_chatgpt_format3
2 parents
07c4b1de
0a4a261d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
4 deletions
client/src/App.js
client/src/ChatBox.js
client/src/SideMenu.js
client/src/color_theme_1.css
client/src/App.js
View file @
1e0ad57
...
...
@@ -42,9 +42,32 @@ function App() {
async
function
handleSubmit
(
e
){
e
.
preventDefault
();
let
chatLogNew
=
[...
chatLog
,
{
user
:
"me"
,
message
:
`
${
chatInput
}
`
}
]
// console.log(chatInput)
const
userInput
=
[
'what'
,
'why'
,
'when'
,
'where'
,
'which'
,
'did'
,
'do'
,
'how'
,
'can'
,
'are'
,
'who'
,
'hey'
];
const
userInputRegex
=
new
RegExp
(
`\\b(
${
userInput
.
join
(
'|'
)}
)\\b`
,
'gi'
);
const
inputMatches
=
chatInput
.
match
(
userInputRegex
);
const
userPunctuation
=
[
'.'
,
'?'
,
'!'
,
':'
,
';'
,
','
];
const
userPunctuationRegex
=
new
RegExp
(
`
${
userPunctuation
.
join
(
''
)}
$`
,
'gi'
);
const
punctuationMatches
=
chatInput
.
match
(
userPunctuationRegex
);
// console.log(punctuationMatches)
var
userModifiedInput
=
chatInput
if
(
!
punctuationMatches
)
{
if
(
!
inputMatches
)
{
userModifiedInput
=
chatInput
+
"."
;
// console.log("not a question!")
}
else
{
userModifiedInput
=
chatInput
+
"?"
;
// console.log("its a question!")
}
}
let
chatLogNew
=
[...
chatLog
,
{
user
:
"me"
,
message
:
`
${
userModifiedInput
}
`
}
]
setChatInput
(
""
);
setChatLog
(
chatLogNew
)
// 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"
)
...
...
client/src/ChatBox.js
View file @
1e0ad57
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 @
1e0ad57
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
>
...
...
client/src/color_theme_1.css
View file @
1e0ad57
...
...
@@ -35,6 +35,7 @@ span.info {
color
:
#101827
!important
;
font-size
:
16px
!important
;
box-shadow
:
0px
7px
6px
-6px
black
!important
;
height
:
45px
;
}
.chat-message.chatgpt
{
...
...
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