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
aa2b58d4
authored
2024-11-07 13:42:54 +0800
by
Leff Tubat
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Added string replace and modified trained prompt
1 parent
c198a8a3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
3 deletions
client/src/App.js
client/src/App.js
View file @
aa2b58d
...
...
@@ -109,7 +109,7 @@ function App() {
userModifiedInput
=
chatInput
+
"?"
;
}
}
let
trained_prompt
=
chatInput
+
'.
Respond without using markdown, HTML tags, asterisks, hashtags, or any special symbol
s for formatting.'
;
let
trained_prompt
=
chatInput
+
'.
Avoiding any tags, markdown syntax, hashtags, or asterisk
s for formatting.'
;
let
chatLogNew
=
[...
chatLog
,
{
user
:
"user"
,
message
:
`
${
userModifiedInput
}
`
}
]
setChatInput
(
""
);
setChatLog
(
chatLogNew
)
...
...
@@ -191,9 +191,24 @@ function App() {
const
regex
=
new
RegExp
(
`\\b(
${
programmingKeywords
.
join
(
'|'
)}
)\\b`
,
'gi'
);
const
matches
=
parsedData
.
match
(
regex
);
if
(
!
matches
)
{
var
replaceTags
=
(
parsedData
.
replace
(
/
(?:\r\n
|
\r
|
\n)
/g
,
'<br>'
))
var
replaceTags
=
(
parsedData
.
replace
(
/
(?:\r\n
|
\r
|
\n)
/g
,
'<br>'
)
.
replace
(
/
\*\*(
.*
?)\*\*
/g
,
'$1'
)
.
replace
(
/#
\s(
.+
)
/g
,
"$1"
)
.
replace
(
/#
[
A-Za-z0-9_
]
+:
?
/g
,
""
)
)
}
else
{
replaceTags
=
(
parsedData
.
replace
(
':'
,
':<code>'
).
replace
(
'<?'
,
'<?'
).
replace
(
'?>'
,
'?>'
).
replace
(
/
\n
/g
,
'<br>'
))
replaceTags
=
(
parsedData
.
replace
(
':'
,
':<code>'
)
.
replace
(
'<?'
,
'<?'
)
.
replace
(
'?>'
,
'?>'
)
.
replace
(
/
\n
/g
,
'<br>'
)
.
replace
(
/
\*\*(
.*
?)\*\*
/g
,
'$1'
)
.
replace
(
/#
\s(
.+
)
/g
,
"$1"
)
.
replace
(
/#
[
A-Za-z0-9_
]
+:
?
/g
,
""
)
)
}
for
(
let
i
=
0
;
i
<
replaceTags
.
length
;
i
++
)
{
...
...
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