Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

:lipstick: style: improve gtd tool inspector and todo list

arvinxx0664563da7ba
diff --git a/locales/en-US/chat.json b/locales/en-US/chat.json
index 5a4e8998112..ac7f6bc5ebf 100644
--- a/locales/en-US/chat.json
+++ b/locales/en-US/chat.json
@@ -297,6 +297,8 @@
"thread.divider": "Subtopic",
"thread.threadMessageCount": "{{messageCount}} messages",
"thread.title": "Subtopic",
+ "todoProgress.allCompleted": "All tasks completed",
+ "todoProgress.title": "Tasks",
"toggleWideScreen.off": "Turn off widescreen mode",
"toggleWideScreen.on": "Turn on widescreen mode",
"tokenDetails.chats": "Chat Messages",
diff --git a/locales/en-US/plugin.json b/locales/en-US/plugin.json
index c8631a72795..0956844052a 100644
--- a/locales/en-US/plugin.json
+++ b/locales/en-US/plugin.json
@@ -38,11 +38,17 @@
"builtins.lobe-group-management.apiName.vote": "Start vote",
"builtins.lobe-group-management.title": "Group Coordinator",
"builtins.lobe-gtd.apiName.clearTodos": "Clear todos",
+ "builtins.lobe-gtd.apiName.clearTodos.modeAll": "all",
+ "builtins.lobe-gtd.apiName.clearTodos.modeCompleted": "completed",
+ "builtins.lobe-gtd.apiName.clearTodos.result": "Clear <mode>{{mode}}</mode> todos",
"builtins.lobe-gtd.apiName.completeTodos": "Complete todos",
"builtins.lobe-gtd.apiName.createPlan": "Create plan",
+ "builtins.lobe-gtd.apiName.createPlan.result": "Create plan: <goal>{{goal}}</goal>",
"builtins.lobe-gtd.apiName.createTodos": "Create todos",
"builtins.lobe-gtd.apiName.removeTodos": "Delete todos",
"builtins.lobe-gtd.apiName.updatePlan": "Update plan",
+ "builtins.lobe-gtd.apiName.updatePlan.completed": "Completed",
+ "builtins.lobe-gtd.apiName.updatePlan.modified": "Modified",
"builtins.lobe-gtd.apiName.updateTodos": "Update todos",
"builtins.lobe-gtd.title": "Task Tools",
"builtins.lobe-knowledge-base.apiName.readKnowledge": "Read Library content",
diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.json
index 7661107c74c..ca201a518e0 100644
--- a/locales/zh-CN/chat.json
+++ b/locales/zh-CN/chat.json
@@ -297,6 +297,8 @@
"thread.divider": "子话题",
"thread.threadMessageCount": "{{messageCount}} 条消息",
"thread.title": "子话题",
+ "todoProgress.allCompleted": "已完成所有任务",
+ "todoProgress.title": "任务",
"toggleWideScreen.off": "关闭宽屏模式",
"toggleWideScreen.on": "开启宽屏模式",
"tokenDetails.chats": "会话消息",
@@ -363,4 +365,4 @@
"viewMode.wideScreen": "宽屏",
"you": "你",
"zenMode": "专注模式"
-}
\ No newline at end of file
+}
diff --git a/locales/zh-CN/plugin.json b/locales/zh-CN/plugin.json
index 1c93941cb32..3c68891270e 100644
--- a/locales/zh-CN/plugin.json
+++ b/locales/zh-CN/plugin.json
@@ -53,11 +53,17 @@
"builtins.lobe-group-management.apiName.vote": "发起投票",
"builtins.lobe-group-management.title": "群组协调",
"builtins.lobe-gtd.apiName.clearTodos": "清除待办",
+ "builtins.lobe-gtd.apiName.clearTodos.modeAll": "全部",
+ "builtins.lobe-gtd.apiName.clearTodos.modeCompleted": "已完成",
+ "builtins.lobe-gtd.apiName.clearTodos.result": "清除<mode>{{mode}}</mode>待办",
"builtins.lobe-gtd.apiName.completeTodos": "完成待办",
"builtins.lobe-gtd.apiName.createPlan": "创建计划",
+ "builtins.lobe-gtd.apiName.createPlan.result": "创建计划:<goal>{{goal}}</goal>",
"builtins.lobe-gtd.apiName.createTodos": "创建待办",
"builtins.lobe-gtd.apiName.removeTodos": "删除待办",
"builtins.lobe-gtd.apiName.updatePlan": "更新计划",
+ "builtins.lobe-gtd.apiName.updatePlan.completed": "已完成",
+ "builtins.lobe-gtd.apiName.updatePlan.modified": "已修改",
"builtins.lobe-gtd.apiName.updateTodos": "更新待办",
"builtins.lobe-gtd.title": "任务工具",
"builtins.lobe-knowledge-base.apiName.readKnowledge": "读取资源库内容",
diff --git a/packages/builtin-tool-gtd/src/client/Inspector/ClearTodos/index.tsx b/packages/builtin-tool-gtd/src/client/Inspector/ClearTodos/index.tsx
new file mode 100644
index 00000000000..2105ffd0dca
--- /dev/null
+++ b/packages/builtin-tool-gtd/src/client/Inspector/ClearTodos/index.tsx
@@ -0,0 +1,62 @@
+'use client';
+
+import type { BuiltinInspectorProps } from '@lobechat/types';
+import { createStaticStyles, cx } from 'antd-style';
+import { memo } from 'react';
+import { Trans, useTranslation } from 'react-i18next';
+
+import { shinyTextStyles } from '@/styles';
+
+import type { ClearTodosParams, ClearTodosState } from '../../../types';
+
+const styles = createStaticStyles(({ css, cssVar }) => ({
+ mode: css`
+ padding-block-end: 1px;
+ color: ${cssVar.colorText};
+ background: linear-gradient(to top, ${cssVar.colorWarningBg} 40%, transparent 40%);
+ `,
+ root: css`
+ overflow: hidden;
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp: 1;
+
+ color: ${cssVar.colorTextSecondary};
+ `,
+}));
+
+export const ClearTodosInspector = memo<BuiltinInspectorProps<ClearTodosParams, ClearTodosState>>(
+ ({ args, partialArgs, isArgumentsStreaming }) => {
+ const { t } = useTranslation('plugin');
+
+ const mode = args?.mode || partialArgs?.mode;
+
+ if (isArgumentsStreaming && !mode) {
+ return (
+ <div className={cx(styles.root, shinyTextStyles.shinyText)}>
+ <span>{t('builtins.lobe-gtd.apiName.clearTodos')}</span>
+ </div>
+ );
+ }
+
+ const modeLabel =
+ mode === 'all'
+ ? t('builtins.lobe-gtd.apiName.clearTodos.modeAll')
+ : t('builtins.lobe-gtd.apiName.clearTodos.modeCompleted');
+
+ return (
+ <div className={cx(styles.root, isArgumentsStreaming && shinyTextStyles.shinyText)}>
+ <Trans
+ components={{ mode: <span className={styles.mode} /> }}
+ i18nKey="builtins.lobe-gtd.apiName.clearTodos.result"
+ ns="plugin"
+ values={{ mode: modeLabel }}
+ />
+ </div>
+ );
+ },
+);
+
+ClearTodosInspector.displayName = 'ClearTodosInspector';
+
+export default ClearTodosInspector;
diff --git a/packages/builtin-tool-gtd/src/client/Inspector/CompleteTodos/index.tsx b/packages/builtin-tool-gtd/src/client/Inspector/CompleteTodos/index.tsx
new file mode 100644
index 00000000000..bc2264ca0ca
--- /dev/null
+++ b/packages/builtin-tool-gtd/src/client/Inspector/CompleteTodos/index.tsx
@@ -0,0 +1,62 @@
+'use client';
+
+import type { BuiltinInspectorProps } from '@lobechat/types';
+import { Icon } from '@lobehub/ui';
+import { createStaticStyles, cx } from 'antd-style';
+import { CheckCircle } from 'lucide-react';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { shinyTextStyles } from '@/styles';
+
+import type { CompleteTodosParams, CompleteTodosState } from '../../../types';
+
+const styles = createStaticStyles(({ css, cssVar }) => ({
+ count: css`
+ font-family: ${cssVar.fontFamilyCode};
+ color: ${cssVar.colorSuccess};
+ `,
+ root: css`
+ overflow: hidden;
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp: 1;
+ `,
+ title: css`
+ margin-inline-end: 8px;
+ color: ${cssVar.colorText};
+ `,
+}));
+
+export const CompleteTodosInspector = memo<
+ BuiltinInspectorProps<CompleteTodosParams, CompleteTodosState>
+>(({ args, partialArgs, isArgumentsStreaming }) => {
+ const { t } = useTranslation('plugin');
+
+ const indices = args?.indices || partialArgs?.indices || [];
+ const count = indices.length;
+
+ if (isArgumentsStreaming && count === 0) {
+ return (
+ <div className={cx(styles.root, shinyTextStyles.shinyText)}>
+ <span>{t('builtins.lobe-gtd.apiName.completeTodos')}</span>
+ </div>
+ );
+ }
+
+ return (
+ <div className={cx(styles.root, isArgumentsStreaming && shinyTextStyles.shinyText)}>
+ <span className={styles.title}>{t('builtins.lobe-gtd.apiName.completeTodos')}</span>
+ {count > 0 && (
+ <span className={styles.count}>
+ <Icon icon={CheckCircle} size={12} />
+ {count}
+ </span>
+ )}
+ </div>
+ );
+});
+
+CompleteTodosInspector.displayName = 'CompleteTodosInspector';
+
+export default CompleteTodosInspector;
diff --git a/packages/builtin-tool-gtd/src/client/Inspector/CreatePlan/index.tsx b/packages/builtin-tool-gtd/src/client/Inspector/CreatePlan/index.tsx
new file mode 100644
index 00000000000..1e6568251cd
--- /dev/null
+++ b/packages/builtin-tool-gtd/src/client/Inspector/CreatePlan/index.tsx
@@ -0,0 +1,61 @@
+'use client';
+
+import type { BuiltinInspectorProps } from '@lobechat/types';
+import { createStaticStyles, cx } from 'antd-style';
+import { memo } from 'react';
+import { Trans, useTranslation } from 'react-i18next';
+
+import { shinyTextStyles } from '@/styles';
+
+import type { CreatePlanParams, CreatePlanState } from '../../../types';
+
+const styles = createStaticStyles(({ css, cssVar }) => ({
+ goal: css`
+ padding-block-end: 1px;
+ color: ${cssVar.colorText};
+ background: linear-gradient(to top, ${cssVar.colorPrimaryBg} 40%, transparent 40%);
+ `,
+ root: css`
+ overflow: hidden;
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp: 1;
+
+ color: ${cssVar.colorTextSecondary};
+ `,
+}));
+
+export const CreatePlanInspector = memo<BuiltinInspectorProps<CreatePlanParams, CreatePlanState>>(
+ ({ args, partialArgs, isArgumentsStreaming }) => {
+ const { t } = useTranslation('plugin');
+
+ const goal = args?.goal || partialArgs?.goal;
+
+ if (isArgumentsStreaming && !goal) {
+ return (
+ <div className={cx(styles.root, shinyTextStyles.shinyText)}>
+ <span>{t('builtins.lobe-gtd.apiName.createPlan')}</span>
+ </div>
+ );
+ }
+
+ return (
+ <div className={cx(styles.root, isArgumentsStreaming && shinyTextStyles.shinyText)}>
+ {goal ? (
+ <Trans
+ components={{ goal: <span className={styles.goal} /> }}
+ i18nKey="builtins.lobe-gtd.apiName.createPlan.result"
+ ns="plugin"
+ values={{ goal }}
+ />
+ ) : (
+ <span>{t('builtins.lobe-gtd.apiName.createPlan')}</span>
+ )}
+ </div>
+ );
+ },
+);
+
+CreatePlanInspector.displayName = 'CreatePlanInspector';
+
+export default CreatePlanInspector;
diff --git a/packages/builtin-tool-gtd/src/client/Inspector/CreateTodos/index.tsx b/packages/builtin-tool-gtd/src/client/Inspector/CreateTodos/index.tsx
new file mode 100644
index 00000000000..d820590f5d5
--- /dev/null
+++ b/packages/builtin-tool-gtd/src/client/Inspector/CreateTodos/index.tsx
@@ -0,0 +1,63 @@
+'use client';
+
+import type { BuiltinInspectorProps } from '@lobechat/types';
+import { Icon } from '@lobehub/ui';
+import { createStaticStyles, cx } from 'antd-style';
+import { Plus } from 'lucide-react';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { shinyTextStyles } from '@/styles';
+
+import type { CreateTodosParams, CreateTodosState } from '../../../types';
+
+const styles = createStaticStyles(({ css, cssVar }) => ({
+ count: css`
+ font-family: ${cssVar.fontFamilyCode};
+ color: ${cssVar.colorSuccess};
+ `,
+ root: css`
+ overflow: hidden;
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp: 1;
+ `,
+ title: css`
+ margin-inline-end: 8px;
+ color: ${cssVar.colorText};
+ `,
+}));
+
+export const CreateTodosInspector = memo<
+ BuiltinInspectorProps<CreateTodosParams, CreateTodosState>
+>(({ args, partialArgs, isArgumentsStreaming }) => {
+ const { t } = useTranslation('plugin');
+
+ const adds = args?.adds || partialArgs?.adds || [];
+ const items = args?.items || [];
+ const count = adds.length || items.length;
+
+ if (isArgumentsStreaming && count === 0) {
+ return (
+ <div className={cx(styles.root, shinyTextStyles.shinyText)}>
+ <span>{t('builtins.lobe-gtd.apiName.createTodos')}</span>
+ </div>
+ );
+ }
+
+ return (
+ <div className={cx(styles.root, isArgumentsStreaming && shinyTextStyles.shinyText)}>
+ <span className={styles.title}>{t('builtins.lobe-gtd.apiName.createTodos')}</span>
+ {count > 0 && (
+ <span className={styles.count}>
+ <Icon icon={Plus} size={12} />
+ {count}
+ </span>
+ )}
+ </div>
+ );
+});
+
+CreateTodosInspector.displayName = 'CreateTodosInspector';
+
+export default CreateTodosInspector;
diff --git a/packages/builtin-tool-gtd/src/client/Inspector/RemoveTodos/index.tsx b/packages/builtin-tool-gtd/src/client/Inspector/RemoveTodos/index.tsx
new file mode 100644
index 00000000000..98139c925dc
--- /dev/null
+++ b/packages/builtin-tool-gtd/src/client/Inspector/RemoveTodos/index.tsx
@@ -0,0 +1,62 @@
+'use client';
+
+import type { BuiltinInspectorProps } from '@lobechat/types';
+import { Icon } from '@lobehub/ui';
+import { createStaticStyles, cx } from 'antd-style';
+import { Minus } from 'lucide-react';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { shinyTextStyles } from '@/styles';
+
+import type { RemoveTodosParams, RemoveTodosState } from '../../../types';
+
+const styles = createStaticStyles(({ css, cssVar }) => ({
+ count: css`
+ font-family: ${cssVar.fontFamilyCode};
+ color: ${cssVar.colorError};
+ `,
+ root: css`
+ overflow: hidden;
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp: 1;
+ `,
+ title: css`
+ margin-inline-end: 8px;
+ color: ${cssVar.colorText};
+ `,
+}));
+
+export const RemoveTodosInspector = memo<
+ BuiltinInspectorProps<RemoveTodosParams, RemoveTodosState>
+>(({ args, partialArgs, isArgumentsStreaming }) => {
+ const { t } = useTranslation('plugin');
+
+ const indices = args?.indices || partialArgs?.indices || [];
+ const count = indices.length;
+
+ if (isArgumentsStreaming && count === 0) {
+ return (
+ <div className={cx(styles.root, shinyTextStyles.shinyText)}>
+ <span>{t('builtins.lobe-gtd.apiName.removeTodos')}</span>
+ </div>
+ );
+ }
+
+ return (
+ <div className={cx(styles.root, isArgumentsStreaming && shinyTextStyles.shinyText)}>
+ <span className={styles.title}>{t('builtins.lobe-gtd.apiName.removeTodos')}</span>
+ {count > 0 && (
+ <span className={styles.count}>
+ <Icon icon={Minus} size={12} />
+ {count}
+ </span>
+ )}
+ </div>
+ );
+});
+
+RemoveTodosInspector.displayName = 'RemoveTodosInspector';
+
+export default RemoveTodosInspector;
diff --git a/packages/builtin-tool-gtd/src/client/Inspector/UpdatePlan/index.tsx b/packages/builtin-tool-gtd/src/client/Inspector/UpdatePlan/index.tsx
new file mode 100644
index 00000000000..24bafb6c999
--- /dev/null
+++ b/packages/builtin-tool-gtd/src/client/Inspector/UpdatePlan/index.tsx
@@ -0,0 +1,73 @@
+'use client';
+
+import type { BuiltinInspectorProps } from '@lobechat/types';
+import { Icon } from '@lobehub/ui';
+import { createStaticStyles, cx } from 'antd-style';
+import { CheckCircle, DiffIcon } from 'lucide-react';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { shinyTextStyles } from '@/styles';
+
+import type { UpdatePlanParams, UpdatePlanState } from '../../../types';
+
+const styles = createStaticStyles(({ css, cssVar }) => ({
+ completed: css`
+ font-family: ${cssVar.fontFamilyCode};
+ color: ${cssVar.colorSuccess};
+ `,
+ root: css`
+ overflow: hidden;
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp: 1;
+ `,
+ title: css`
+ margin-inline-end: 8px;
+ color: ${cssVar.colorText};
+ `,
+ updated: css`
+ font-family: ${cssVar.fontFamilyCode};
+ color: ${cssVar.colorWarning};
+ `,
+}));
+
+export const UpdatePlanInspector = memo<BuiltinInspectorProps<UpdatePlanParams, UpdatePlanState>>(
+ ({ args, partialArgs, isArgumentsStreaming }) => {
+ const { t } = useTranslation('plugin');
+
+ const planId = args?.planId || partialArgs?.planId;
+ const completed = args?.completed;
+ const hasUpdates = args?.goal || args?.description || args?.context;
+
+ if (isArgumentsStreaming && !planId) {
+ return (
+ <div className={cx(styles.root, shinyTextStyles.shinyText)}>
+ <span>{t('builtins.lobe-gtd.apiName.updatePlan')}</span>
+ </div>
+ );
+ }
+
+ return (
+ <div className={cx(styles.root, isArgumentsStreaming && shinyTextStyles.shinyText)}>
+ <span className={styles.title}>{t('builtins.lobe-gtd.apiName.updatePlan')}</span>
+ {completed && (
+ <span className={styles.completed}>
+ <Icon icon={CheckCircle} size={12} />
+ {t('builtins.lobe-gtd.apiName.updatePlan.completed')}
+ </span>
+ )}
+ {hasUpdates && !completed && (
+ <span className={styles.updated}>
+ <Icon icon={DiffIcon} size={12} />
+ {t('builtins.lobe-gtd.apiName.updatePlan.modified')}
+ </span>
+ )}
+ </div>
+ );
+ },
+);
+
+UpdatePlanInspector.displayName = 'UpdatePlanInspector';
+
+export default UpdatePlanInspector;
diff --git a/packages/builtin-tool-gtd/src/client/Inspector/UpdateTodos/index.tsx b/packages/builtin-tool-gtd/src/client/Inspector/UpdateTodos/index.tsx
new file mode 100644
index 00000000000..4acf8f76851
--- /dev/null
+++ b/packages/builtin-tool-gtd/src/client/Inspector/UpdateTodos/index.tsx
@@ -0,0 +1,144 @@
+'use client';
+
+import type { BuiltinInspectorProps } from '@lobechat/types';
+import { Icon } from '@lobehub/ui';
+import { createStaticStyles, cx } from 'antd-style';
+import { CheckCircle, DiffIcon, Minus, Plus } from 'lucide-react';
+import { type ReactNode, memo, useMemo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { shinyTextStyles } from '@/styles';
+
+import type { UpdateTodosParams, UpdateTodosState } from '../../../types';
+
+const styles = createStaticStyles(({ css, cssVar }) => ({
+ add: css`
+ font-family: ${cssVar.fontFamilyCode};
+ color: ${cssVar.colorSuccess};
+ `,
+ complete: css`
+ font-family: ${cssVar.fontFamilyCode};
+ color: ${cssVar.colorPrimary};
+ `,
+ remove: css`
+ font-family: ${cssVar.fontFamilyCode};
+ color: ${cssVar.colorError};
+ `,
+ root: css`
+ overflow: hidden;
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp: 1;
+ `,
+ separator: css`
+ margin-inline: 2px;
+ color: ${cssVar.colorTextQuaternary};
+ `,
+ title: css`
+ margin-inline-end: 8px;
+ color: ${cssVar.colorText};
+ `,
+ update: css`
+ font-family: ${cssVar.fontFamilyCode};
+ color: ${cssVar.colorWarning};
+ `,
+}));
+
+export const UpdateTodosInspector = memo<
+ BuiltinInspectorProps<UpdateTodosParams, UpdateTodosState>
+>(({ args, partialArgs, isArgumentsStreaming }) => {
+ const { t } = useTranslation('plugin');
+
+ const counts = useMemo(() => {
+ const operations = args?.operations || partialArgs?.operations || [];
+ return operations.reduce(
+ (acc, op) => {
+ switch (op.type) {
+ case 'add': {
+ acc.add++;
+ break;
+ }
+ case 'update': {
+ acc.update++;
+ break;
+ }
+ case 'remove': {
+ acc.remove++;
+ break;
+ }
+ case 'complete': {
+ acc.complete++;
+ break;
+ }
+ }
+ return acc;
+ },
+ { add: 0, complete: 0, remove: 0, update: 0 },
+ );
+ }, [args?.operations, partialArgs?.operations]);
+
+ const hasOperations =
+ counts.add > 0 || counts.update > 0 || counts.remove > 0 || counts.complete > 0;
+
+ if (isArgumentsStreaming && !hasOperations) {
+ return (
+ <div className={cx(styles.root, shinyTextStyles.shinyText)}>
+ <span>{t('builtins.lobe-gtd.apiName.updateTodos')}</span>
+ </div>
+ );
+ }
+
+ const statsParts: ReactNode[] = [];
+ if (counts.add > 0) {
+ statsParts.push(
+ <span className={styles.add} key="add">
+ <Icon icon={Plus} size={12} />
+ {counts.add}
+ </span>,
+ );
+ }
+ if (counts.update > 0) {
+ statsParts.push(
+ <span className={styles.update} key="update">
+ <Icon icon={DiffIcon} size={12} />
+ {counts.update}
+ </span>,
+ );
+ }
+ if (counts.complete > 0) {
+ statsParts.push(
+ <span className={styles.complete} key="complete">
+ <Icon icon={CheckCircle} size={12} />
+ {counts.complete}
+ </span>,
+ );
+ }
+ if (counts.remove > 0) {
+ statsParts.push(
+ <span className={styles.remove} key="remove">
+ <Icon icon={Minus} size={12} />
+ {counts.remove}
+ </span>,
+ );
+ }
+
+ return (
+ <div className={cx(styles.root, isArgumentsStreaming && shinyTextStyles.shinyText)}>
+ <span className={styles.title}>{t('builtins.lobe-gtd.apiName.updateTodos')}</span>
+ {statsParts.length > 0 && (
+ <>
+ {statsParts.map((part, index) => (
+ <span key={index}>
+ {index > 0 && <span className={styles.separator}> / </span>}
+ {part}
+ </span>
+ ))}
+ </>
+ )}
+ </div>
+ );
+});
+
+UpdateTodosInspector.displayName = 'UpdateTodosInspector';
+
+export default UpdateTodosInspector;
diff --git a/packages/builtin-tool-gtd/src/client/Inspector/index.ts b/packages/builtin-tool-gtd/src/client/Inspector/index.ts
new file mode 100644
index 00000000000..5073dc68f25
--- /dev/null
+++ b/packages/builtin-tool-gtd/src/client/Inspector/index.ts
@@ -0,0 +1,26 @@
+import { type BuiltinInspector } from '@lobechat/types';
+
+import { GTDApiName } from '../../types';
+import { ClearTodosInspector } from './ClearTodos';
+import { CompleteTodosInspector } from './CompleteTodos';
+import { CreatePlanInspector } from './CreatePlan';
+import { CreateTodosInspector } from './CreateTodos';
+import { RemoveTodosInspector } from './RemoveTodos';
+import { UpdatePlanInspector } from './UpdatePlan';
+import { UpdateTodosInspector } from './UpdateTodos';
+
+/**
+ * GTD Inspector Components Registry
+ *
+ * Inspector components customize the title/header area
+ * of tool calls in the conversation UI.
+ */
+export const GTDInspectors: Record<string, BuiltinInspector> = {
+ [GTDApiName.clearTodos]: ClearTodosInspector as BuiltinInspector,
+ [GTDApiName.completeTodos]: CompleteTodosInspector as BuiltinInspector,
+ [GTDApiName.createPlan]: CreatePlanInspector as BuiltinInspector,
+ [GTDApiName.createTodos]: CreateTodosInspector as BuiltinInspector,
+ [GTDApiName.removeTodos]: RemoveTodosInspector as BuiltinInspector,
+ [GTDApiName.updatePlan]: UpdatePlanInspector as BuiltinInspector,
+ [GTDApiName.updateTodos]: UpdateTodosInspector as BuiltinInspector,
+};
diff --git a/packages/builtin-tool-gtd/src/client/index.ts b/packages/builtin-tool-gtd/src/client/index.ts
index 42e87db6fee..a31b1b5b22e 100644
--- a/packages/builtin-tool-gtd/src/client/index.ts
+++ b/packages/builtin-tool-gtd/src/client/index.ts
@@ -1,3 +1,6 @@
+// Inspector components (customized tool call headers)
+export { GTDInspectors } from './Inspector';
+
// Render components (read-only snapshots)
export type { TodoListRenderState } from './Render';
export { GTDRenders, TodoListRender, TodoListUI } from './Render';
diff --git a/packages/builtin-tool-gtd/src/manifest.ts b/packages/builtin-tool-gtd/src/manifest.ts
index ce08ddeb088..6c956bdafa3 100644
--- a/packages/builtin-tool-gtd/src/manifest.ts
+++ b/packages/builtin-tool-gtd/src/manifest.ts
@@ -31,7 +31,7 @@ export const GTDManifest: BuiltinToolManifest = {
type: 'string',
},
},
- required: ['goal', 'description'],
+ required: ['goal', 'description', 'context'],
type: 'object',
},
},
diff --git a/packages/conversation-flow/src/__tests__/parse.test.ts b/packages/conversation-flow/src/__tests__/parse.test.ts
index 621b1356885..a24d3b8dd67 100644
--- a/packages/conversation-flow/src/__tests__/parse.test.ts
+++ b/packages/conversation-flow/src/__tests__/parse.test.ts
@@ -156,7 +156,7 @@ describe('parse', () => {
});
describe('Performance', () => {
- it('should parse 10000 items within 50ms', () => {
+ it('should parse 10000 items within 100ms', () => {
// Generate 10000 messages as flat siblings (no deep nesting to avoid stack overflow)
// This simulates a more realistic scenario where messages are not deeply nested
const largeInput = Array.from({ length: 10000 }, (_, i) => ({
@@ -174,7 +174,7 @@ describe('parse', () => {
const executionTime = endTime - startTime;
expect(result.flatList.length).toBeGreaterThan(0);
- expect(executionTime).toBeLessThan(60);
+ expect(executionTime).toBeLessThan(100);
});
});
});
diff --git a/src/app/[variants]/(main)/chat/features/Conversation/ConversationArea.tsx b/src/app/[variants]/(main)/chat/features/Conversation/ConversationArea.tsx
index a965293e0ab..3eeeaf0a369 100644
--- a/src/app/[variants]/(main)/chat/features/Conversation/ConversationArea.tsx
+++ b/src/app/[variants]/(main)/chat/features/Conversation/ConversationArea.tsx
@@ -5,7 +5,7 @@ import { Flexbox } from '@lobehub/ui';
import { Suspense, memo, useEffect, useMemo } from 'react';
import ChatMiniMap from '@/features/ChatMiniMap';
-import { ChatList, ConversationProvider } from '@/features/Conversation';
+import { ChatList, ConversationProvider, TodoProgress } from '@/features/Conversation';
import ZenModeToast from '@/features/ZenModeToast';
import { useOperationState } from '@/hooks/useOperationState';
import { useAgentStore } from '@/store/agent';
@@ -100,6 +100,7 @@ const Conversation = memo(() => {
>
<ChatList welcome={<WelcomeChatItem />} />
</Flexbox>
+ <TodoProgress />
<MainChatInput />
<ChatHydration />
<ThreadHydration />
diff --git a/src/app/[variants]/(main)/group/features/Conversation/MainChatInput/GroupChat.tsx b/src/app/[variants]/(main)/group/features/Conversation/MainChatInput/GroupChat.tsx
index 1d1919e299e..eafd8f05fe3 100644
--- a/src/app/[variants]/(main)/group/features/Conversation/MainChatInput/GroupChat.tsx
+++ b/src/app/[variants]/(main)/group/features/Conversation/MainChatInput/GroupChat.tsx
@@ -15,7 +15,6 @@ import { agentGroupSelectors } from '@/store/agentGroup/selectors';
import { useChatStore } from '@/store/chat';
import { aiChatSelectors } from '@/store/chat/selectors';
-// import { useSendGroupMessage } from '../ChatInput/useSend';
import MessageFromUrl from './MessageFromUrl';
import { useSendMenuItems } from './useSendMenuItems';
@@ -25,7 +24,7 @@ const leftActions: ActionKeys[] = [
'knowledgeBase',
'---',
['stt', 'clear'],
- 'groupChatToken',
+ 'mainToken',
];
const dmLeftActions: ActionKeys[] = ['typo', 'fileUpload', 'knowledgeBase', '---', ['stt']];
diff --git a/src/features/ChatInput/ActionBar/Token/TokenTagForGroupChat.tsx b/src/features/ChatInput/ActionBar/Token/TokenTagForGroupChat.tsx
deleted file mode 100644
index 51dce3ec0c8..00000000000
--- a/src/features/ChatInput/ActionBar/Token/TokenTagForGroupChat.tsx
+++ /dev/null
@@ -1,289 +0,0 @@
-import { type GroupMemberInfo, groupChatPrompts, groupSupervisorPrompts } from '@lobechat/prompts';
-import { Center, Flexbox, Tooltip } from '@lobehub/ui';
-import { TokenTag } from '@lobehub/ui/chat';
-import { cssVar } from 'antd-style';
-import numeral from 'numeral';
-import { memo, useMemo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { createAgentToolsEngine } from '@/helpers/toolEngineering';
-import { useModelContextWindowTokens } from '@/hooks/useModelContextWindowTokens';
-import { useModelSupportToolUse } from '@/hooks/useModelSupportToolUse';
-import { useTokenCount } from '@/hooks/useTokenCount';
-import { useAgentStore } from '@/store/agent';
-import { agentByIdSelectors } from '@/store/agent/selectors';
-import { agentGroupSelectors } from '@/store/agentGroup/selectors';
-import { useAgentGroupStore } from '@/store/agentGroup/store';
-import { useChatStore } from '@/store/chat';
-import { chatSelectors } from '@/store/chat/selectors';
-import { messageMapKey } from '@/store/chat/utils/messageMapKey';
-import { useSessionStore } from '@/store/session';
-import { sessionSelectors } from '@/store/session/selectors';
-import { useToolStore } from '@/store/tool';
-import { toolSelectors } from '@/store/tool/selectors';
-import { userProfileSelectors } from '@/store/user/selectors';
-import { getUserStoreState } from '@/store/user/store';
-
-import { useAgentId } from '../../hooks/useAgentId';
-import ActionPopover from '../components/ActionPopover';
-import TokenProgress from './TokenProgress';
-
-interface TokenTagForGroupChatProps {
- total: string;
-}
-
-const TokenTagForGroupChat = memo<TokenTagForGroupChatProps>(({ total: messageString }) => {
- const { t } = useTranslation(['chat', 'components']);
-
- const input = useChatStore((s) => s.inputMessage);
- const activeTopicId = useChatStore((s) => s.activeTopicId);
-
- const agentId = useAgentId();
- const [model, provider] = useAgentStore((s) => {
- return [
- agentByIdSelectors.getAgentModelById(agentId)(s),
- agentByIdSelectors.getAgentModelProviderById(agentId)(s),
- ];
- });
-
- // Group chat specific data
- const groupAgents = useSessionStore(sessionSelectors.currentGroupAgents);
- const activeSessionId = useSessionStore((s) => s.activeId);
- const groupConfig = useAgentGroupStore(agentGroupSelectors.currentGroupConfig);
- const supervisorTodos = useChatStore((s) =>
- activeSessionId
- ? s.supervisorTodos[messageMapKey({ agentId: activeSessionId, topicId: activeTopicId })] || []
- : [],
- );
-
- const maxTokens = useModelContextWindowTokens(model, provider);
-
- // Tool usage token - collect all plugins from all agents in the group
- const canUseTool = useModelSupportToolUse(model, provider);
- const allGroupPlugins = useMemo(() => {
- if (!groupAgents || groupAgents.length === 0) return [];
-
- // Collect unique plugins from all group agents
- const pluginSet = new Set<string>();
- groupAgents.forEach((agent) => {
- if (agent.plugins) {
- agent.plugins.forEach((plugin) => pluginSet.add(plugin));
- }
- });
-
- return Array.from(pluginSet);
- }, [groupAgents]);
-
- //@ts-ignore
- const pluginIds = allGroupPlugins.map((plugin) => plugin.id);
-
- const toolsString = useToolStore((s) => {
- const toolsEngine = createAgentToolsEngine({ model, provider });
-
- const { tools, enabledToolIds } = toolsEngine.generateToolsDetailed({
- model,
- provider,
- toolIds: pluginIds,
- });
- const schemaNumber = tools?.map((i) => JSON.stringify(i)).join('') || '';
-
- const pluginSystemRoles = toolSelectors.enabledSystemRoles(enabledToolIds)(s);
-
- return pluginSystemRoles + schemaNumber;
- });
- const toolsToken = useTokenCount(canUseTool ? toolsString : '');
-
- // System role token calculation for group chat
- // Calculate the tokens for system message + user message that are sent per agent response
- const systemRolePerAgentString = useMemo(() => {
- if (!groupAgents || groupAgents.length === 0) return '';
-
- try {
- const chats = chatSelectors.mainAIChatsWithHistoryConfig(useChatStore.getState());
-
- // Get real user name from user store
- const userStoreState = getUserStoreState();
- const realUserName = userProfileSelectors.nickName(userStoreState) || 'User';
-
- const agentTitleMap: GroupMemberInfo[] = [
- { id: 'user', title: realUserName },
- ...(groupAgents || []).map((agent) => ({ id: agent.id || '', title: agent.title || '' })),
- ];
-
- // Calculate tokens for a representative agent's system prompt and user instruction
- const firstAgent = groupAgents[0];
- if (!firstAgent) return '';
-
- const baseSystemRole = firstAgent.systemRole || '';
- const members: GroupMemberInfo[] = agentTitleMap as GroupMemberInfo[];
-
- // Build the group chat system prompt (same as used in agent processing)
- const groupChatSystemPrompt = groupChatPrompts.buildGroupChatSystemPrompt({
- agentId: firstAgent.id || '',
- baseSystemRole,
- groupMembers: members,
- messages: chats,
- });
-
- // Build the user message (instruction for agent to respond)
- const userInstruction = `Now it's your turn to respond. You are sending message to the group publicly. Please respond as this agent would, considering the full conversation history provided above. Directly return the message content, no other text. You do not need add author name or anything else.`;
-
- // Return combined system + user message tokens
- return groupChatSystemPrompt + '\n\n' + userInstruction;
- } catch (error) {
- console.warn('Failed to calculate system role tokens:', error);
- return '';
- }
- }, [groupAgents, messageString]);
-
- const systemRoleToken = useTokenCount(systemRolePerAgentString);
-
- // Supervisor token calculation for group chat
- const supervisorPrompt = useMemo(() => {
- if (!groupAgents || groupAgents.length === 0) {
- return '';
- }
-
- try {
- const chats = chatSelectors.mainAIChatsWithHistoryConfig(useChatStore.getState());
-
- // Only calculate supervisor tokens if there are actual messages in the conversation
- if (!chats || chats.length === 0) {
- return '';
- }
-
- const conversationHistory = groupSupervisorPrompts(chats);
-
- // Get real user name from user store
- const userStoreState = getUserStoreState();
- const realUserName = userProfileSelectors.nickName(userStoreState) || 'User';
-
- return groupChatPrompts.buildSupervisorPrompt({
- availableAgents: groupAgents
- .filter((agent) => agent.id)
- .map((agent) => ({ id: agent.id!, title: agent.title })),
- conversationHistory,
- systemPrompt: groupConfig.systemPrompt,
- todoList: supervisorTodos,
- userName: realUserName,
- });
- } catch (error) {
- console.warn('Failed to calculate supervisor tokens:', error);
- return '';
- }
- }, [groupAgents, groupConfig.systemPrompt, messageString, supervisorTodos]);
-
- const supervisorToken = useTokenCount(supervisorPrompt);
-
- // Chat usage token
- const inputTokenCount = useTokenCount(input);
-
- const chatsString = useMemo(() => {
- const chats = chatSelectors.mainAIChatsWithHistoryConfig(useChatStore.getState());
- return chats.map((chat) => chat.content).join('');
- }, [messageString]);
-
- const chatsToken = useTokenCount(chatsString) + inputTokenCount;
-
- // Total token (include supervisor tokens and system role tokens for group chat)
- const totalToken = systemRoleToken + toolsToken + chatsToken + supervisorToken;
-
- const content = (
- <Flexbox gap={12} style={{ minWidth: 200 }}>
- <Flexbox align={'center'} gap={4} horizontal justify={'space-between'} width={'100%'}>
- <div style={{ color: cssVar.colorTextDescription }}>{t('tokenDetails.title')}</div>
- <Tooltip
- styles={{ root: { maxWidth: 'unset', pointerEvents: 'none' } }}
- title={t('ModelSelect.featureTag.tokens', {
- ns: 'components',
- tokens: numeral(maxTokens).format('0,0'),
- })}
- >
- <Center
- height={20}
- paddingInline={4}
- style={{
- background: cssVar.colorFillTertiary,
- borderRadius: 4,
- color: cssVar.colorTextSecondary,
- fontFamily: cssVar.fontFamilyCode,
- fontSize: 11,
- }}
- >
- TOKEN
- </Center>
- </Tooltip>
- </Flexbox>
- <TokenProgress
- data={[
- {
- color: cssVar.magenta,
- id: 'systemRole',
- title: t('tokenDetails.systemRole'),
- value: systemRoleToken,
- },
- {
- color: cssVar.geekblue,
- id: 'tools',
- title: t('tokenDetails.tools'),
- value: toolsToken,
- },
- ...(supervisorToken > 0
- ? [
- {
- color: cssVar.purple,
- id: 'supervisor',
- title: t('tokenDetails.supervisor'),
- value: supervisorToken,
- },
- ]
- : []),
- {
- color: cssVar.gold,
- id: 'chats',
- title: t('tokenDetails.chats'),
- value: chatsToken,
- },
- ]}
- showIcon
- />
- <TokenProgress
- data={[
- {
- color: cssVar.colorSuccess,
- id: 'used',
- title: t('tokenDetails.used'),
- value: totalToken,
- },
- {
- color: cssVar.colorFill,
- id: 'rest',
- title: t('tokenDetails.rest'),
- value: maxTokens - totalToken,
- },
- ]}
- showIcon
- showTotal={t('tokenDetails.total')}
- />
- </Flexbox>
- );
-
- return (
- <ActionPopover content={content}>
- <TokenTag
- maxValue={maxTokens}
- mode={'used'}
- text={{
- overload: t('tokenTag.overload'),
- remained: t('tokenTag.remained'),
- used: t('tokenTag.used'),
- }}
- value={totalToken}
- />
- </ActionPopover>
- );
-});
-
-TokenTagForGroupChat.displayName = 'TokenTagForGroupChat';
-
-export default TokenTagForGroupChat;
diff --git a/src/features/ChatInput/ActionBar/Token/index.tsx b/src/features/ChatInput/ActionBar/Token/index.tsx
index c0f46e04262..1ce16aaf23c 100644
--- a/src/features/ChatInput/ActionBar/Token/index.tsx
+++ b/src/features/ChatInput/ActionBar/Token/index.tsx
@@ -3,12 +3,9 @@ import { type PropsWithChildren, memo } from 'react';
import { useModelHasContextWindowToken } from '@/hooks/useModelHasContextWindowToken';
import { useChatStore } from '@/store/chat';
-import { chatSelectors, threadSelectors } from '@/store/chat/selectors';
+import { displayMessageSelectors, threadSelectors } from '@/store/chat/selectors';
const LargeTokenContent = dynamic(() => import('./TokenTag'), { ssr: false });
-const LargeTokenContentForGroupChat = dynamic(() => import('./TokenTagForGroupChat'), {
- ssr: false,
-});
const Token = memo<PropsWithChildren>(({ children }) => {
const showTag = useModelHasContextWindowToken();
@@ -17,7 +14,7 @@ const Token = memo<PropsWithChildren>(({ children }) => {
});
export const MainToken = memo(() => {
- const total = useChatStore(chatSelectors.mainAIChatsMessageString);
+ const total = useChatStore(displayMessageSelectors.mainAIChatsMessageString);
return (
<Token>
@@ -35,13 +32,3 @@ export const PortalToken = memo(() => {
</Token>
);
});
-
-export const GroupChatToken = memo(() => {
- const total = useChatStore(chatSelectors.mainAIChatsMessageString);
-
- return (
- <Token>
- <LargeTokenContentForGroupChat total={total} />
- </Token>
- );
-});
diff --git a/src/features/ChatInput/ActionBar/config.ts b/src/features/ChatInput/ActionBar/config.ts
index 137dbfdd7e4..b70618dd1e8 100644
--- a/src/features/ChatInput/ActionBar/config.ts
+++ b/src/features/ChatInput/ActionBar/config.ts
@@ -8,7 +8,7 @@ import Params from './Params';
import STT from './STT';
import SaveTopic from './SaveTopic';
import Search from './Search';
-import { GroupChatToken, MainToken, PortalToken } from './Token';
+import { MainToken, PortalToken } from './Token';
import Tools from './Tools';
import Typo from './Typo';
import Upload from './Upload';
@@ -17,7 +17,6 @@ export const actionMap = {
agentMode: AgentMode,
clear: Clear,
fileUpload: Upload,
- groupChatToken: GroupChatToken,
history: History,
knowledgeBase: Knowledge,
mainToken: MainToken,
diff --git a/src/features/Conversation/TodoProgress/index.tsx b/src/features/Conversation/TodoProgress/index.tsx
new file mode 100644
index 00000000000..8911dc922a8
--- /dev/null
+++ b/src/features/Conversation/TodoProgress/index.tsx
@@ -0,0 +1,189 @@
+'use client';
+
+import { type StepContextTodos } from '@lobechat/types';
+import { Checkbox, Flexbox, Icon, Tag } from '@lobehub/ui';
+import { createStaticStyles, cssVar, cx } from 'antd-style';
+import { ChevronDown, ChevronUp, ListTodo } from 'lucide-react';
+import { memo, useMemo, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import WideScreenContainer from '@/features/WideScreenContainer';
+import { selectTodosFromMessages } from '@/store/chat/slices/message/selectors/dbMessage';
+import { shinyTextStyles } from '@/styles';
+
+import { dataSelectors, messageStateSelectors, useConversationStore } from '../store';
+
+const styles = createStaticStyles(({ css, cssVar }) => ({
+ collapsed: css`
+ max-height: 0;
+ padding-block: 0 !important;
+ opacity: 0;
+ `,
+ container: css`
+ cursor: pointer;
+ user-select: none;
+
+ margin-block-end: 8px;
+ padding-block: 8px;
+ padding-inline: 12px;
+ border: 1px solid ${cssVar.colorBorderSecondary};
+ border-radius: 8px;
+
+ background: ${cssVar.colorBgElevated};
+
+ transition: all 0.2s ${cssVar.motionEaseInOut};
+
+ &:hover {
+ background: ${cssVar.colorFillTertiary};
+ }
+ `,
+ count: css`
+ font-family: ${cssVar.fontFamilyCode};
+ font-size: 12px;
+ color: ${cssVar.colorTextSecondary};
+ `,
+ expanded: css`
+ max-height: 300px;
+ opacity: 1;
+ `,
+ header: css`
+ overflow: hidden;
+
+ font-size: 13px;
+ font-weight: 500;
+ color: ${cssVar.colorText};
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ `,
+ itemRow: css`
+ padding-block: 6px;
+ padding-inline: 4px;
+ border-block-end: 1px dashed ${cssVar.colorBorderSecondary};
+ font-size: 13px;
+
+ &:last-child {
+ border-block-end: none;
+ }
+ `,
+ listContainer: css`
+ overflow: hidden;
+
+ margin-block-start: 8px;
+ padding-block: 4px;
+ border-block-start: 1px solid ${cssVar.colorBorderSecondary};
+
+ transition:
+ max-height 0.25s ${cssVar.motionEaseInOut},
+ opacity 0.2s ${cssVar.motionEaseInOut},
+ padding 0.2s ${cssVar.motionEaseInOut};
+ `,
+ progress: css`
+ flex: 1;
+ height: 4px;
+ border-radius: 2px;
+ background: ${cssVar.colorFillSecondary};
+ `,
+ progressFill: css`
+ height: 100%;
+ border-radius: 2px;
+ background: ${cssVar.colorSuccess};
+ transition: width 0.3s ${cssVar.motionEaseInOut};
+ `,
+ textChecked: css`
+ color: ${cssVar.colorTextQuaternary};
+ text-decoration: line-through;
+ `,
+}));
+
+interface TodoProgressProps {
+ className?: string;
+}
+
+const TodoProgress = memo<TodoProgressProps>(({ className }) => {
+ const { t } = useTranslation('chat');
+ const [expanded, setExpanded] = useState(false);
+
+ // Get messages and AI generating state from conversation store
+ const dbMessages = useConversationStore(dataSelectors.dbMessages);
+ const isAIGenerating = useConversationStore(messageStateSelectors.isAIGenerating);
+
+ // Extract todos from messages
+ const todos: StepContextTodos | undefined = useMemo(
+ () => selectTodosFromMessages(dbMessages),
+ [dbMessages],
+ );
+
+ // Calculate progress
+ const items = todos?.items || [];
+ const total = items.length;
+ const completed = items.filter((item) => item.completed).length;
+ const progressPercent = total > 0 ? (completed / total) * 100 : 0;
+
+ // Find current pending task (first incomplete item)
+ const currentPendingTask = items.find((item) => !item.completed);
+
+ // Don't render if no todos
+ if (total === 0) return null;
+
+ const toggleExpanded = () => setExpanded(!expanded);
+
+ return (
+ <WideScreenContainer>
+ <div className={cx(styles.container, className)} onClick={toggleExpanded}>
+ {/* Header */}
+ <Flexbox align="center" gap={8} horizontal justify="space-between">
+ <Flexbox align="center" gap={8} horizontal style={{ flex: 1, minWidth: 0 }}>
+ <Icon icon={ListTodo} size={16} style={{ color: cssVar.colorPrimary, flexShrink: 0 }} />
+ <span className={cx(styles.header, isAIGenerating && shinyTextStyles.shinyText)}>
+ {currentPendingTask?.text ||
+ t('todoProgress.allCompleted', { defaultValue: 'All tasks completed' })}
+ </span>
+ <Tag size="small" style={{ flexShrink: 0 }}>
+ <span className={styles.count}>
+ {completed}/{total}
+ </span>
+ </Tag>
+ </Flexbox>
+ <Icon
+ icon={expanded ? ChevronUp : ChevronDown}
+ size={16}
+ style={{ color: cssVar.colorTextTertiary, flexShrink: 0 }}
+ />
+ </Flexbox>
+
+ {/* Progress Bar */}
+ <Flexbox gap={8} horizontal style={{ marginTop: 8 }}>
+ <div className={styles.progress}>
+ <div className={styles.progressFill} style={{ width: `${progressPercent}%` }} />
+ </div>
+ </Flexbox>
+
+ {/* Expandable Todo List */}
+ <div className={cx(styles.listContainer, expanded ? styles.expanded : styles.collapsed)}>
+ {items.map((item, index) => (
+ <Checkbox
+ backgroundColor={cssVar.colorSuccess}
+ checked={item.completed}
+ classNames={{
+ text: item.completed ? styles.textChecked : undefined,
+ wrapper: styles.itemRow,
+ }}
+ key={index}
+ shape="circle"
+ style={{ borderWidth: 1.5, cursor: 'default', pointerEvents: 'none' }}
+ textProps={{
+ type: item.completed ? 'secondary' : undefined,
+ }}
+ >
+ {item.text}
+ </Checkbox>
+ ))}
+ </div>
+ </div>
+ </WideScreenContainer>
+ );
+});
+
+TodoProgress.displayName = 'TodoProgress';
+
+export default TodoProgress;
diff --git a/src/features/Conversation/index.ts b/src/features/Conversation/index.ts
index 0d5f6b1aa8a..11d670a1eaa 100644
--- a/src/features/Conversation/index.ts
+++ b/src/features/Conversation/index.ts
@@ -22,3 +22,4 @@ export type {
export { default as ChatInput, type ChatInputProps } from './ChatInput';
export { default as ChatList, type ChatListProps } from './ChatList';
export { default as MessageItem, type MessageItemProps } from './Messages';
+export { default as TodoProgress } from './TodoProgress';
diff --git a/src/features/PageEditor/DiffAllToolbar.tsx b/src/features/PageEditor/DiffAllToolbar.tsx
index 1b1b0978e0b..73ee71cf59b 100644
--- a/src/features/PageEditor/DiffAllToolbar.tsx
+++ b/src/features/PageEditor/DiffAllToolbar.tsx
@@ -37,7 +37,7 @@ const styles = createStaticStyles(({ css }) => ({
const DiffAllToolbar = memo(() => {
const { t } = useTranslation('editor');
const { isDarkMode } = useThemeMode();
- const editor = usePageEditorStore((s) => s.editor);
+ const [editor, performSave] = usePageEditorStore((s) => [s.editor, s.performSave]);
const [hasPendingDiffs, setHasPendingDiffs] = useState(false);
// Listen to editor state changes to detect diff nodes
@@ -87,11 +87,11 @@ const DiffAllToolbar = memo(() => {
>
<Space>
<Button
- // danger
- onClick={() => {
+ onClick={async () => {
editor.dispatchCommand(LITEXML_DIFFNODE_ALL_COMMAND, {
action: DiffAction.Reject,
});
+ await performSave({ force: true });
}}
size={'small'}
type="text"
@@ -101,10 +101,11 @@ const DiffAllToolbar = memo(() => {
</Button>
<Button
color={'default'}
- onClick={() => {
+ onClick={async () => {
editor.dispatchCommand(LITEXML_DIFFNODE_ALL_COMMAND, {
action: DiffAction.Accept,
});
+ await performSave({ force: true });
}}
size={'small'}
variant="filled"
diff --git a/src/features/PageEditor/store/action.ts b/src/features/PageEditor/store/action.ts
index bac7a2d0c42..9153433dd5f 100644
--- a/src/features/PageEditor/store/action.ts
+++ b/src/features/PageEditor/store/action.ts
@@ -24,7 +24,7 @@ export interface Action {
) => Promise<void>;
handleTitleSubmit: () => Promise<void>;
onEditorInit: () => void;
- performSave: () => Promise<void>;
+ performSave: (options?: { force?: boolean }) => Promise<void>;
setCurrentEmoji: (emoji: string | undefined) => void;
setCurrentTitle: (title: string) => void;
}
@@ -141,7 +141,7 @@ export const store: (initState?: Partial<State>) => StateCreator<Store> =
}
},
- performSave: async () => {
+ performSave: async (options) => {
const {
editor,
currentDocId,
@@ -156,8 +156,13 @@ export const store: (initState?: Partial<State>) => StateCreator<Store> =
if (!editor) return;
- // Skip save if no changes
- if (!isDirty && currentDocId && !currentDocId.startsWith('temp-document-')) {
+ // Skip save if no changes (unless force is true)
+ if (
+ !options?.force &&
+ !isDirty &&
+ currentDocId &&
+ !currentDocId.startsWith('temp-document-')
+ ) {
return;
}
diff --git a/src/locales/default/chat.ts b/src/locales/default/chat.ts
index c40695a8da7..3537c2f08ba 100644
--- a/src/locales/default/chat.ts
+++ b/src/locales/default/chat.ts
@@ -324,6 +324,8 @@ export default {
'thread.divider': 'Subtopic',
'thread.threadMessageCount': '{{messageCount}} messages',
'thread.title': 'Subtopic',
+ 'todoProgress.allCompleted': 'All tasks completed',
+ 'todoProgress.title': 'Tasks',
'toggleWideScreen.off': 'Turn off widescreen mode',
'toggleWideScreen.on': 'Turn on widescreen mode',
'tokenDetails.chats': 'Chat Messages',
diff --git a/src/locales/default/plugin.ts b/src/locales/default/plugin.ts
index 1e887fd827d..084da3b2357 100644
--- a/src/locales/default/plugin.ts
+++ b/src/locales/default/plugin.ts
@@ -53,11 +53,17 @@ export default {
'builtins.lobe-group-management.apiName.vote': 'Start vote',
'builtins.lobe-group-management.title': 'Group Coordinator',
'builtins.lobe-gtd.apiName.clearTodos': 'Clear todos',
+ 'builtins.lobe-gtd.apiName.clearTodos.modeAll': 'all',
+ 'builtins.lobe-gtd.apiName.clearTodos.modeCompleted': 'completed',
+ 'builtins.lobe-gtd.apiName.clearTodos.result': 'Clear <mode>{{mode}}</mode> todos',
'builtins.lobe-gtd.apiName.completeTodos': 'Complete todos',
'builtins.lobe-gtd.apiName.createPlan': 'Create plan',
+ 'builtins.lobe-gtd.apiName.createPlan.result': 'Create plan: <goal>{{goal}}</goal>',
'builtins.lobe-gtd.apiName.createTodos': 'Create todos',
'builtins.lobe-gtd.apiName.removeTodos': 'Delete todos',
'builtins.lobe-gtd.apiName.updatePlan': 'Update plan',
+ 'builtins.lobe-gtd.apiName.updatePlan.completed': 'Completed',
+ 'builtins.lobe-gtd.apiName.updatePlan.modified': 'Modified',
'builtins.lobe-gtd.apiName.updateTodos': 'Update todos',
'builtins.lobe-gtd.title': 'Task Tools',
'builtins.lobe-knowledge-base.apiName.readKnowledge': 'Read Library content',
diff --git a/src/store/chat/slices/message/initialState.ts b/src/store/chat/slices/message/initialState.ts
index 410d84cbfe8..b510089a4d8 100644
--- a/src/store/chat/slices/message/initialState.ts
+++ b/src/store/chat/slices/message/initialState.ts
@@ -2,8 +2,6 @@ import { type UIChatMessage } from '@lobechat/types';
import { type ChatGroupAgentItem } from '@/database/schemas/chatGroup';
-import type { SupervisorTodoItem } from './supervisor';
-
export interface ChatMessageState {
activeAgentId: string;
/**
@@ -35,22 +33,6 @@ export interface ChatMessageState {
* Parsed messages for display (includes assistantGroup from conversation-flow)
*/
messagesMap: Record<string, UIChatMessage[]>;
- /**
- * Supervisor decision debounce timers by group ID
- */
- supervisorDebounceTimers: Record<string, number>;
- /**
- * Supervisor decision abort controllers by group ID
- */
- supervisorDecisionAbortControllers: Record<string, AbortController>;
- /**
- * Supervisor decision loading states
- */
- supervisorDecisionLoading: string[];
- /**
- * Supervisor todo list map keyed by session/topic combination
- */
- supervisorTodos: Record<string, SupervisorTodoItem[]>;
}
export const initialMessageState: ChatMessageState = {
@@ -63,8 +45,4 @@ export const initialMessageState: ChatMessageState = {
messageLoadingIds: [],
messagesInit: false,
messagesMap: {},
- supervisorDebounceTimers: {},
- supervisorDecisionAbortControllers: {},
- supervisorDecisionLoading: [],
- supervisorTodos: {},
};
diff --git a/src/store/chat/slices/message/selectors/chat.ts b/src/store/chat/slices/message/selectors/chat.ts
index 1134f1b5c83..b0ccc307fba 100644
--- a/src/store/chat/slices/message/selectors/chat.ts
+++ b/src/store/chat/slices/message/selectors/chat.ts
@@ -78,8 +78,6 @@ export const chatSelectors = {
getMessageById: displayMessageSelectors.getDisplayMessageById,
- getSupervisorTodos: displayMessageSelectors.getSupervisorTodos,
-
getThreadMessageIDs: displayMessageSelectors.getThreadMessageIDs,
getThreadMessages: displayMessageSelectors.getThreadMessages,
@@ -90,8 +88,6 @@ export const chatSelectors = {
isCurrentChatLoaded: displayMessageSelectors.isCurrentDisplayChatLoaded,
- isSupervisorLoading: displayMessageSelectors.isSupervisorLoading,
-
latestMessage: dbMessageSelectors.latestDbMessage,
mainAIChats: displayMessageSelectors.mainAIChats,
diff --git a/src/store/chat/slices/message/selectors/displayMessage.ts b/src/store/chat/slices/message/selectors/displayMessage.ts
index ebfc19c01bf..5ce625d9b72 100644
--- a/src/store/chat/slices/message/selectors/displayMessage.ts
+++ b/src/store/chat/slices/message/selectors/displayMessage.ts
@@ -302,16 +302,6 @@ const findLastMessageId = (id: string) => (s: ChatStoreState) => {
return findLastMessageIdRecursive(message);
};
-// ============= Supervisor Selectors ========== //
-
-const isSupervisorLoading = (groupId: string) => (s: ChatStoreState) =>
- s.supervisorDecisionLoading.includes(groupId);
-
-const getSupervisorTodos = (groupId?: string, topicId?: string | null) => (s: ChatStoreState) => {
- if (!groupId) return [];
- return s.supervisorTodos[messageMapKey({ agentId: groupId, topicId })] || [];
-};
-
// ============= Inbox Selectors ========== //
/**
@@ -331,12 +321,10 @@ export const displayMessageSelectors = {
getDisplayMessageById,
getDisplayMessagesByKey,
getGroupLatestMessageWithoutTools,
- getSupervisorTodos,
getThreadMessageIDs,
getThreadMessages,
inboxActiveTopicDisplayMessages,
isCurrentDisplayChatLoaded,
- isSupervisorLoading,
lastDisplayMessageId,
mainAIChats,
mainAIChatsMessageString,
diff --git a/src/tools/inspectors.ts b/src/tools/inspectors.ts
index 17f5b642843..fd260004fd2 100644
--- a/src/tools/inspectors.ts
+++ b/src/tools/inspectors.ts
@@ -1,3 +1,4 @@
+import { GTDInspectors, GTDManifest } from '@lobechat/builtin-tool-gtd/client';
import { LocalSystemManifest } from '@lobechat/builtin-tool-local-system';
import { PageAgentIdentifier, PageAgentInspectors } from '@lobechat/builtin-tool-page-agent/client';
import { type BuiltinInspector } from '@lobechat/types';
@@ -20,6 +21,7 @@ const BuiltinToolInspectors: Record<string, Record<string, BuiltinInspector>> =
[LocalSystemManifest.identifier]: LocalSystemInspectors as Record<string, BuiltinInspector>,
[PageAgentIdentifier]: PageAgentInspectors as Record<string, BuiltinInspector>,
[WebBrowsingManifest.identifier]: WebBrowsingInspectors as Record<string, BuiltinInspector>,
+ [GTDManifest.identifier]: GTDInspectors as Record<string, BuiltinInspector>,
};
/**