Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: bug #1240 #1241

Merged
merged 1 commit into from
May 4, 2023
Merged

fix: bug #1240 #1241

merged 1 commit into from
May 4, 2023

Conversation

yanCode
Copy link
Contributor

@yanCode yanCode commented May 4, 2023

the original logic
Let's take a shortened example of prompt from the remote cvs file.
which can be below:
"javascript console","it prints console.log(""hello world"")"

v.split('","').map((v) => v.replace('"', "")))

after split method, it becomes an array:
[ '"javascript console', 'it prints console.log(""hello world"")"']
if calling v.replace('"', ""), which only replace the first ", the prompt becomes:
[ '"javascript console', 'it prints console.log("hello world"")"' ]

this is what I described in the bug report:
#1240

v.replace(/^"|"$/g, '').replaceAll('""','"')))

my fix is, first replace the single " with '', in the head or the tail of the split elements, then replace all "" with ". the result becomes:
[ 'javascript console', 'it prints console.log("hello world")']

@Yidadaa Yidadaa merged commit 6c1261d into ChatGPTNextWeb:main May 4, 2023
1 check failed
Endlessworld pushed a commit to Endlessworld/ChatGPT-Next-Web that referenced this pull request May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants