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
044faa07
authored
2023-02-09 08:01:00 +0000
by
Ryan
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch '26797_chatgpt_format3' into 'master'
26797 chatgpt format3 See merge request
!9
2 parents
0a4a261d
520d1069
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
9 deletions
README.md
client/src/App.css
client/src/App.js
README.md
View file @
044faa0
...
...
@@ -10,8 +10,8 @@ Create an .env file in the root directory of your application.
Duplicate the env-template and rename to .env
In the .env file, define the environment variables you want to use in your application. ex.
`API_KEY="sk-xxxxxxxx"`
`API_ORG="org-xxxxxxx"`
`
OPENAI_
API_KEY="sk-xxxxxxxx"`
`
OPENAI_
API_ORG="org-xxxxxxx"`
## Run server
...
...
client/src/App.css
View file @
044faa0
...
...
@@ -114,7 +114,7 @@
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
padding
:
5px
;
padding
:
1
5px
;
font-size
:
14px
;
color
:
#444654
;
}
...
...
client/src/App.js
View file @
044faa0
...
...
@@ -47,8 +47,8 @@ function App() {
const
userInputRegex
=
new
RegExp
(
`\\b(
${
userInput
.
join
(
'|'
)}
)\\b`
,
'gi'
);
const
inputMatches
=
chatInput
.
match
(
userInputRegex
);
const
userPunctuation
=
[
'.'
,
'?'
,
'!'
,
':'
,
';'
,
','
];
const
userPunctuationRegex
=
new
RegExp
(
`
${
userPunctuation
.
join
(
''
)}
$`
,
'gi'
);
const
userPunctuation
=
[
'
\
.'
,
'?'
,
'!'
,
':'
,
';'
,
','
];
const
userPunctuationRegex
=
new
RegExp
(
`
[
${
userPunctuation
.
join
(
''
)}
]$`
);
const
punctuationMatches
=
chatInput
.
match
(
userPunctuationRegex
);
// console.log(punctuationMatches)
...
...
@@ -83,7 +83,6 @@ function App() {
});
const
data
=
await
response
.
json
();
const
parsedData
=
data
.
message
.
trim
();
// 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'
);
...
...
@@ -96,11 +95,8 @@ function App() {
}
else
{
replaceTags
=
(
parsedData
.
replace
(
':'
,
':<code>'
).
replace
(
'<?'
,
'<?'
).
replace
(
'?>'
,
'?>'
).
replace
(
/
\n
/g
,
'<br>'
))
// console.log("programming!")
//.replace('<?','<' + '?').replace('?>','?'+'>')
}
setChatLog
([...
chatLogNew
,
{
user
:
"gpt"
,
message
:
`
${
replaceTags
}
`
}
])
// setChatLog([...chatLogNew, { user: "gpt", message: `<div>${parsedData}</div>`} ])
var
scrollToTheBottomChatLog
=
document
.
getElementsByClassName
(
"chat-log"
)[
0
];
scrollToTheBottomChatLog
.
scrollTop
=
scrollToTheBottomChatLog
.
scrollHeight
;
}
...
...
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