@lobehub/lobehub 2.0.0-next.188 → 2.0.0-next.189

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.
Files changed (68) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/changelog/v1.json +9 -0
  3. package/e2e/CLAUDE.md +109 -2
  4. package/e2e/docs/llm-mock.md +68 -0
  5. package/e2e/docs/local-setup.md +354 -0
  6. package/e2e/docs/testing-tips.md +94 -0
  7. package/e2e/src/features/journeys/agent/agent-conversation.feature +0 -32
  8. package/e2e/src/mocks/llm/index.ts +6 -6
  9. package/e2e/src/steps/agent/conversation.steps.ts +3 -471
  10. package/package.json +2 -2
  11. package/src/app/[variants]/(main)/chat/_layout/Sidebar/Topic/List/Item/Actions.tsx +4 -13
  12. package/src/app/[variants]/(main)/chat/_layout/Sidebar/Topic/List/Item/index.tsx +23 -29
  13. package/src/app/[variants]/(main)/chat/_layout/Sidebar/Topic/List/Item/useDropdownMenu.tsx +3 -3
  14. package/src/app/[variants]/(main)/chat/_layout/Sidebar/Topic/TopicListContent/ThreadList/ThreadItem/Actions.tsx +4 -13
  15. package/src/app/[variants]/(main)/chat/_layout/Sidebar/Topic/TopicListContent/ThreadList/ThreadItem/index.tsx +10 -18
  16. package/src/app/[variants]/(main)/chat/_layout/Sidebar/Topic/TopicListContent/ThreadList/ThreadItem/useDropdownMenu.tsx +3 -3
  17. package/src/app/[variants]/(main)/community/(detail)/assistant/features/Sidebar/ActionButton/AddAgent.tsx +47 -27
  18. package/src/app/[variants]/(main)/community/(detail)/user/features/UserAgentCard.tsx +4 -3
  19. package/src/app/[variants]/(main)/group/_layout/Sidebar/Topic/List/Item/Actions.tsx +4 -13
  20. package/src/app/[variants]/(main)/group/_layout/Sidebar/Topic/List/Item/index.tsx +23 -29
  21. package/src/app/[variants]/(main)/group/_layout/Sidebar/Topic/List/Item/useDropdownMenu.tsx +3 -3
  22. package/src/app/[variants]/(main)/group/_layout/Sidebar/Topic/TopicListContent/ThreadList/ThreadItem/Actions.tsx +4 -13
  23. package/src/app/[variants]/(main)/group/_layout/Sidebar/Topic/TopicListContent/ThreadList/ThreadItem/index.tsx +10 -18
  24. package/src/app/[variants]/(main)/group/_layout/Sidebar/Topic/TopicListContent/ThreadList/ThreadItem/useDropdownMenu.tsx +3 -3
  25. package/src/app/[variants]/(main)/group/profile/features/AgentBuilder/TopicSelector.tsx +18 -20
  26. package/src/app/[variants]/(main)/home/_layout/Body/Agent/List/AgentGroupItem/index.tsx +19 -25
  27. package/src/app/[variants]/(main)/home/_layout/Body/Agent/List/AgentItem/index.tsx +21 -26
  28. package/src/app/[variants]/(main)/home/_layout/Body/Agent/List/Item/Actions.tsx +4 -13
  29. package/src/app/[variants]/(main)/home/_layout/Body/Agent/List/Item/useDropdownMenu.tsx +3 -3
  30. package/src/app/[variants]/(main)/home/_layout/Body/Project/List/Actions.tsx +4 -13
  31. package/src/app/[variants]/(main)/home/_layout/Body/Project/List/Item.tsx +8 -15
  32. package/src/app/[variants]/(main)/home/_layout/Body/Project/List/useDropdownMenu.tsx +3 -3
  33. package/src/app/[variants]/(main)/home/_layout/Header/components/AddButton.tsx +3 -4
  34. package/src/app/[variants]/(main)/page/_layout/Body/List/Item/Actions.tsx +4 -13
  35. package/src/app/[variants]/(main)/page/_layout/Body/List/Item/index.tsx +13 -20
  36. package/src/app/[variants]/(main)/page/_layout/Body/List/Item/useDropdownMenu.tsx +3 -3
  37. package/src/app/[variants]/(main)/resource/(home)/_layout/Body/LibraryList/List/Item/Actions.tsx +4 -13
  38. package/src/app/[variants]/(main)/resource/(home)/_layout/Body/LibraryList/List/Item/index.tsx +16 -23
  39. package/src/app/[variants]/(main)/resource/(home)/_layout/Body/LibraryList/List/Item/useDropdownMenu.tsx +3 -3
  40. package/src/app/[variants]/(main)/resource/library/_layout/Header/LibraryHead.tsx +4 -6
  41. package/src/features/AgentBuilder/TopicSelector.tsx +18 -17
  42. package/src/features/Conversation/ChatItem/style.ts +7 -0
  43. package/src/features/Conversation/Messages/Assistant/Actions/Error.tsx +1 -3
  44. package/src/features/Conversation/Messages/Assistant/Actions/index.tsx +37 -16
  45. package/src/features/Conversation/Messages/AssistantGroup/Actions/index.tsx +36 -17
  46. package/src/features/Conversation/Messages/Supervisor/Actions/index.tsx +36 -17
  47. package/src/features/Conversation/Messages/Task/Actions/Error.tsx +1 -3
  48. package/src/features/Conversation/Messages/Task/Actions/index.tsx +31 -15
  49. package/src/features/Conversation/Messages/User/Actions/index.tsx +1 -1
  50. package/src/features/Conversation/Messages/index.tsx +8 -59
  51. package/src/features/Conversation/components/ShareMessageModal/index.tsx +1 -1
  52. package/src/features/Conversation/hooks/useChatItemContextMenu.tsx +313 -83
  53. package/src/features/NavPanel/components/NavItem.tsx +33 -3
  54. package/src/features/PageEditor/Copilot/TopicSelector/Actions.tsx +6 -14
  55. package/src/features/PageEditor/Copilot/TopicSelector/TopicItem.tsx +1 -0
  56. package/src/features/PageEditor/Copilot/TopicSelector/useDropdownMenu.tsx +6 -3
  57. package/src/features/ResourceManager/components/Explorer/ItemDropdown/DropdownMenu.tsx +12 -35
  58. package/src/features/ResourceManager/components/Explorer/ItemDropdown/useFileItemDropdown.tsx +4 -8
  59. package/src/features/ResourceManager/components/Explorer/ListView/ListItem/index.tsx +162 -160
  60. package/src/features/ResourceManager/components/Explorer/MasonryView/MasonryFileItem/index.tsx +16 -8
  61. package/src/features/ResourceManager/components/Explorer/ToolBar/ActionIconWithChevron.tsx +4 -3
  62. package/src/features/ResourceManager/components/Explorer/ToolBar/BatchActionsDropdown.tsx +6 -12
  63. package/src/features/ResourceManager/components/Explorer/ToolBar/SortDropdown.tsx +8 -8
  64. package/src/features/ResourceManager/components/Explorer/ToolBar/ViewSwitcher.tsx +8 -11
  65. package/src/features/ResourceManager/components/Tree/index.tsx +121 -122
  66. package/src/layout/GlobalProvider/index.tsx +5 -2
  67. package/src/styles/global.ts +6 -0
  68. package/src/features/Conversation/components/ContextMenu.tsx +0 -418
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import { CaretDownFilled, LoadingOutlined } from '@ant-design/icons';
4
- import { ActionIcon, Block, Dropdown, Flexbox, Icon } from '@lobehub/ui';
4
+ import { ActionIcon, Block, Flexbox, Icon, showContextMenu } from '@lobehub/ui';
5
5
  import { App, Input } from 'antd';
6
6
  import { createStaticStyles, cx } from 'antd-style';
7
7
  import { FileText, FolderIcon, FolderOpenIcon } from 'lucide-react';
@@ -328,129 +328,55 @@ const FileTreeRow = memo<{
328
328
 
329
329
  return (
330
330
  <Flexbox gap={2}>
331
- <Dropdown menu={{ items: menuItems }} trigger={['contextMenu']}>
332
- <Block
333
- align={'center'}
334
- className={cx(
335
- styles.treeItem,
336
- isOver && styles.fileItemDragOver,
337
- isDragging && styles.dragging,
338
- )}
339
- clickable
340
- data-drop-target-id={item.id}
341
- data-is-folder={String(item.isFolder)}
342
- draggable
343
- gap={8}
344
- height={36}
345
- horizontal
346
- onClick={() => handleFolderClick(item.id, item.slug)}
347
- onDragEnd={handleDragEnd}
348
- onDragLeave={handleDragLeave}
349
- onDragOver={handleDragOver}
350
- onDragStart={handleDragStart}
351
- onDrop={handleDrop}
352
- paddingInline={4}
353
- style={{
354
- paddingInlineStart: level * 12 + 4,
355
- }}
356
- variant={isActive ? 'filled' : 'borderless'}
357
- >
358
- {isLoading ? (
359
- <ActionIcon
360
- icon={LoadingOutlined as any}
361
- size={'small'}
362
- spin
363
- style={{ width: 20 }}
364
- />
365
- ) : (
366
- <motion.div
367
- animate={{ rotate: isExpanded ? 0 : -90 }}
368
- initial={false}
369
- transition={{ duration: 0.2, ease: 'easeInOut' }}
370
- >
371
- <ActionIcon
372
- icon={CaretDownFilled as any}
373
- onClick={(e) => {
374
- e.stopPropagation();
375
- handleToggle();
376
- }}
377
- size={'small'}
378
- style={{ width: 20 }}
379
- />
380
- </motion.div>
381
- )}
382
- <Flexbox
383
- align={'center'}
384
- flex={1}
385
- gap={8}
386
- horizontal
387
- style={{ minHeight: 28, minWidth: 0, overflow: 'hidden' }}
388
- >
389
- <Icon icon={isExpanded ? FolderOpenIcon : FolderIcon} size={18} />
390
- {isRenaming ? (
391
- <Input
392
- onBlur={handleRenameConfirm}
393
- onChange={(e) => setRenamingValue(e.target.value)}
394
- onClick={(e) => e.stopPropagation()}
395
- onKeyDown={(e) => {
396
- if (e.key === 'Enter') {
397
- e.preventDefault();
398
- handleRenameConfirm();
399
- } else if (e.key === 'Escape') {
400
- e.preventDefault();
401
- handleRenameCancel();
402
- }
403
- }}
404
- onPointerDown={(e) => e.stopPropagation()}
405
- ref={inputRef}
406
- size="small"
407
- style={{ flex: 1 }}
408
- value={renamingValue}
409
- />
410
- ) : (
411
- <span
412
- style={{
413
- flex: 1,
414
- overflow: 'hidden',
415
- textOverflow: 'ellipsis',
416
- whiteSpace: 'nowrap',
417
- }}
418
- >
419
- {item.name}
420
- </span>
421
- )}
422
- </Flexbox>
423
- </Block>
424
- </Dropdown>
425
- </Flexbox>
426
- );
427
- }
428
-
429
- // Render as file
430
- const isActive = selectedKey === itemKey;
431
- return (
432
- <Flexbox gap={2}>
433
- <Dropdown menu={{ items: menuItems }} trigger={['contextMenu']}>
434
331
  <Block
435
332
  align={'center'}
436
- className={cx(styles.treeItem, isDragging && styles.dragging)}
333
+ className={cx(
334
+ styles.treeItem,
335
+ isOver && styles.fileItemDragOver,
336
+ isDragging && styles.dragging,
337
+ )}
437
338
  clickable
438
339
  data-drop-target-id={item.id}
439
- data-is-folder={false}
340
+ data-is-folder={String(item.isFolder)}
440
341
  draggable
441
342
  gap={8}
442
343
  height={36}
443
344
  horizontal
444
- onClick={handleItemClick}
345
+ onClick={() => handleFolderClick(item.id, item.slug)}
346
+ onContextMenu={(e) => {
347
+ e.preventDefault();
348
+ showContextMenu(menuItems());
349
+ }}
445
350
  onDragEnd={handleDragEnd}
351
+ onDragLeave={handleDragLeave}
352
+ onDragOver={handleDragOver}
446
353
  onDragStart={handleDragStart}
354
+ onDrop={handleDrop}
447
355
  paddingInline={4}
448
356
  style={{
449
357
  paddingInlineStart: level * 12 + 4,
450
358
  }}
451
359
  variant={isActive ? 'filled' : 'borderless'}
452
360
  >
453
- <div style={{ width: 20 }} />
361
+ {isLoading ? (
362
+ <ActionIcon icon={LoadingOutlined as any} size={'small'} spin style={{ width: 20 }} />
363
+ ) : (
364
+ <motion.div
365
+ animate={{ rotate: isExpanded ? 0 : -90 }}
366
+ initial={false}
367
+ transition={{ duration: 0.2, ease: 'easeInOut' }}
368
+ >
369
+ <ActionIcon
370
+ icon={CaretDownFilled as any}
371
+ onClick={(e) => {
372
+ e.stopPropagation();
373
+ handleToggle();
374
+ }}
375
+ size={'small'}
376
+ style={{ width: 20 }}
377
+ />
378
+ </motion.div>
379
+ )}
454
380
  <Flexbox
455
381
  align={'center'}
456
382
  flex={1}
@@ -458,24 +384,97 @@ const FileTreeRow = memo<{
458
384
  horizontal
459
385
  style={{ minHeight: 28, minWidth: 0, overflow: 'hidden' }}
460
386
  >
461
- {item.sourceType === 'document' ? (
462
- <Icon icon={FileText} size={18} />
387
+ <Icon icon={isExpanded ? FolderOpenIcon : FolderIcon} size={18} />
388
+ {isRenaming ? (
389
+ <Input
390
+ onBlur={handleRenameConfirm}
391
+ onChange={(e) => setRenamingValue(e.target.value)}
392
+ onClick={(e) => e.stopPropagation()}
393
+ onKeyDown={(e) => {
394
+ if (e.key === 'Enter') {
395
+ e.preventDefault();
396
+ handleRenameConfirm();
397
+ } else if (e.key === 'Escape') {
398
+ e.preventDefault();
399
+ handleRenameCancel();
400
+ }
401
+ }}
402
+ onPointerDown={(e) => e.stopPropagation()}
403
+ ref={inputRef}
404
+ size="small"
405
+ style={{ flex: 1 }}
406
+ value={renamingValue}
407
+ />
463
408
  ) : (
464
- <FileIcon fileName={item.name} fileType={item.fileType} size={18} />
409
+ <span
410
+ style={{
411
+ flex: 1,
412
+ overflow: 'hidden',
413
+ textOverflow: 'ellipsis',
414
+ whiteSpace: 'nowrap',
415
+ }}
416
+ >
417
+ {item.name}
418
+ </span>
465
419
  )}
466
- <span
467
- style={{
468
- flex: 1,
469
- overflow: 'hidden',
470
- textOverflow: 'ellipsis',
471
- whiteSpace: 'nowrap',
472
- }}
473
- >
474
- {item.name}
475
- </span>
476
420
  </Flexbox>
477
421
  </Block>
478
- </Dropdown>
422
+ </Flexbox>
423
+ );
424
+ }
425
+
426
+ // Render as file
427
+ const isActive = selectedKey === itemKey;
428
+ return (
429
+ <Flexbox gap={2}>
430
+ <Block
431
+ align={'center'}
432
+ className={cx(styles.treeItem, isDragging && styles.dragging)}
433
+ clickable
434
+ data-drop-target-id={item.id}
435
+ data-is-folder={false}
436
+ draggable
437
+ gap={8}
438
+ height={36}
439
+ horizontal
440
+ onClick={handleItemClick}
441
+ onContextMenu={(e) => {
442
+ e.preventDefault();
443
+ showContextMenu(menuItems());
444
+ }}
445
+ onDragEnd={handleDragEnd}
446
+ onDragStart={handleDragStart}
447
+ paddingInline={4}
448
+ style={{
449
+ paddingInlineStart: level * 12 + 4,
450
+ }}
451
+ variant={isActive ? 'filled' : 'borderless'}
452
+ >
453
+ <div style={{ width: 20 }} />
454
+ <Flexbox
455
+ align={'center'}
456
+ flex={1}
457
+ gap={8}
458
+ horizontal
459
+ style={{ minHeight: 28, minWidth: 0, overflow: 'hidden' }}
460
+ >
461
+ {item.sourceType === 'document' ? (
462
+ <Icon icon={FileText} size={18} />
463
+ ) : (
464
+ <FileIcon fileName={item.name} fileType={item.fileType} size={18} />
465
+ )}
466
+ <span
467
+ style={{
468
+ flex: 1,
469
+ overflow: 'hidden',
470
+ textOverflow: 'ellipsis',
471
+ whiteSpace: 'nowrap',
472
+ }}
473
+ >
474
+ {item.name}
475
+ </span>
476
+ </Flexbox>
477
+ </Block>
479
478
  </Flexbox>
480
479
  );
481
480
  },
@@ -1,5 +1,5 @@
1
1
  import { ENABLE_BUSINESS_FEATURES } from '@lobechat/business-const';
2
- import { ModalHost } from '@lobehub/ui';
2
+ import { ContextMenuHost, ModalHost, TooltipGroup } from '@lobehub/ui';
3
3
  import { LazyMotion, domMax } from 'motion/react';
4
4
  import { type ReactNode, Suspense } from 'react';
5
5
 
@@ -66,8 +66,11 @@ const GlobalLayout = async ({
66
66
  <GroupWizardProvider>
67
67
  <DragUploadProvider>
68
68
  <LazyMotion features={domMax}>
69
- <LobeAnalyticsProviderWrapper>{children}</LobeAnalyticsProviderWrapper>
69
+ <TooltipGroup layoutAnimation={false}>
70
+ <LobeAnalyticsProviderWrapper>{children}</LobeAnalyticsProviderWrapper>
71
+ </TooltipGroup>
70
72
  <ModalHost />
73
+ <ContextMenuHost />
71
74
  </LazyMotion>
72
75
  </DragUploadProvider>
73
76
  </GroupWizardProvider>
@@ -1,3 +1,4 @@
1
+ import { CLASSNAMES } from '@lobehub/ui';
1
2
  import { type Theme, css } from 'antd-style';
2
3
 
3
4
  // fix ios input keyboard
@@ -55,4 +56,9 @@ export default ({ token }: { prefixCls: string; token: Theme }) => css`
55
56
  button {
56
57
  -webkit-app-region: no-drag;
57
58
  }
59
+
60
+ .${CLASSNAMES.ContextTrigger}[data-popup-open],
61
+ .${CLASSNAMES.DropdownMenuTrigger}[data-popup-open] {
62
+ background: ${token.colorFillTertiary};
63
+ }
58
64
  `;