Skip to content
This repository was archived by the owner on Apr 18, 2024. It is now read-only.

Commit e08c47c

Browse files
committed
Merge remote-tracking branch 'origin/dev' into dev
2 parents 8a86b8f + 003aeee commit e08c47c

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/app/[lang]/chatgpt-startling-by-each-step/[id]/StartlingStepDetail.tsx

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,19 @@ function StartlingStepDetail({
6464
const assistantResponse = assistantMessage[0].content;
6565
setResponse(assistantResponse);
6666

67-
if (onCache && step.cachedResponseRegex) {
68-
if (step.cachedResponseRegex === ".*" || step.cachedResponseRegex === "(.*?)") {
69-
onCache(index, assistantResponse);
70-
} else {
71-
const regex = new RegExp(step.cachedResponseRegex);
72-
const matched = assistantResponse.match(regex);
73-
if (matched) {
74-
onCache(index, matched[1]);
75-
}
67+
if (!onCache || !step.cachedResponseRegex) {
68+
return;
69+
}
70+
71+
// todo: check why regex not working well?
72+
const isMatchAll = step.cachedResponseRegex === ".*" || step.cachedResponseRegex === "(.*?)";
73+
if (isMatchAll) {
74+
onCache(index, assistantResponse);
75+
} else {
76+
const regex = new RegExp(step.cachedResponseRegex);
77+
const matched = assistantResponse.match(regex);
78+
if (matched) {
79+
onCache(index, matched[1]);
7680
}
7781
}
7882
};

0 commit comments

Comments
 (0)