Skip to content

Commit 93ed09b

Browse files
committed
fix: AI 추천 할 일 파싱 시 슬래시 보존
1 parent 29f5e8f commit 93ed09b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/page/todo/lowerTodo/hook/useLowerTodoAI.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,13 @@ export const useLowerTodoAI = ({
7878
goals.forEach((goal, goalIndex) => {
7979
if (goalIndex < emptyIndices.length) {
8080
const targetIndex = emptyIndices[goalIndex];
81-
const [cycleText, originalTitle] = goal.title.split('/');
81+
const match = goal.title.match(/^(|| )\/(.+)$/);
82+
const titleText = match ? match[2] : goal.title;
83+
const cycleText = match ? match[1] : '매일';
8284

8385
const newTodo = {
84-
title: originalTitle || goal.title,
85-
cycle: convertCycleToEnglish(cycleText || '매일'),
86+
title: titleText,
87+
cycle: convertCycleToEnglish(cycleText),
8688
};
8789

8890
updatedTodos[targetIndex] = newTodo;

0 commit comments

Comments
 (0)