Skip to content

Commit

Permalink
Merge pull request ChatGPTNextWeb#4089 from H0llyW00dzZ/cherry-pick
Browse files Browse the repository at this point in the history
[Cherry Pick] Fix [Utils] Regex trimTopic
  • Loading branch information
fred-bf authored Feb 29, 2024
2 parents 8b821ac + 22baeba commit 1294817
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ export function trimTopic(topic: string) {
// This will remove the specified punctuation from the end of the string
// and also trim quotes from both the start and end if they exist.
return topic
.replace(/^["“”]+|["“”]+$/g, "")
.replace(/[,。!?”“"、,.!?]*$/, "");
// fix for gemini
.replace(/^["“”*]+|["“”*]+$/g, "")
.replace(/[,。!?”“"、,.!?*]*$/, "");
}

export async function copyToClipboard(text: string) {
Expand Down

0 comments on commit 1294817

Please sign in to comment.