chore: fix memory prompt

This commit is contained in:
Yifei Zhang
2023-03-19 16:29:09 +00:00
parent 4d97c269ff
commit 12f52bf252
2 changed files with 25 additions and 11 deletions

View File

@@ -1,5 +1,5 @@
export function trimTopic(topic: string) {
const s = topic.split("").slice(0, 20);
const s = topic.split("");
let lastChar = s.at(-1); // 获取 s 的最后一个字符
let pattern = /[,。!?、]/; // 定义匹配中文标点符号的正则表达式
while (lastChar && pattern.test(lastChar!)) {