NextChat icon indicating copy to clipboard operation
NextChat copied to clipboard

Fixed an issue caused by escaping dollar signs.

Open daiaji opened this issue 1 year ago • 36 comments

Fix the faults mentioned below.

https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web/issues/3860

daiaji avatar Feb 25 '24 19:02 daiaji

@daiaji is attempting to deploy a commit to the NextChat Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Feb 25 '24 19:02 vercel[bot]

起码shell脚本的$1、$2变量不会被瞎转义了。

daiaji avatar Feb 25 '24 19:02 daiaji

Bot detected the issue body's language is not English, translate it automatically.


At least the $1 and $2 variables of the shell script will not be blindly escaped.

Issues-translate-bot avatar Feb 25 '24 19:02 Issues-translate-bot

Your build has completed!

Preview deployment

github-actions[bot] avatar Feb 25 '24 19:02 github-actions[bot]

does it will be fine for latex ?

H0llyW00dzZ avatar Feb 25 '24 19:02 H0llyW00dzZ

does it will be fine for latex ?

This formula is valid, basically just adding a judgment that the dollars in the code block will not be escaped.

But this is basically the solution given by GPT3.5, and I would like someone to review the code for me.

daiaji avatar Feb 26 '24 00:02 daiaji

does it will be fine for latex ?

This formula is valid, basically just adding a judgment that the dollars in the code block will not be escaped.

But this is basically the solution given by GPT3.5, and I would like someone to review the code for me.

Do test using these masks:

Exploring Polynomial Equations: From Quadratics to Cubics [LaTex Language].json

You can simply change the model according to the example format provided below:

Example format: Find the roots of the equation: $$2x^2 - 5x + 2 = 0$$

This is an example of how it was passed:

image

H0llyW00dzZ avatar Feb 26 '24 02:02 H0llyW00dzZ

@daiaji your deployment https://4124-vercelpreviewdeployment.pr.nextchat.dev/ it just break $$ which indicate that latex

image

H0llyW00dzZ avatar Feb 26 '24 02:02 H0llyW00dzZ

Bot detected the issue body's language is not English, translate it automatically.


@daiaji your deployment https://4124-vercelpreviewdeployment.pr.nextchat.dev/ it just break $$ which is indicate that latex

image

Issues-translate-bot avatar Feb 26 '24 02:02 Issues-translate-bot

@daiaji your deployment https://4124-vercelpreviewdeployment.pr.nextchat.dev/ it just break $$ which indicate that latex

image

Basically I just added a judgment that the dollar sign escape function does not escape the dollar sign in the code block, no other fixes, but I can have GPT3.5 try to see if I can fix this bug.

daiaji avatar Feb 26 '24 03:02 daiaji

@daiaji your deployment https://4124-vercelpreviewdeployment.pr.nextchat.dev/ it just break $$ which indicate that latex image

Basically I just added a judgment that the dollar sign escape function does not escape the dollar sign in the code block, no other fixes, but I can have GPT3.5 try to see if I can fix this bug.

you may try to fix, because this one it fix for latex

https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web/blob/e756506c185dcd786ad04db0c7f2c423a6496072/app/components/markdown.tsx#L102

H0llyW00dzZ avatar Feb 26 '24 04:02 H0llyW00dzZ

To be honest, just describing the fault performance to GPT is very troublesome, and GPT3.5's poor logical ability is exposed at this time, and GPT3.5 cannot even understand my statement. I am trying GPT4.

daiaji avatar Feb 26 '24 12:02 daiaji

Good news, GPT has provided usable code. In my opinion, the code logic is too complex, but at least the code can work. Now I hope GPT can optimize the code, and I think I can upload the code soon.😊

daiaji avatar Feb 26 '24 13:02 daiaji

Good news, GPT has provided usable code. In my opinion, the code logic is too complex, but at least the code can work. Now I hope GPT can optimize the code, and I think I can upload the code soon.😊

does it will be fine for latex ?

H0llyW00dzZ avatar Feb 26 '24 15:02 H0llyW00dzZ

does it will be fine for latex ?

The example you provided seems to have been rendered correctly. I found another formula and it also appears to have been rendered correctly. The $ in the code block does not seem to have been escaped.

To be honest, it feels like dealing with this kind of problem is logically cumbersome and may still require code review.🧐

daiaji avatar Feb 26 '24 15:02 daiaji

does it will be fine for latex ?

The example you provided seems to have been rendered correctly, and I found another formula that also appears to have been rendered correctly. The $in the code block also seems to have been correctly escaped.

To be honest, it feels like dealing with this kind of problem is logically cumbersome and may still require code review.🧐

@daiaji now this one causing bug

image

anyway it's difficult to maintain/fix cause of complexity, even I was trying it before

H0llyW00dzZ avatar Feb 26 '24 15:02 H0llyW00dzZ

anyway it's difficult to maintain/fix cause of complexity, even I was trying it before

No surprise, I always feel like it will become very troublesome in the end.

daiaji avatar Feb 26 '24 15:02 daiaji

anyway it's difficult to maintain/fix cause of complexity, even I was trying it before

No surprise, I always feel like it will become very troublesome in the end.

Yes, because of its complexity, it's quite difficult to maintain or fix. In contrast, breaking down each function into smaller parts to make it modular makes maintenance much easier.

H0llyW00dzZ avatar Feb 26 '24 15:02 H0llyW00dzZ

Yes, because of its complexity, it's quite difficult to maintain or fix. In contrast, breaking down each function into smaller parts to make it modular makes maintenance much easier.

I think irresponsibly, if the complexity of the code increases infinitely and the code has been modularized as much as possible, let GPT maintain the code!🤣

daiaji avatar Feb 26 '24 15:02 daiaji

Yes, because of its complexity, it's quite difficult to maintain or fix. In contrast, breaking down each function into smaller parts to make it modular makes maintenance much easier.

I think irresponsibly, if the complexity of the code increases infinitely and the code has been modularized as much as possible, let GPT maintain the code!🤣

429543792_809180301237785_3392338544743453221_n

H0llyW00dzZ avatar Feb 26 '24 20:02 H0llyW00dzZ

It was as if beholding a vista not even the most horrifying of nightmares could conjure, an indescribable maelstrom of thoughts entwined around my very soul. Perhaps, this was the answer bestowed by those blasphemous entities, older than time itself.

https://sharegpt.com/c/WJbLuB8 新的聊天

daiaji avatar Feb 26 '24 20:02 daiaji

It was as if beholding a vista not even the most horrifying of nightmares could conjure, an indescribable maelstrom of thoughts entwined around my very soul. Perhaps, this was the answer bestowed by those blasphemous entities, older than time itself.

https://sharegpt.com/c/WJbLuB8 新的聊天

@daiaji

image

image

H0llyW00dzZ avatar Feb 26 '24 20:02 H0llyW00dzZ

bug its on single backticks now

H0llyW00dzZ avatar Feb 26 '24 20:02 H0llyW00dzZ

@daiaji it's difficult to fix

image

this pattern causing bug:

$1 $1 $1 $1

$1 $2 $3 $4

$1 $2 $3 $4

$1 $2 $3 $4


$1 $2 $3 $4

image

H0llyW00dzZ avatar Feb 26 '24 20:02 H0llyW00dzZ

another bug:

image

H0llyW00dzZ avatar Feb 26 '24 21:02 H0llyW00dzZ

Anyway There appears to be an issue, possibly between React Markdown and the UI. Although the code is correct, the UI or React Markdown seems to be causing some unexpected behavior.

H0llyW00dzZ avatar Feb 26 '24 21:02 H0llyW00dzZ

新的聊天(1)

daiaji avatar Feb 26 '24 22:02 daiaji

Bot detected the issue body's language is not English, translate it automatically.


New Chat(1)

Issues-translate-bot avatar Feb 26 '24 22:02 Issues-translate-bot

Although this function is already quite complex, it may still require expanding the scope of the check.

daiaji avatar Feb 26 '24 22:02 daiaji

Although this function is already quite complex, it may still require expanding the scope of the check.

Yeah its difficult to fix/maintain about this front end, unlike backend written in go

H0llyW00dzZ avatar Feb 26 '24 23:02 H0llyW00dzZ