@lobehub/lobehub 2.0.10 → 2.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/Dockerfile +44 -52
- package/changelog/v2.json +9 -0
- package/locales/ar/chat.json +4 -0
- package/locales/ar/models.json +65 -0
- package/locales/bg-BG/chat.json +4 -0
- package/locales/bg-BG/models.json +10 -0
- package/locales/de-DE/chat.json +4 -0
- package/locales/de-DE/models.json +41 -0
- package/locales/en-US/chat.json +4 -0
- package/locales/es-ES/chat.json +4 -0
- package/locales/es-ES/models.json +50 -0
- package/locales/fa-IR/chat.json +4 -0
- package/locales/fa-IR/models.json +39 -0
- package/locales/fr-FR/chat.json +4 -0
- package/locales/fr-FR/models.json +9 -0
- package/locales/it-IT/chat.json +4 -0
- package/locales/it-IT/models.json +62 -0
- package/locales/ja-JP/chat.json +4 -0
- package/locales/ja-JP/models.json +40 -0
- package/locales/ko-KR/chat.json +4 -0
- package/locales/ko-KR/models.json +31 -0
- package/locales/nl-NL/chat.json +4 -0
- package/locales/nl-NL/models.json +52 -0
- package/locales/pl-PL/chat.json +4 -0
- package/locales/pl-PL/models.json +43 -0
- package/locales/pt-BR/chat.json +4 -0
- package/locales/pt-BR/models.json +92 -0
- package/locales/ru-RU/chat.json +4 -0
- package/locales/ru-RU/models.json +34 -0
- package/locales/tr-TR/chat.json +4 -0
- package/locales/tr-TR/models.json +55 -0
- package/locales/vi-VN/chat.json +4 -0
- package/locales/vi-VN/models.json +31 -0
- package/locales/zh-CN/chat.json +4 -0
- package/locales/zh-TW/chat.json +4 -0
- package/package.json +1 -1
- package/packages/agent-runtime/src/groupOrchestration/GroupOrchestrationSupervisor.ts +18 -1
- package/packages/agent-runtime/src/groupOrchestration/__tests__/GroupOrchestrationSupervisor.test.ts +76 -5
- package/packages/agent-runtime/src/groupOrchestration/types.ts +3 -3
- package/packages/builtin-tool-group-management/src/client/Intervention/ExecuteTask.tsx +11 -11
- package/packages/builtin-tool-group-management/src/client/Intervention/ExecuteTasks.tsx +78 -79
- package/packages/builtin-tool-group-management/src/client/Render/ExecuteTask/index.tsx +3 -3
- package/packages/builtin-tool-group-management/src/client/Render/ExecuteTasks/index.tsx +61 -63
- package/packages/builtin-tool-group-management/src/client/Streaming/ExecuteTask/index.tsx +3 -3
- package/packages/builtin-tool-group-management/src/executor.test.ts +7 -9
- package/packages/builtin-tool-group-management/src/executor.ts +3 -3
- package/packages/builtin-tool-group-management/src/manifest.ts +49 -50
- package/packages/builtin-tool-group-management/src/systemRole.ts +153 -5
- package/packages/builtin-tool-group-management/src/types.ts +3 -2
- package/packages/builtin-tool-gtd/src/systemRole.ts +4 -4
- package/packages/context-engine/src/processors/TasksFlatten.ts +7 -5
- package/packages/context-engine/src/processors/__tests__/TasksFlatten.test.ts +164 -0
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/agentGroup/index.ts +4 -0
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/agentGroup/supervisor-after-multi-tasks.json +91 -0
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/agentGroup/supervisor-content-only.json +74 -0
- package/packages/conversation-flow/src/__tests__/parse.test.ts +37 -0
- package/packages/conversation-flow/src/transformation/FlatListBuilder.ts +70 -4
- package/packages/conversation-flow/src/transformation/__tests__/FlatListBuilder.test.ts +147 -0
- package/packages/types/src/message/ui/chat.ts +2 -0
- package/packages/types/src/tool/builtin.ts +5 -5
- package/src/features/Conversation/ChatItem/components/Title.tsx +1 -1
- package/src/features/Conversation/ChatList/index.tsx +0 -1
- package/src/features/Conversation/Messages/GroupTasks/TaskItem/ClientTaskItem.tsx +183 -0
- package/src/features/Conversation/Messages/GroupTasks/TaskItem/ServerTaskItem.tsx +94 -0
- package/src/features/Conversation/Messages/GroupTasks/TaskItem/TaskTitle.tsx +177 -0
- package/src/features/Conversation/Messages/GroupTasks/TaskItem/index.tsx +26 -0
- package/src/features/Conversation/Messages/GroupTasks/TaskItem/useClientTaskStats.ts +93 -0
- package/src/features/Conversation/Messages/GroupTasks/index.tsx +151 -0
- package/src/features/Conversation/Messages/Supervisor/index.tsx +7 -1
- package/src/features/Conversation/Messages/Task/ClientTaskDetail/index.tsx +72 -91
- package/src/features/Conversation/Messages/Task/TaskDetailPanel/StatusContent.tsx +46 -17
- package/src/features/Conversation/Messages/Tasks/TaskItem/ClientTaskItem.tsx +9 -24
- package/src/features/Conversation/Messages/Tasks/TaskItem/ServerTaskItem.tsx +18 -38
- package/src/features/Conversation/Messages/Tasks/shared/ErrorState.tsx +45 -2
- package/src/features/Conversation/Messages/Tasks/shared/InitializingState.tsx +16 -1
- package/src/features/Conversation/Messages/Tasks/shared/TaskContent.tsx +68 -0
- package/src/features/Conversation/Messages/Tasks/shared/TaskMessages.tsx +383 -0
- package/src/features/Conversation/Messages/Tasks/shared/index.ts +4 -0
- package/src/features/Conversation/Messages/Tasks/shared/useTaskPolling.ts +48 -0
- package/src/features/Conversation/Messages/index.tsx +5 -0
- package/src/locales/default/chat.ts +4 -0
- package/src/server/modules/AgentRuntime/RuntimeExecutors.ts +4 -0
- package/src/server/modules/AgentRuntime/__tests__/RuntimeExecutors.test.ts +106 -1
- package/src/server/services/aiAgent/__tests__/execAgent.threadId.test.ts +2 -2
- package/src/server/utils/truncateToolResult.ts +1 -4
- package/src/store/chat/agents/GroupOrchestration/__tests__/batch-exec-async-tasks.test.ts +15 -15
- package/src/store/chat/agents/GroupOrchestration/createGroupOrchestrationExecutors.ts +22 -15
- package/src/store/chat/agents/__tests__/createAgentExecutors/exec-tasks.test.ts +21 -10
- package/src/store/chat/agents/createAgentExecutors.ts +2 -0
- package/src/store/chat/slices/aiAgent/actions/groupOrchestration.ts +10 -7
- package/src/features/Conversation/Messages/Task/ClientTaskDetail/CompletedState.tsx +0 -108
- package/src/features/Conversation/Messages/Task/ClientTaskDetail/InstructionAccordion.tsx +0 -63
- package/src/features/Conversation/Messages/Task/ClientTaskDetail/ProcessingState.tsx +0 -123
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { Accordion, AccordionItem, Block, Flexbox, Icon, Markdown, Text } from '@lobehub/ui';
|
|
2
|
-
import { cssVar } from 'antd-style';
|
|
3
|
-
import { ScrollText } from 'lucide-react';
|
|
4
|
-
import { memo, useEffect, useState } from 'react';
|
|
5
|
-
import { useTranslation } from 'react-i18next';
|
|
6
|
-
|
|
7
|
-
interface InstructionAccordionProps {
|
|
8
|
-
childrenCount: number;
|
|
9
|
-
instruction: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const InstructionAccordion = memo<InstructionAccordionProps>(({ instruction, childrenCount }) => {
|
|
13
|
-
const { t } = useTranslation('chat');
|
|
14
|
-
|
|
15
|
-
// Auto-collapse instruction when children count exceeds threshold
|
|
16
|
-
const [expandedKeys, setExpandedKeys] = useState<string[]>(['instruction']);
|
|
17
|
-
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
if (childrenCount > 1) {
|
|
20
|
-
setExpandedKeys([]);
|
|
21
|
-
}
|
|
22
|
-
}, [childrenCount > 1]);
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<Accordion
|
|
26
|
-
expandedKeys={expandedKeys}
|
|
27
|
-
gap={8}
|
|
28
|
-
onExpandedChange={(keys) => setExpandedKeys(keys as string[])}
|
|
29
|
-
>
|
|
30
|
-
<AccordionItem
|
|
31
|
-
itemKey="instruction"
|
|
32
|
-
paddingBlock={4}
|
|
33
|
-
paddingInline={4}
|
|
34
|
-
title={
|
|
35
|
-
<Flexbox align="center" gap={8} horizontal>
|
|
36
|
-
<Block
|
|
37
|
-
align="center"
|
|
38
|
-
flex="none"
|
|
39
|
-
gap={4}
|
|
40
|
-
height={24}
|
|
41
|
-
horizontal
|
|
42
|
-
justify="center"
|
|
43
|
-
style={{ fontSize: 12 }}
|
|
44
|
-
variant="outlined"
|
|
45
|
-
width={24}
|
|
46
|
-
>
|
|
47
|
-
<Icon color={cssVar.colorTextSecondary} icon={ScrollText} />
|
|
48
|
-
</Block>
|
|
49
|
-
<Text as="span" type="secondary">
|
|
50
|
-
{t('task.instruction')}
|
|
51
|
-
</Text>
|
|
52
|
-
</Flexbox>
|
|
53
|
-
}
|
|
54
|
-
>
|
|
55
|
-
<Block padding={12} style={{ marginBlock: 8, maxHeight: 300, overflow: 'auto' }} variant={'outlined'}>
|
|
56
|
-
<Markdown variant={'chat'}>{instruction}</Markdown>
|
|
57
|
-
</Block>
|
|
58
|
-
</AccordionItem>
|
|
59
|
-
</Accordion>
|
|
60
|
-
);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
export default InstructionAccordion;
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { type AssistantContentBlock } from '@lobechat/types';
|
|
4
|
-
import { Block, Flexbox, ScrollShadow, Text } from '@lobehub/ui';
|
|
5
|
-
import { createStaticStyles } from 'antd-style';
|
|
6
|
-
import { type RefObject, memo, useEffect, useMemo, useState } from 'react';
|
|
7
|
-
import { useTranslation } from 'react-i18next';
|
|
8
|
-
|
|
9
|
-
import NeuralNetworkLoading from '@/components/NeuralNetworkLoading';
|
|
10
|
-
import AnimatedNumber from '@/features/Conversation/Messages/components/Extras/Usage/UsageDetail/AnimatedNumber';
|
|
11
|
-
import { useAutoScroll } from '@/hooks/useAutoScroll';
|
|
12
|
-
|
|
13
|
-
import ContentBlock from '../../AssistantGroup/components/ContentBlock';
|
|
14
|
-
import { accumulateUsage, formatElapsedTime } from '../../Tasks/shared/utils';
|
|
15
|
-
import Usage from '../../components/Extras/Usage';
|
|
16
|
-
|
|
17
|
-
const styles = createStaticStyles(({ css }) => ({
|
|
18
|
-
contentScroll: css`
|
|
19
|
-
max-height: min(50vh, 300px);
|
|
20
|
-
`,
|
|
21
|
-
}));
|
|
22
|
-
|
|
23
|
-
interface ProcessingStateProps {
|
|
24
|
-
assistantId: string;
|
|
25
|
-
blocks: AssistantContentBlock[];
|
|
26
|
-
model?: string;
|
|
27
|
-
provider?: string;
|
|
28
|
-
startTime?: number;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const ProcessingState = memo<ProcessingStateProps>(
|
|
32
|
-
({ blocks, assistantId, startTime, model, provider }) => {
|
|
33
|
-
const { t } = useTranslation('chat');
|
|
34
|
-
const [elapsedTime, setElapsedTime] = useState(0);
|
|
35
|
-
const { ref, handleScroll } = useAutoScroll<HTMLDivElement>({
|
|
36
|
-
deps: [blocks],
|
|
37
|
-
enabled: true,
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
const totalToolCalls = useMemo(
|
|
41
|
-
() => blocks.reduce((sum, block) => sum + (block.tools?.length || 0), 0),
|
|
42
|
-
[blocks],
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
// Accumulate usage from all blocks
|
|
46
|
-
const accumulatedUsage = useMemo(() => accumulateUsage(blocks), [blocks]);
|
|
47
|
-
|
|
48
|
-
// Calculate initial elapsed time
|
|
49
|
-
useEffect(() => {
|
|
50
|
-
if (startTime) {
|
|
51
|
-
setElapsedTime(Math.max(0, Date.now() - startTime));
|
|
52
|
-
}
|
|
53
|
-
}, [startTime]);
|
|
54
|
-
|
|
55
|
-
// Timer for updating elapsed time every second
|
|
56
|
-
useEffect(() => {
|
|
57
|
-
if (!startTime) return;
|
|
58
|
-
|
|
59
|
-
const timer = setInterval(() => {
|
|
60
|
-
setElapsedTime(Math.max(0, Date.now() - startTime));
|
|
61
|
-
}, 1000);
|
|
62
|
-
|
|
63
|
-
return () => clearInterval(timer);
|
|
64
|
-
}, [startTime]);
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
<Flexbox gap={8}>
|
|
68
|
-
<Flexbox align="center" gap={8} horizontal paddingInline={4}>
|
|
69
|
-
<Block
|
|
70
|
-
align="center"
|
|
71
|
-
flex="none"
|
|
72
|
-
gap={4}
|
|
73
|
-
height={24}
|
|
74
|
-
horizontal
|
|
75
|
-
justify="center"
|
|
76
|
-
style={{ fontSize: 12 }}
|
|
77
|
-
variant="outlined"
|
|
78
|
-
width={24}
|
|
79
|
-
>
|
|
80
|
-
<NeuralNetworkLoading size={16} />
|
|
81
|
-
</Block>
|
|
82
|
-
<Flexbox align="center" gap={4} horizontal>
|
|
83
|
-
<Text as="span" type="secondary" weight={500}>
|
|
84
|
-
<AnimatedNumber
|
|
85
|
-
duration={500}
|
|
86
|
-
formatter={(v) => Math.round(v).toString()}
|
|
87
|
-
value={totalToolCalls}
|
|
88
|
-
/>
|
|
89
|
-
</Text>
|
|
90
|
-
<Text as="span" type="secondary">
|
|
91
|
-
{t('task.metrics.toolCallsShort')}
|
|
92
|
-
</Text>
|
|
93
|
-
{startTime && (
|
|
94
|
-
<Text as="span" type="secondary">
|
|
95
|
-
({formatElapsedTime(elapsedTime)})
|
|
96
|
-
</Text>
|
|
97
|
-
)}
|
|
98
|
-
</Flexbox>
|
|
99
|
-
</Flexbox>
|
|
100
|
-
<ScrollShadow
|
|
101
|
-
className={styles.contentScroll}
|
|
102
|
-
offset={12}
|
|
103
|
-
onScroll={handleScroll}
|
|
104
|
-
ref={ref as RefObject<HTMLDivElement>}
|
|
105
|
-
size={8}
|
|
106
|
-
>
|
|
107
|
-
<Flexbox gap={8}>
|
|
108
|
-
{blocks.map((block) => (
|
|
109
|
-
<ContentBlock {...block} assistantId={assistantId} disableEditing key={block.id} />
|
|
110
|
-
))}
|
|
111
|
-
</Flexbox>
|
|
112
|
-
</ScrollShadow>
|
|
113
|
-
|
|
114
|
-
{/* Usage display */}
|
|
115
|
-
{model && provider && <Usage model={model} provider={provider} usage={accumulatedUsage} />}
|
|
116
|
-
</Flexbox>
|
|
117
|
-
);
|
|
118
|
-
},
|
|
119
|
-
);
|
|
120
|
-
|
|
121
|
-
ProcessingState.displayName = 'ClientProcessingState';
|
|
122
|
-
|
|
123
|
-
export default ProcessingState;
|