@lobehub/lobehub 2.0.0-next.295 → 2.0.0-next.296
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/changelog/v1.json +9 -0
- package/locales/en-US/plugin.json +4 -0
- package/locales/zh-CN/plugin.json +4 -0
- package/package.json +1 -1
- package/packages/agent-runtime/src/core/__tests__/runtime.test.ts +5 -5
- package/packages/agent-runtime/src/utils/stepContextComputer.test.ts +5 -5
- package/packages/builtin-tool-gtd/src/client/Inspector/index.ts +0 -4
- package/packages/builtin-tool-gtd/src/client/Intervention/AddTodo.tsx +1 -1
- package/packages/builtin-tool-gtd/src/client/Render/TodoList/index.tsx +39 -10
- package/packages/builtin-tool-gtd/src/client/Render/index.ts +0 -2
- package/packages/builtin-tool-gtd/src/client/components/SortableTodoList/TodoItemRow.tsx +26 -12
- package/packages/builtin-tool-gtd/src/client/components/SortableTodoList/store/actions.ts +5 -5
- package/packages/builtin-tool-gtd/src/client/components/SortableTodoList/store/store.test.ts +14 -8
- package/packages/builtin-tool-gtd/src/executor/index.test.ts +48 -227
- package/packages/builtin-tool-gtd/src/executor/index.ts +15 -158
- package/packages/builtin-tool-gtd/src/manifest.ts +12 -42
- package/packages/builtin-tool-gtd/src/systemRole.ts +14 -8
- package/packages/builtin-tool-gtd/src/types.ts +47 -41
- package/packages/builtin-tool-memory/package.json +8 -0
- package/packages/builtin-tool-memory/src/client/Inspector/AddContextMemory/index.tsx +60 -0
- package/packages/builtin-tool-memory/src/client/Inspector/AddExperienceMemory/index.tsx +60 -0
- package/packages/builtin-tool-memory/src/client/Inspector/AddIdentityMemory/index.tsx +60 -0
- package/packages/builtin-tool-memory/src/client/Inspector/AddPreferenceMemory/index.tsx +60 -0
- package/packages/builtin-tool-memory/src/client/Inspector/RemoveIdentityMemory/index.tsx +60 -0
- package/packages/builtin-tool-memory/src/client/Inspector/SearchUserMemory/index.tsx +67 -0
- package/packages/builtin-tool-memory/src/client/Inspector/UpdateIdentityMemory/index.tsx +60 -0
- package/packages/builtin-tool-memory/src/client/Inspector/index.ts +35 -0
- package/packages/builtin-tool-memory/src/client/Intervention/AddExperienceMemory/index.tsx +17 -0
- package/packages/builtin-tool-memory/src/client/Intervention/index.ts +13 -0
- package/packages/builtin-tool-memory/src/client/Render/AddExperienceMemory/index.tsx +17 -0
- package/packages/builtin-tool-memory/src/client/Render/SearchUserMemory/index.tsx +217 -0
- package/packages/builtin-tool-memory/src/client/Render/index.ts +15 -0
- package/packages/builtin-tool-memory/src/client/Streaming/AddExperienceMemory/index.tsx +17 -0
- package/packages/builtin-tool-memory/src/client/Streaming/index.ts +18 -0
- package/packages/builtin-tool-memory/src/client/components/ExperienceMemoryCard.tsx +231 -0
- package/packages/builtin-tool-memory/src/client/components/index.ts +1 -0
- package/packages/builtin-tool-memory/src/client/index.ts +27 -0
- package/packages/builtin-tool-memory/src/executor/index.ts +9 -1
- package/packages/builtin-tool-memory/src/types.ts +61 -0
- package/packages/context-engine/src/providers/GTDTodoInjector.ts +15 -7
- package/packages/conversation-flow/src/__tests__/fixtures/outputs/assistantGroup/tools-with-branches.json +4 -0
- package/packages/conversation-flow/src/transformation/FlatListBuilder.ts +1 -0
- package/packages/prompts/src/prompts/gtd/index.test.ts +32 -16
- package/packages/prompts/src/prompts/gtd/index.ts +9 -5
- package/packages/types/src/stepContext.ts +4 -1
- package/src/app/[variants]/(main)/community/(detail)/assistant/features/Details/Versions/index.tsx +2 -2
- package/src/app/[variants]/(main)/community/features/Search.tsx +1 -1
- package/src/app/[variants]/(main)/resource/features/DndContextWrapper.tsx +4 -2
- package/src/app/[variants]/(main)/resource/library/_layout/Header/LibraryHead.tsx +30 -35
- package/src/app/[variants]/(main)/resource/library/_layout/Header/index.tsx +9 -11
- package/src/features/Conversation/Messages/AssistantGroup/Tool/Actions/index.tsx +11 -17
- package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/LoadingPlaceholder/index.tsx +13 -3
- package/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Render/CustomRender.tsx +43 -0
- package/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Render/FallbacktArgumentRender.tsx +59 -0
- package/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Render/index.tsx +46 -0
- package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/index.tsx +13 -19
- package/src/features/Conversation/Messages/AssistantGroup/Tool/index.tsx +17 -17
- package/src/features/Conversation/Messages/Tool/Tool/index.tsx +10 -9
- package/src/features/Conversation/TodoProgress/index.tsx +56 -23
- package/src/features/PluginsUI/Render/MCPType/index.tsx +1 -1
- package/src/features/ResourceManager/components/Explorer/Header/index.tsx +57 -4
- package/src/features/ResourceManager/components/Explorer/ListView/ListItem/index.tsx +6 -4
- package/src/features/ResourceManager/components/Explorer/ListView/index.tsx +16 -5
- package/src/features/ResourceManager/components/LibraryHierarchy/styles.ts +5 -4
- package/src/hooks/useActiveTabKey.ts +1 -2
- package/src/locales/default/plugin.ts +1 -0
- package/src/store/chat/slices/message/selectors/dbMessage.test.ts +11 -11
- package/src/store/file/slices/resource/action.ts +4 -2
- package/src/tools/inspectors.ts +2 -0
- package/src/tools/interventions.ts +2 -0
- package/src/tools/renders.ts +3 -1
- package/src/tools/streamings.ts +2 -0
- package/packages/builtin-tool-gtd/src/client/Inspector/CompleteTodos/index.tsx +0 -52
- package/packages/builtin-tool-gtd/src/client/Inspector/RemoveTodos/index.tsx +0 -52
- package/src/features/Conversation/Messages/AssistantGroup/Tool/Render/CustomRender.tsx +0 -113
- package/src/features/Conversation/Messages/Tool/Tool/Render.tsx +0 -47
- /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/AbortResponse.tsx +0 -0
- /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/Arguments/index.tsx +0 -0
- /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/ErrorResponse.tsx +0 -0
- /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/Intervention/ApprovalActions.tsx +0 -0
- /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/Intervention/Fallback.tsx +0 -0
- /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/Intervention/KeyValueEditor.tsx +0 -0
- /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/Intervention/ModeSelector.tsx +0 -0
- /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/Intervention/index.tsx +0 -0
- /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/PluginSettings.tsx +0 -0
- /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/RejectedResponse.tsx +0 -0
|
@@ -34,7 +34,7 @@ const styles = createStaticStyles(({ css }) => ({
|
|
|
34
34
|
`,
|
|
35
35
|
dropZoneActive: css`
|
|
36
36
|
background: ${cssVar.colorPrimaryBg};
|
|
37
|
-
outline:
|
|
37
|
+
outline: 1px dashed ${cssVar.colorPrimaryBorder};
|
|
38
38
|
outline-offset: -4px;
|
|
39
39
|
`,
|
|
40
40
|
header: css`
|
|
@@ -330,9 +330,15 @@ const ListView = memo(function ListView() {
|
|
|
330
330
|
|
|
331
331
|
// Memoize footer component to show skeleton loaders when loading more
|
|
332
332
|
const Footer = useCallback(() => {
|
|
333
|
-
if (
|
|
334
|
-
|
|
335
|
-
|
|
333
|
+
if (isLoadingMore && fileListHasMore) return <ListViewSkeleton columnWidths={columnWidths} />;
|
|
334
|
+
|
|
335
|
+
// Leave some padding at the end when there are no more pages,
|
|
336
|
+
// so users can clearly feel they've reached the end of the list.
|
|
337
|
+
if (fileListHasMore === false && dataLength > 0)
|
|
338
|
+
return <div aria-hidden style={{ height: 96 }} />;
|
|
339
|
+
|
|
340
|
+
return null;
|
|
341
|
+
}, [columnWidths, dataLength, fileListHasMore, isLoadingMore]);
|
|
336
342
|
|
|
337
343
|
if (showSkeleton) return <ListViewSkeleton columnWidths={columnWidths} />;
|
|
338
344
|
|
|
@@ -369,7 +375,12 @@ const ListView = memo(function ListView() {
|
|
|
369
375
|
width: columnWidths.name,
|
|
370
376
|
}}
|
|
371
377
|
>
|
|
372
|
-
{
|
|
378
|
+
{selectFileIds.length > 0
|
|
379
|
+
? t('FileManager.total.selectedCount', {
|
|
380
|
+
count: selectFileIds.length,
|
|
381
|
+
ns: 'components',
|
|
382
|
+
})
|
|
383
|
+
: t('FileManager.title.title')}
|
|
373
384
|
<ColumnResizeHandle
|
|
374
385
|
column="name"
|
|
375
386
|
currentWidth={columnWidths.name}
|
|
@@ -6,11 +6,12 @@ export const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
|
6
6
|
opacity: 0.5;
|
|
7
7
|
`,
|
|
8
8
|
fileItemDragOver: css`
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
outline: 1px dashed ${cssVar.colorPrimaryBorder};
|
|
10
|
+
outline-offset: -2px;
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
&,
|
|
13
|
+
&:hover {
|
|
14
|
+
background: ${cssVar.colorPrimaryBg};
|
|
14
15
|
}
|
|
15
16
|
`,
|
|
16
17
|
treeItem: css`
|
|
@@ -174,6 +174,7 @@ export default {
|
|
|
174
174
|
'builtins.lobe-user-memory.apiName.removeIdentityMemory': 'Delete identity memory',
|
|
175
175
|
'builtins.lobe-user-memory.apiName.searchUserMemory': 'Search memory',
|
|
176
176
|
'builtins.lobe-user-memory.apiName.updateIdentityMemory': 'Update identity memory',
|
|
177
|
+
'builtins.lobe-user-memory.inspector.noResults': 'No results',
|
|
177
178
|
'builtins.lobe-user-memory.title': 'Memory',
|
|
178
179
|
'builtins.lobe-web-browsing.apiName.crawlMultiPages': 'Read multiple pages',
|
|
179
180
|
'builtins.lobe-web-browsing.apiName.crawlSinglePage': 'Read page content',
|
|
@@ -5,7 +5,7 @@ import { selectTodosFromMessages } from './dbMessage';
|
|
|
5
5
|
|
|
6
6
|
describe('selectTodosFromMessages', () => {
|
|
7
7
|
const createGTDToolMessage = (todos: {
|
|
8
|
-
items: Array<{ text: string;
|
|
8
|
+
items: Array<{ text: string; status: 'todo' | 'processing' | 'completed' }>;
|
|
9
9
|
updatedAt: string;
|
|
10
10
|
}): UIChatMessage =>
|
|
11
11
|
({
|
|
@@ -30,7 +30,7 @@ describe('selectTodosFromMessages', () => {
|
|
|
30
30
|
content: 'Create a todo list',
|
|
31
31
|
} as UIChatMessage,
|
|
32
32
|
createGTDToolMessage({
|
|
33
|
-
items: [{ text: 'Buy milk',
|
|
33
|
+
items: [{ text: 'Buy milk', status: 'todo' }],
|
|
34
34
|
updatedAt: '2024-06-01T00:00:00.000Z',
|
|
35
35
|
}),
|
|
36
36
|
];
|
|
@@ -40,13 +40,13 @@ describe('selectTodosFromMessages', () => {
|
|
|
40
40
|
expect(result).toBeDefined();
|
|
41
41
|
expect(result?.items).toHaveLength(1);
|
|
42
42
|
expect(result?.items[0].text).toBe('Buy milk');
|
|
43
|
-
expect(result?.items[0].
|
|
43
|
+
expect(result?.items[0].status).toBe('todo');
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
it('should return the most recent todos when multiple GTD messages exist', () => {
|
|
47
47
|
const messages: UIChatMessage[] = [
|
|
48
48
|
createGTDToolMessage({
|
|
49
|
-
items: [{ text: 'Old task',
|
|
49
|
+
items: [{ text: 'Old task', status: 'todo' }],
|
|
50
50
|
updatedAt: '2024-01-01T00:00:00.000Z',
|
|
51
51
|
}),
|
|
52
52
|
{
|
|
@@ -56,8 +56,8 @@ describe('selectTodosFromMessages', () => {
|
|
|
56
56
|
} as UIChatMessage,
|
|
57
57
|
createGTDToolMessage({
|
|
58
58
|
items: [
|
|
59
|
-
{ text: 'Old task',
|
|
60
|
-
{ text: 'New task',
|
|
59
|
+
{ text: 'Old task', status: 'completed' },
|
|
60
|
+
{ text: 'New task', status: 'todo' },
|
|
61
61
|
],
|
|
62
62
|
updatedAt: '2024-06-01T00:00:00.000Z',
|
|
63
63
|
}),
|
|
@@ -69,7 +69,7 @@ describe('selectTodosFromMessages', () => {
|
|
|
69
69
|
expect(result?.items).toHaveLength(2);
|
|
70
70
|
// Should be from the latest message
|
|
71
71
|
expect(result?.items[0].text).toBe('Old task');
|
|
72
|
-
expect(result?.items[0].
|
|
72
|
+
expect(result?.items[0].status).toBe('completed');
|
|
73
73
|
expect(result?.items[1].text).toBe('New task');
|
|
74
74
|
});
|
|
75
75
|
|
|
@@ -155,7 +155,7 @@ describe('selectTodosFromMessages', () => {
|
|
|
155
155
|
},
|
|
156
156
|
pluginState: {
|
|
157
157
|
todos: {
|
|
158
|
-
items: [{ text: 'Task',
|
|
158
|
+
items: [{ text: 'Task', status: 'todo' }],
|
|
159
159
|
// No updatedAt
|
|
160
160
|
},
|
|
161
161
|
},
|
|
@@ -184,8 +184,8 @@ describe('selectTodosFromMessages', () => {
|
|
|
184
184
|
pluginState: {
|
|
185
185
|
// Legacy format: direct array
|
|
186
186
|
todos: [
|
|
187
|
-
{ text: 'Task 1',
|
|
188
|
-
{ text: 'Task 2',
|
|
187
|
+
{ text: 'Task 1', status: 'todo' },
|
|
188
|
+
{ text: 'Task 2', status: 'completed' },
|
|
189
189
|
],
|
|
190
190
|
},
|
|
191
191
|
} as unknown as UIChatMessage,
|
|
@@ -196,6 +196,6 @@ describe('selectTodosFromMessages', () => {
|
|
|
196
196
|
expect(result).toBeDefined();
|
|
197
197
|
expect(result?.items).toHaveLength(2);
|
|
198
198
|
expect(result?.items[0].text).toBe('Task 1');
|
|
199
|
-
expect(result?.items[1].
|
|
199
|
+
expect(result?.items[1].status).toBe('completed');
|
|
200
200
|
});
|
|
201
201
|
});
|
|
@@ -239,9 +239,11 @@ export const createResourceSlice: StateCreator<
|
|
|
239
239
|
'deleteResource/optimistic',
|
|
240
240
|
);
|
|
241
241
|
|
|
242
|
-
// 2. Enqueue sync
|
|
242
|
+
// 2. Enqueue sync and await completion.
|
|
243
|
+
// Important: if callers revalidate the list immediately, doing so before the server-side
|
|
244
|
+
// deletion finishes can re-introduce the item from a still-stale query response.
|
|
243
245
|
const syncEngine = getSyncEngine();
|
|
244
|
-
syncEngine.enqueue({
|
|
246
|
+
await syncEngine.enqueue({
|
|
245
247
|
id: `sync-${id}-${Date.now()}`,
|
|
246
248
|
payload: {},
|
|
247
249
|
resourceId: id,
|
package/src/tools/inspectors.ts
CHANGED
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
LocalSystemInspectors,
|
|
24
24
|
LocalSystemManifest,
|
|
25
25
|
} from '@lobechat/builtin-tool-local-system/client';
|
|
26
|
+
import { MemoryInspectors, MemoryManifest } from '@lobechat/builtin-tool-memory/client';
|
|
26
27
|
import { NotebookInspectors, NotebookManifest } from '@lobechat/builtin-tool-notebook/client';
|
|
27
28
|
import { PageAgentInspectors, PageAgentManifest } from '@lobechat/builtin-tool-page-agent/client';
|
|
28
29
|
import {
|
|
@@ -52,6 +53,7 @@ const BuiltinToolInspectors: Record<string, Record<string, BuiltinInspector>> =
|
|
|
52
53
|
[GTDManifest.identifier]: GTDInspectors as Record<string, BuiltinInspector>,
|
|
53
54
|
[KnowledgeBaseManifest.identifier]: KnowledgeBaseInspectors as Record<string, BuiltinInspector>,
|
|
54
55
|
[LocalSystemManifest.identifier]: LocalSystemInspectors as Record<string, BuiltinInspector>,
|
|
56
|
+
[MemoryManifest.identifier]: MemoryInspectors as Record<string, BuiltinInspector>,
|
|
55
57
|
[NotebookManifest.identifier]: NotebookInspectors as Record<string, BuiltinInspector>,
|
|
56
58
|
[PageAgentManifest.identifier]: PageAgentInspectors as Record<string, BuiltinInspector>,
|
|
57
59
|
[WebBrowsingManifest.identifier]: WebBrowsingInspectors as Record<string, BuiltinInspector>,
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
LocalSystemIdentifier,
|
|
14
14
|
LocalSystemInterventions,
|
|
15
15
|
} from '@lobechat/builtin-tool-local-system/client';
|
|
16
|
+
import { MemoryInterventions, MemoryManifest } from '@lobechat/builtin-tool-memory/client';
|
|
16
17
|
import { NotebookManifest } from '@lobechat/builtin-tool-notebook';
|
|
17
18
|
import { NotebookInterventions } from '@lobechat/builtin-tool-notebook/client';
|
|
18
19
|
import { type BuiltinIntervention } from '@lobechat/types';
|
|
@@ -28,6 +29,7 @@ export const BuiltinToolInterventions: Record<string, Record<string, any>> = {
|
|
|
28
29
|
[GroupManagementManifest.identifier]: GroupManagementInterventions,
|
|
29
30
|
[GTDManifest.identifier]: GTDInterventions,
|
|
30
31
|
[LocalSystemIdentifier]: LocalSystemInterventions,
|
|
32
|
+
[MemoryManifest.identifier]: MemoryInterventions,
|
|
31
33
|
[NotebookManifest.identifier]: NotebookInterventions,
|
|
32
34
|
};
|
|
33
35
|
|
package/src/tools/renders.ts
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
LocalSystemManifest,
|
|
16
16
|
LocalSystemRenders,
|
|
17
17
|
} from '@lobechat/builtin-tool-local-system/client';
|
|
18
|
+
import { MemoryManifest, MemoryRenders } from '@lobechat/builtin-tool-memory/client';
|
|
18
19
|
import { NotebookManifest, NotebookRenders } from '@lobechat/builtin-tool-notebook/client';
|
|
19
20
|
import {
|
|
20
21
|
WebBrowsingManifest,
|
|
@@ -32,9 +33,10 @@ const BuiltinToolsRenders: Record<string, Record<string, BuiltinRender>> = {
|
|
|
32
33
|
[GroupAgentBuilderManifest.identifier]: GroupAgentBuilderRenders as Record<string, BuiltinRender>,
|
|
33
34
|
[GroupManagementManifest.identifier]: GroupManagementRenders as Record<string, BuiltinRender>,
|
|
34
35
|
[GTDManifest.identifier]: GTDRenders as Record<string, BuiltinRender>,
|
|
35
|
-
[NotebookManifest.identifier]: NotebookRenders as Record<string, BuiltinRender>,
|
|
36
36
|
[KnowledgeBaseManifest.identifier]: KnowledgeBaseRenders as Record<string, BuiltinRender>,
|
|
37
37
|
[LocalSystemManifest.identifier]: LocalSystemRenders as Record<string, BuiltinRender>,
|
|
38
|
+
[MemoryManifest.identifier]: MemoryRenders as Record<string, BuiltinRender>,
|
|
39
|
+
[NotebookManifest.identifier]: NotebookRenders as Record<string, BuiltinRender>,
|
|
38
40
|
[WebBrowsingManifest.identifier]: WebBrowsingRenders as Record<string, BuiltinRender>,
|
|
39
41
|
};
|
|
40
42
|
|
package/src/tools/streamings.ts
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
LocalSystemManifest,
|
|
16
16
|
LocalSystemStreamings,
|
|
17
17
|
} from '@lobechat/builtin-tool-local-system/client';
|
|
18
|
+
import { MemoryManifest, MemoryStreamings } from '@lobechat/builtin-tool-memory/client';
|
|
18
19
|
import { NotebookManifest, NotebookStreamings } from '@lobechat/builtin-tool-notebook/client';
|
|
19
20
|
import { type BuiltinStreaming } from '@lobechat/types';
|
|
20
21
|
|
|
@@ -38,6 +39,7 @@ const BuiltinToolStreamings: Record<string, Record<string, BuiltinStreaming>> =
|
|
|
38
39
|
>,
|
|
39
40
|
[GTDManifest.identifier]: GTDStreamings as Record<string, BuiltinStreaming>,
|
|
40
41
|
[LocalSystemManifest.identifier]: LocalSystemStreamings as Record<string, BuiltinStreaming>,
|
|
42
|
+
[MemoryManifest.identifier]: MemoryStreamings as Record<string, BuiltinStreaming>,
|
|
41
43
|
[NotebookManifest.identifier]: NotebookStreamings as Record<string, BuiltinStreaming>,
|
|
42
44
|
};
|
|
43
45
|
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import type { BuiltinInspectorProps } from '@lobechat/types';
|
|
4
|
-
import { Icon, Text } from '@lobehub/ui';
|
|
5
|
-
import { createStaticStyles, cssVar, cx } from 'antd-style';
|
|
6
|
-
import { CheckCircle } from 'lucide-react';
|
|
7
|
-
import { memo } from 'react';
|
|
8
|
-
import { useTranslation } from 'react-i18next';
|
|
9
|
-
|
|
10
|
-
import { oneLineEllipsis, shinyTextStyles } from '@/styles';
|
|
11
|
-
|
|
12
|
-
import type { CompleteTodosParams, CompleteTodosState } from '../../../types';
|
|
13
|
-
|
|
14
|
-
const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
15
|
-
title: css`
|
|
16
|
-
margin-inline-end: 8px;
|
|
17
|
-
color: ${cssVar.colorText};
|
|
18
|
-
`,
|
|
19
|
-
}));
|
|
20
|
-
|
|
21
|
-
export const CompleteTodosInspector = memo<
|
|
22
|
-
BuiltinInspectorProps<CompleteTodosParams, CompleteTodosState>
|
|
23
|
-
>(({ args, partialArgs, isArgumentsStreaming }) => {
|
|
24
|
-
const { t } = useTranslation('plugin');
|
|
25
|
-
|
|
26
|
-
const indices = args?.indices || partialArgs?.indices || [];
|
|
27
|
-
const count = indices.length;
|
|
28
|
-
|
|
29
|
-
if (isArgumentsStreaming && count === 0) {
|
|
30
|
-
return (
|
|
31
|
-
<div className={cx(oneLineEllipsis, shinyTextStyles.shinyText)}>
|
|
32
|
-
<span>{t('builtins.lobe-gtd.apiName.completeTodos')}</span>
|
|
33
|
-
</div>
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<div className={cx(oneLineEllipsis, isArgumentsStreaming && shinyTextStyles.shinyText)}>
|
|
39
|
-
<span className={styles.title}>{t('builtins.lobe-gtd.apiName.completeTodos')}</span>
|
|
40
|
-
{count > 0 && (
|
|
41
|
-
<Text as={'span'} code color={cssVar.colorSuccess} fontSize={12}>
|
|
42
|
-
<Icon icon={CheckCircle} size={12} />
|
|
43
|
-
{count}
|
|
44
|
-
</Text>
|
|
45
|
-
)}
|
|
46
|
-
</div>
|
|
47
|
-
);
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
CompleteTodosInspector.displayName = 'CompleteTodosInspector';
|
|
51
|
-
|
|
52
|
-
export default CompleteTodosInspector;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import type { BuiltinInspectorProps } from '@lobechat/types';
|
|
4
|
-
import { Icon, Text } from '@lobehub/ui';
|
|
5
|
-
import { createStaticStyles, cssVar, cx } from 'antd-style';
|
|
6
|
-
import { Minus } from 'lucide-react';
|
|
7
|
-
import { memo } from 'react';
|
|
8
|
-
import { useTranslation } from 'react-i18next';
|
|
9
|
-
|
|
10
|
-
import { oneLineEllipsis, shinyTextStyles } from '@/styles';
|
|
11
|
-
|
|
12
|
-
import type { RemoveTodosParams, RemoveTodosState } from '../../../types';
|
|
13
|
-
|
|
14
|
-
const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
15
|
-
title: css`
|
|
16
|
-
margin-inline-end: 8px;
|
|
17
|
-
color: ${cssVar.colorText};
|
|
18
|
-
`,
|
|
19
|
-
}));
|
|
20
|
-
|
|
21
|
-
export const RemoveTodosInspector = memo<
|
|
22
|
-
BuiltinInspectorProps<RemoveTodosParams, RemoveTodosState>
|
|
23
|
-
>(({ args, partialArgs, isArgumentsStreaming }) => {
|
|
24
|
-
const { t } = useTranslation('plugin');
|
|
25
|
-
|
|
26
|
-
const indices = args?.indices || partialArgs?.indices || [];
|
|
27
|
-
const count = indices.length;
|
|
28
|
-
|
|
29
|
-
if (isArgumentsStreaming && count === 0) {
|
|
30
|
-
return (
|
|
31
|
-
<div className={cx(oneLineEllipsis, shinyTextStyles.shinyText)}>
|
|
32
|
-
<span>{t('builtins.lobe-gtd.apiName.removeTodos')}</span>
|
|
33
|
-
</div>
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<div className={cx(oneLineEllipsis, isArgumentsStreaming && shinyTextStyles.shinyText)}>
|
|
39
|
-
<span className={styles.title}>{t('builtins.lobe-gtd.apiName.removeTodos')}</span>
|
|
40
|
-
{count > 0 && (
|
|
41
|
-
<Text as={'span'} code color={cssVar.colorError} fontSize={12}>
|
|
42
|
-
<Icon icon={Minus} size={12} />
|
|
43
|
-
{count}
|
|
44
|
-
</Text>
|
|
45
|
-
)}
|
|
46
|
-
</div>
|
|
47
|
-
);
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
RemoveTodosInspector.displayName = 'RemoveTodosInspector';
|
|
51
|
-
|
|
52
|
-
export default RemoveTodosInspector;
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { type ChatPluginPayload } from '@lobechat/types';
|
|
2
|
-
import { Block, Flexbox, Highlighter } from '@lobehub/ui';
|
|
3
|
-
import { Divider } from 'antd';
|
|
4
|
-
import { memo, useEffect, useMemo } from 'react';
|
|
5
|
-
|
|
6
|
-
import PluginRender from '@/features/PluginsUI/Render';
|
|
7
|
-
|
|
8
|
-
import Arguments from './Arguments';
|
|
9
|
-
|
|
10
|
-
interface CustomRenderProps {
|
|
11
|
-
content: string;
|
|
12
|
-
/**
|
|
13
|
-
* The real message ID (tool message ID)
|
|
14
|
-
*/
|
|
15
|
-
messageId?: string;
|
|
16
|
-
plugin?: ChatPluginPayload;
|
|
17
|
-
pluginState?: any;
|
|
18
|
-
requestArgs?: string;
|
|
19
|
-
setShowPluginRender: (value: boolean) => void;
|
|
20
|
-
showPluginRender: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* The tool call ID from the assistant message
|
|
23
|
-
*/
|
|
24
|
-
toolCallId: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Custom Render for Group Messages
|
|
29
|
-
*
|
|
30
|
-
* Group messages are already completed, so:
|
|
31
|
-
* - No loading state needed
|
|
32
|
-
* - No edit/re-run functionality
|
|
33
|
-
* - Results are directly available in content prop
|
|
34
|
-
*/
|
|
35
|
-
const CustomRender = memo<CustomRenderProps>(
|
|
36
|
-
({
|
|
37
|
-
toolCallId,
|
|
38
|
-
messageId,
|
|
39
|
-
content,
|
|
40
|
-
pluginState,
|
|
41
|
-
plugin,
|
|
42
|
-
requestArgs,
|
|
43
|
-
showPluginRender,
|
|
44
|
-
setShowPluginRender,
|
|
45
|
-
}) => {
|
|
46
|
-
// Determine if plugin UI should be shown based on plugin type
|
|
47
|
-
useEffect(() => {
|
|
48
|
-
if (!plugin?.type) return;
|
|
49
|
-
setShowPluginRender(plugin.type !== 'default');
|
|
50
|
-
}, [plugin?.type, setShowPluginRender]);
|
|
51
|
-
|
|
52
|
-
// Parse and display result content
|
|
53
|
-
const { data, language } = useMemo(() => {
|
|
54
|
-
try {
|
|
55
|
-
const parsed = JSON.parse(content || '');
|
|
56
|
-
// If parsed result is a string, return it directly
|
|
57
|
-
if (typeof parsed === 'string') {
|
|
58
|
-
return { data: parsed, language: 'plaintext' };
|
|
59
|
-
}
|
|
60
|
-
return { data: JSON.stringify(parsed, null, 2), language: 'json' };
|
|
61
|
-
} catch {
|
|
62
|
-
return { data: content || '', language: 'plaintext' };
|
|
63
|
-
}
|
|
64
|
-
}, [content]);
|
|
65
|
-
|
|
66
|
-
// Show plugin custom UI if applicable
|
|
67
|
-
if (showPluginRender) {
|
|
68
|
-
return (
|
|
69
|
-
<Flexbox gap={12} id={toolCallId} width={'100%'}>
|
|
70
|
-
<PluginRender
|
|
71
|
-
arguments={plugin?.arguments}
|
|
72
|
-
content={content}
|
|
73
|
-
identifier={plugin?.identifier}
|
|
74
|
-
loading={false}
|
|
75
|
-
messageId={messageId}
|
|
76
|
-
payload={plugin}
|
|
77
|
-
pluginState={pluginState}
|
|
78
|
-
toolCallId={toolCallId}
|
|
79
|
-
type={plugin?.type}
|
|
80
|
-
/>
|
|
81
|
-
</Flexbox>
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// Default render: show arguments and result
|
|
86
|
-
return (
|
|
87
|
-
<Block id={toolCallId} variant={'outlined'} width={'100%'}>
|
|
88
|
-
<Arguments arguments={requestArgs} />
|
|
89
|
-
{content && (
|
|
90
|
-
<>
|
|
91
|
-
<Divider dashed style={{ marginBlock: 0 }} />
|
|
92
|
-
<Highlighter
|
|
93
|
-
language={language}
|
|
94
|
-
style={{
|
|
95
|
-
background: 'transparent',
|
|
96
|
-
borderRadius: 0,
|
|
97
|
-
maxHeight: 300,
|
|
98
|
-
overflow: 'auto',
|
|
99
|
-
}}
|
|
100
|
-
variant={'filled'}
|
|
101
|
-
>
|
|
102
|
-
{data}
|
|
103
|
-
</Highlighter>
|
|
104
|
-
</>
|
|
105
|
-
)}
|
|
106
|
-
</Block>
|
|
107
|
-
);
|
|
108
|
-
},
|
|
109
|
-
);
|
|
110
|
-
|
|
111
|
-
CustomRender.displayName = 'GroupCustomRender';
|
|
112
|
-
|
|
113
|
-
export default CustomRender;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { Suspense, memo } from 'react';
|
|
2
|
-
|
|
3
|
-
import { dataSelectors, messageStateSelectors, useConversationStore } from '../../../store';
|
|
4
|
-
import CustomRender from '../../AssistantGroup/Tool/Render/CustomRender';
|
|
5
|
-
import ErrorResponse from '../../AssistantGroup/Tool/Render/ErrorResponse';
|
|
6
|
-
|
|
7
|
-
interface RenderProps {
|
|
8
|
-
messageId: string;
|
|
9
|
-
requestArgs?: string;
|
|
10
|
-
setShowPluginRender: (show: boolean) => void;
|
|
11
|
-
showPluginRender: boolean;
|
|
12
|
-
toolCallId: string;
|
|
13
|
-
toolIndex: number;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const Render = memo<RenderProps>(
|
|
17
|
-
({ toolCallId, toolIndex, messageId, requestArgs, showPluginRender, setShowPluginRender }) => {
|
|
18
|
-
const loading = useConversationStore(
|
|
19
|
-
messageStateSelectors.isToolCallStreaming(messageId, toolIndex),
|
|
20
|
-
);
|
|
21
|
-
const toolMessage = useConversationStore(dataSelectors.getDbMessageByToolCallId(toolCallId));
|
|
22
|
-
|
|
23
|
-
if (loading || !toolMessage) return null;
|
|
24
|
-
|
|
25
|
-
if (!!toolMessage) {
|
|
26
|
-
if (toolMessage.error) {
|
|
27
|
-
return <ErrorResponse {...toolMessage.error} id={messageId} plugin={toolMessage.plugin} />;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<Suspense>
|
|
32
|
-
<CustomRender
|
|
33
|
-
{...toolMessage}
|
|
34
|
-
requestArgs={requestArgs}
|
|
35
|
-
setShowPluginRender={setShowPluginRender}
|
|
36
|
-
showPluginRender={showPluginRender}
|
|
37
|
-
toolCallId={toolCallId}
|
|
38
|
-
/>
|
|
39
|
-
</Suspense>
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
Render.displayName = 'ToolRender';
|
|
46
|
-
|
|
47
|
-
export default Render;
|
/package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/AbortResponse.tsx
RENAMED
|
File without changes
|
|
File without changes
|
/package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/ErrorResponse.tsx
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/PluginSettings.tsx
RENAMED
|
File without changes
|
|
File without changes
|