diff --git a/src/components/HistorySidebar/index.tsx b/src/components/HistorySidebar/index.tsx index f3f1b69a5..059f1456b 100644 --- a/src/components/HistorySidebar/index.tsx +++ b/src/components/HistorySidebar/index.tsx @@ -310,7 +310,8 @@ export default function HistorySidebar() { />
- {task?.messages[0]?.content || t("task-hub.new-project")} + {task?.messages?.[0]?.content || + t("task-hub.new-project")}
- {task?.messages[0]?.content || + {task?.messages?.[0]?.content || t("task-hub.new-project")}

- {task?.messages[0]?.content || + {task?.messages?.[0]?.content || t("task-hub.new-project")}

@@ -460,7 +461,7 @@ export default function HistorySidebar() {
{historyTasks .filter((task) => - task.question + task?.question ?.toLowerCase() .includes(searchValue.toLowerCase()) ) @@ -468,11 +469,14 @@ export default function HistorySidebar() { return (
- handleSetActive(task.task_id, task.question) + handleSetActive( + task?.task_id, + task?.question + ) } key={task.task_id} className={`${ - chatStore.activeTaskId === task.task_id + chatStore.activeTaskId === task?.task_id ? "!bg-white-100%" : "" } max-w-full relative cursor-pointer transition-all duration-300 bg-white-30% hover:bg-white-100% rounded-3xl w-[316px] h-[180px] p-6 shadow-history-item`} @@ -486,16 +490,16 @@ export default function HistorySidebar() { alt="folder-icon" /> - # Token {task.tokens || 0} + # Token {task?.tokens || 0}
- {task?.question.split("|")[0] || + {task?.question?.split("|")?.[0] || t("task-hub.new-project")}
- {task?.question.split("|")[1] || + {task?.question?.split("|")?.[1] || t("task-hub.new-project")}
@@ -505,98 +509,110 @@ export default function HistorySidebar() { ) : ( // List
- {historyTasks.map((task) => { - return ( -
{ - handleSetActive(task.task_id, task.question); - }} - key={task.task_id} - className={`${ - chatStore.activeTaskId === task.task_id - ? "!bg-white-100%" - : "" - } max-w-full relative cursor-pointer transition-all duration-300 bg-white-30% hover:bg-white-100% rounded-2xl flex justify-between items-center gap-md w-full p-3 h-14 shadow-history-item border border-solid border-border-disabled`} - > - folder-icon - -
- - - - {" "} - {task?.question.split("|")[0] || t("task-hub.new-project")} - - - -
- {" "} - {task?.question.split("|")[0] || t("task-hub.new-project")} -
-
-
-
- { + return ( +
{ + handleSetActive( + task?.task_id, + task?.question + ); + }} + key={task.task_id} + className={`${ + chatStore.activeTaskId === task?.task_id + ? "!bg-white-100%" + : "" + } max-w-full relative cursor-pointer transition-all duration-300 bg-white-30% hover:bg-white-100% rounded-2xl flex justify-between items-center gap-md w-full p-3 h-14 shadow-history-item border border-solid border-border-disabled`} > - # Token {task.tokens || 0} - - - - - - - -
- - - - - - - -
-
-
-
- ); - })} -
+ folder-icon + +
+ + + + {" "} + {task?.question?.split("|")?.[0] || + t("task-hub.new-project")} + + + +
+ {" "} + {task?.question?.split("|")?.[0] || + t("task-hub.new-project")} +
+
+
+
+ + # Token {task?.tokens || 0} + + + + + + + +
+ + + + + + + +
+
+
+
+ ); + })} +
)} )} diff --git a/src/pages/History.tsx b/src/pages/History.tsx index a63ca4435..5b6d47bab 100644 --- a/src/pages/History.tsx +++ b/src/pages/History.tsx @@ -565,10 +565,10 @@ export default function Home() { {historyTasks.map((task) => { return (
handleSetActive(task.task_id, task.question)} + onClick={() => handleSetActive(task?.task_id, task?.question)} key={task.task_id} className={`${ - chatStore.activeTaskId === task.task_id + chatStore.activeTaskId === task?.task_id ? "!bg-white-100%" : "" } relative cursor-pointer transition-all duration-300 bg-white-30% hover:bg-white-100% rounded-3xl flex justify-between items-center flex-wrap gap-md flex-initial w-[calc(33%-48px)] min-w-[300px] max-w-[500px] h-[180px] p-6 shadow-history-item border border-solid border-border-disabled`} @@ -587,7 +587,7 @@ export default function Home() { variant="primary" className="text-xs leading-17 font-medium text-nowrap" > - # Token {task.tokens || 0} + # Token {task?.tokens || 0}
@@ -607,11 +607,11 @@ export default function Home() { return (
{ - handleSetActive(task.task_id, task.question); + handleSetActive(task?.task_id, task?.question); }} key={task.task_id} className={`${ - chatStore.activeTaskId === task.task_id + chatStore.activeTaskId === task?.task_id ? "!bg-white-100%" : "" } max-w-full relative cursor-pointer transition-all duration-300 bg-white-30% hover:bg-white-100% rounded-2xl flex justify-between items-center gap-md w-full p-3 h-14 shadow-history-item border border-solid border-border-disabled`} @@ -625,7 +625,7 @@ export default function Home() { {" "} - {task?.question.split("|")[0] || + {task?.question?.split("|")?.[0] || t("task-hub.new-project")} @@ -635,7 +635,7 @@ export default function Home() { >
{" "} - {task?.question.split("|")[0] || + {task?.question?.split("|")?.[0] || t("task-hub.new-project")}
@@ -645,7 +645,7 @@ export default function Home() { variant="primary" className="text-xs leading-17 font-medium text-nowrap" > - # Token {task.tokens || 0} + # Token {task?.tokens || 0} @@ -667,7 +667,7 @@ export default function Home() { className="w-full" onClick={(e) => { e.stopPropagation(); - handleShare(task.task_id); + handleShare(task?.task_id); }} > @@ -682,7 +682,7 @@ export default function Home() { className="w-full" onClick={(e) => { e.stopPropagation(); - handleDelete(task.id); + handleDelete(task?.id); }} >