Skip to content

Commit

Permalink
Fix [Utils] Regex trimTopic (ChatGPTNextWeb#280)
Browse files Browse the repository at this point in the history
- [+] fix(utils.ts): update regular expressions in trimTopic function to handle asterisks
  • Loading branch information
H0llyW00dzZ authored Feb 20, 2024
1 parent 49fa2d0 commit bc0a9b9
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 @@ -11,8 +11,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(/[,。!?”“"、,.!?*]*$/, "");
}

const isApp = !!getClientConfig()?.isApp;
Expand Down

0 comments on commit bc0a9b9

Please sign in to comment.