@lobehub/lobehub 2.0.0-next.226 → 2.0.0-next.228
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/AGENTS.md +4 -0
- package/CHANGELOG.md +50 -0
- package/CLAUDE.md +4 -0
- package/changelog/v1.json +18 -0
- package/docs/self-hosting/server-database/docker-compose.mdx +11 -0
- package/docs/self-hosting/server-database/docker-compose.zh-CN.mdx +11 -0
- package/package.json +2 -2
- package/packages/model-bank/src/aiModels/lobehub.ts +28 -0
- package/packages/utils/src/platform.test.ts +26 -1
- package/packages/utils/src/platform.ts +22 -0
- package/src/app/[variants]/(main)/_layout/DesktopLayoutContainer/style.ts +4 -0
- package/src/app/[variants]/(main)/_layout/DesktopLayoutContainer.tsx +8 -4
- package/src/app/[variants]/(main)/chat/_layout/Sidebar/Header/Agent/SwitchPanel.tsx +37 -23
- package/src/app/[variants]/(main)/chat/_layout/Sidebar/Topic/List/Item/Editing.tsx +4 -7
- package/src/app/[variants]/(main)/chat/_layout/Sidebar/Topic/TopicListContent/ThreadList/ThreadItem/Editing.tsx +4 -7
- package/src/app/[variants]/(main)/chat/features/Conversation/Header/HeaderActions/index.tsx +3 -13
- package/src/app/[variants]/(main)/chat/features/Conversation/Header/WorkingDirectory/index.tsx +2 -4
- package/src/app/[variants]/(main)/community/(list)/model/features/List/Item.tsx +1 -3
- package/src/app/[variants]/(main)/group/_layout/Sidebar/GroupConfig/AgentProfilePopup.tsx +3 -5
- package/src/app/[variants]/(main)/group/_layout/Sidebar/Header/Agent/SwitchPanel.tsx +4 -6
- package/src/app/[variants]/(main)/group/_layout/Sidebar/Topic/List/Item/Editing.tsx +4 -7
- package/src/app/[variants]/(main)/group/_layout/Sidebar/Topic/TopicListContent/ThreadList/ThreadItem/Editing.tsx +4 -7
- package/src/app/[variants]/(main)/home/_layout/Body/Agent/List/AgentGroupItem/Editing.tsx +4 -7
- package/src/app/[variants]/(main)/home/_layout/Body/Agent/List/AgentItem/Editing.tsx +4 -7
- package/src/app/[variants]/(main)/home/_layout/Body/Agent/List/Group/Editing.tsx +4 -7
- package/src/app/[variants]/(main)/home/_layout/Body/Project/List/Editing.tsx +4 -7
- package/src/app/[variants]/(main)/image/_layout/ConfigPanel/components/ModelSelect/ImageModelItem.tsx +1 -6
- package/src/app/[variants]/(main)/image/_layout/Topics/TopicItem.tsx +3 -4
- package/src/app/[variants]/(main)/page/_layout/Body/List/Item/Editing.tsx +5 -7
- package/src/app/[variants]/(main)/resource/(home)/_layout/Body/LibraryList/List/Item/Editing.tsx +4 -7
- package/src/business/client/hooks/useBusinessErrorAlertConfig.ts +9 -0
- package/src/business/client/hooks/useBusinessErrorContent.ts +13 -0
- package/src/business/server/lambda-routers/file.ts +12 -0
- package/src/components/ManifestPreviewer/index.tsx +2 -5
- package/src/components/TipGuide/index.tsx +3 -4
- package/src/features/ChatInput/ActionBar/Search/index.tsx +1 -1
- package/src/features/ChatInput/ActionBar/components/Action.tsx +5 -1
- package/src/features/ChatInput/ActionBar/components/ActionPopover.tsx +27 -23
- package/src/features/ChatMiniMap/MinimapIndicator.tsx +2 -4
- package/src/features/ChatMiniMap/index.tsx +16 -14
- package/src/features/Conversation/Error/index.tsx +13 -3
- package/src/features/Conversation/Markdown/plugins/Mention/Render.tsx +2 -4
- package/src/features/Conversation/Messages/AssistantGroup/Tool/Render/Intervention/ApprovalActions.tsx +2 -3
- package/src/features/Conversation/Messages/components/Extras/Usage/UsageDetail/index.tsx +3 -4
- package/src/features/LocalFile/LocalFile.tsx +4 -5
- package/src/features/MCPPluginDetail/Deployment/index.tsx +13 -4
- package/src/features/MCPPluginDetail/Score/TotalScore.tsx +10 -5
- package/src/features/ModelSwitchPanel/index.tsx +2 -4
- package/src/features/PageEditor/Copilot/Toolbar.tsx +5 -8
- package/src/server/routers/lambda/__tests__/file.test.ts +7 -7
- package/src/server/routers/lambda/file.ts +12 -3
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Input } from '@lobehub/ui';
|
|
2
|
-
import { Popover } from 'antd';
|
|
1
|
+
import { Input, Popover } from '@lobehub/ui';
|
|
3
2
|
import { memo, useCallback, useState } from 'react';
|
|
4
3
|
|
|
5
4
|
import { useChatStore } from '@/store/chat';
|
|
@@ -26,7 +25,6 @@ const Editing = memo<EditingProps>(({ id, title, toggleEditing }) => {
|
|
|
26
25
|
|
|
27
26
|
return (
|
|
28
27
|
<Popover
|
|
29
|
-
arrow={false}
|
|
30
28
|
content={
|
|
31
29
|
<Input
|
|
32
30
|
autoFocus
|
|
@@ -43,20 +41,19 @@ const Editing = memo<EditingProps>(({ id, title, toggleEditing }) => {
|
|
|
43
41
|
}}
|
|
44
42
|
/>
|
|
45
43
|
}
|
|
46
|
-
destroyOnHidden
|
|
47
44
|
onOpenChange={(open) => {
|
|
48
45
|
if (!open) handleUpdate();
|
|
49
46
|
toggleEditing(open);
|
|
50
47
|
}}
|
|
51
48
|
open={editing}
|
|
52
|
-
placement=
|
|
49
|
+
placement="bottomLeft"
|
|
53
50
|
styles={{
|
|
54
|
-
|
|
51
|
+
content: {
|
|
55
52
|
padding: 4,
|
|
56
53
|
width: 320,
|
|
57
54
|
},
|
|
58
55
|
}}
|
|
59
|
-
trigger=
|
|
56
|
+
trigger="click"
|
|
60
57
|
>
|
|
61
58
|
<div />
|
|
62
59
|
</Popover>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Flexbox, Input } from '@lobehub/ui';
|
|
2
|
-
import { Popover } from 'antd';
|
|
1
|
+
import { Flexbox, Input, Popover } from '@lobehub/ui';
|
|
3
2
|
import { memo, useCallback, useState } from 'react';
|
|
4
3
|
|
|
5
4
|
import { useHomeStore } from '@/store/home';
|
|
@@ -38,7 +37,6 @@ const Editing = memo<EditingProps>(({ id, title, toggleEditing }) => {
|
|
|
38
37
|
|
|
39
38
|
return (
|
|
40
39
|
<Popover
|
|
41
|
-
arrow={false}
|
|
42
40
|
content={
|
|
43
41
|
<Flexbox gap={4} horizontal onClick={(e) => e.stopPropagation()} style={{ width: 280 }}>
|
|
44
42
|
<Input
|
|
@@ -53,19 +51,18 @@ const Editing = memo<EditingProps>(({ id, title, toggleEditing }) => {
|
|
|
53
51
|
/>
|
|
54
52
|
</Flexbox>
|
|
55
53
|
}
|
|
56
|
-
destroyOnHidden
|
|
57
54
|
onOpenChange={(open) => {
|
|
58
55
|
if (!open) handleUpdate();
|
|
59
56
|
toggleEditing(open);
|
|
60
57
|
}}
|
|
61
58
|
open={editing}
|
|
62
|
-
placement=
|
|
59
|
+
placement="bottomLeft"
|
|
63
60
|
styles={{
|
|
64
|
-
|
|
61
|
+
content: {
|
|
65
62
|
padding: 4,
|
|
66
63
|
},
|
|
67
64
|
}}
|
|
68
|
-
trigger=
|
|
65
|
+
trigger="click"
|
|
69
66
|
>
|
|
70
67
|
<div />
|
|
71
68
|
</Popover>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Avatar, Block, Flexbox, Input } from '@lobehub/ui';
|
|
2
|
-
import { Popover } from 'antd';
|
|
1
|
+
import { Avatar, Block, Flexbox, Input, Popover } from '@lobehub/ui';
|
|
3
2
|
import { memo, useCallback, useState } from 'react';
|
|
4
3
|
|
|
5
4
|
import EmojiPicker from '@/components/EmojiPicker';
|
|
@@ -55,7 +54,6 @@ const Editing = memo<EditingProps>(({ id, title, avatar, toggleEditing }) => {
|
|
|
55
54
|
|
|
56
55
|
return (
|
|
57
56
|
<Popover
|
|
58
|
-
arrow={false}
|
|
59
57
|
content={
|
|
60
58
|
<Flexbox gap={4} horizontal onClick={(e) => e.stopPropagation()} style={{ width: 320 }}>
|
|
61
59
|
<EmojiPicker
|
|
@@ -89,19 +87,18 @@ const Editing = memo<EditingProps>(({ id, title, avatar, toggleEditing }) => {
|
|
|
89
87
|
/>
|
|
90
88
|
</Flexbox>
|
|
91
89
|
}
|
|
92
|
-
destroyOnHidden
|
|
93
90
|
onOpenChange={(open) => {
|
|
94
91
|
if (!open) handleUpdate();
|
|
95
92
|
toggleEditing(open);
|
|
96
93
|
}}
|
|
97
94
|
open={editing}
|
|
98
|
-
placement=
|
|
95
|
+
placement="bottomLeft"
|
|
99
96
|
styles={{
|
|
100
|
-
|
|
97
|
+
content: {
|
|
101
98
|
padding: 4,
|
|
102
99
|
},
|
|
103
100
|
}}
|
|
104
|
-
trigger=
|
|
101
|
+
trigger="click"
|
|
105
102
|
>
|
|
106
103
|
<div />
|
|
107
104
|
</Popover>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Input } from '@lobehub/ui';
|
|
2
|
-
import { Popover } from 'antd';
|
|
1
|
+
import { Input, Popover } from '@lobehub/ui';
|
|
3
2
|
import { memo, useCallback, useState } from 'react';
|
|
4
3
|
|
|
5
4
|
import { useHomeStore } from '@/store/home';
|
|
@@ -33,7 +32,6 @@ const Editing = memo<EditingProps>(({ id, name, toggleEditing }) => {
|
|
|
33
32
|
|
|
34
33
|
return (
|
|
35
34
|
<Popover
|
|
36
|
-
arrow={false}
|
|
37
35
|
content={
|
|
38
36
|
<Input
|
|
39
37
|
autoFocus
|
|
@@ -50,20 +48,19 @@ const Editing = memo<EditingProps>(({ id, name, toggleEditing }) => {
|
|
|
50
48
|
}}
|
|
51
49
|
/>
|
|
52
50
|
}
|
|
53
|
-
destroyOnHidden
|
|
54
51
|
onOpenChange={(open) => {
|
|
55
52
|
if (!open) handleUpdate();
|
|
56
53
|
toggleEditing(open);
|
|
57
54
|
}}
|
|
58
55
|
open={editing}
|
|
59
|
-
placement=
|
|
56
|
+
placement="bottomLeft"
|
|
60
57
|
styles={{
|
|
61
|
-
|
|
58
|
+
content: {
|
|
62
59
|
padding: 4,
|
|
63
60
|
width: 320,
|
|
64
61
|
},
|
|
65
62
|
}}
|
|
66
|
-
trigger=
|
|
63
|
+
trigger="click"
|
|
67
64
|
>
|
|
68
65
|
<div />
|
|
69
66
|
</Popover>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Input } from '@lobehub/ui';
|
|
2
|
-
import { Popover } from 'antd';
|
|
1
|
+
import { Input, Popover } from '@lobehub/ui';
|
|
3
2
|
import { memo, useCallback, useState } from 'react';
|
|
4
3
|
|
|
5
4
|
import { useKnowledgeBaseStore } from '@/store/knowledgeBase';
|
|
@@ -26,7 +25,6 @@ const Editing = memo<EditingProps>(({ id, name, toggleEditing }) => {
|
|
|
26
25
|
|
|
27
26
|
return (
|
|
28
27
|
<Popover
|
|
29
|
-
arrow={false}
|
|
30
28
|
content={
|
|
31
29
|
<Input
|
|
32
30
|
autoFocus
|
|
@@ -43,20 +41,19 @@ const Editing = memo<EditingProps>(({ id, name, toggleEditing }) => {
|
|
|
43
41
|
}}
|
|
44
42
|
/>
|
|
45
43
|
}
|
|
46
|
-
destroyOnHidden
|
|
47
44
|
onOpenChange={(open) => {
|
|
48
45
|
if (!open) handleUpdate();
|
|
49
46
|
toggleEditing(open);
|
|
50
47
|
}}
|
|
51
48
|
open={editing}
|
|
52
|
-
placement=
|
|
49
|
+
placement="bottomLeft"
|
|
53
50
|
styles={{
|
|
54
|
-
|
|
51
|
+
content: {
|
|
55
52
|
padding: 4,
|
|
56
53
|
width: 320,
|
|
57
54
|
},
|
|
58
55
|
}}
|
|
59
|
-
trigger=
|
|
56
|
+
trigger="click"
|
|
60
57
|
>
|
|
61
58
|
<div />
|
|
62
59
|
</Popover>
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ModelIcon } from '@lobehub/icons';
|
|
2
|
-
import { Flexbox, Text } from '@lobehub/ui';
|
|
3
|
-
import { Popover } from 'antd';
|
|
2
|
+
import { Flexbox, Popover, Text } from '@lobehub/ui';
|
|
4
3
|
import { createStaticStyles, cx } from 'antd-style';
|
|
5
4
|
import { type AiModelForSelect } from 'model-bank';
|
|
6
5
|
import numeral from 'numeral';
|
|
@@ -109,10 +108,6 @@ const ImageModelItem = memo<ImageModelItemProps>(
|
|
|
109
108
|
|
|
110
109
|
return (
|
|
111
110
|
<Popover
|
|
112
|
-
align={{
|
|
113
|
-
offset: [24, -10],
|
|
114
|
-
}}
|
|
115
|
-
arrow={false}
|
|
116
111
|
classNames={{ root: cx(styles.popover, isDarkMode && styles.popover_dark) }}
|
|
117
112
|
content={popoverContent}
|
|
118
113
|
placement="rightTop"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { ActionIcon, Avatar, Flexbox, Text } from '@lobehub/ui';
|
|
4
|
-
import { App
|
|
3
|
+
import { ActionIcon, Avatar, Flexbox, Popover, Text } from '@lobehub/ui';
|
|
4
|
+
import { App } from 'antd';
|
|
5
5
|
import { cssVar } from 'antd-style';
|
|
6
6
|
import { Trash } from 'lucide-react';
|
|
7
7
|
import React, { memo } from 'react';
|
|
@@ -92,11 +92,10 @@ const TopicItem = memo<TopicItemProps>(({ topic, showMoreInfo, style }) => {
|
|
|
92
92
|
|
|
93
93
|
return (
|
|
94
94
|
<Popover
|
|
95
|
-
arrow={false}
|
|
96
95
|
content={tooltipContent}
|
|
97
96
|
placement={'left'}
|
|
98
97
|
styles={{
|
|
99
|
-
|
|
98
|
+
content: {
|
|
100
99
|
width: 200,
|
|
101
100
|
},
|
|
102
101
|
}}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Block, Flexbox, Input } from '@lobehub/ui';
|
|
2
|
-
import { Popover } from 'antd';
|
|
1
|
+
import { Block, Flexbox, Input, Popover } from '@lobehub/ui';
|
|
3
2
|
import { memo, useCallback, useState } from 'react';
|
|
4
3
|
import { useTranslation } from 'react-i18next';
|
|
5
4
|
|
|
@@ -46,7 +45,6 @@ const Editing = memo<EditingProps>(({ documentId, title, currentEmoji, toggleEdi
|
|
|
46
45
|
|
|
47
46
|
return (
|
|
48
47
|
<Popover
|
|
49
|
-
arrow={false}
|
|
50
48
|
content={
|
|
51
49
|
<Flexbox gap={4} horizontal onClick={(e) => e.stopPropagation()} style={{ width: 320 }}>
|
|
52
50
|
<EmojiPicker
|
|
@@ -71,6 +69,7 @@ const Editing = memo<EditingProps>(({ documentId, title, currentEmoji, toggleEdi
|
|
|
71
69
|
defaultAvatar={'📄'}
|
|
72
70
|
locale={locale}
|
|
73
71
|
onChange={setNewEmoji}
|
|
72
|
+
onClick={(e) => e?.stopPropagation()}
|
|
74
73
|
onDelete={() => setNewEmoji(undefined)}
|
|
75
74
|
value={newEmoji}
|
|
76
75
|
/>
|
|
@@ -87,19 +86,18 @@ const Editing = memo<EditingProps>(({ documentId, title, currentEmoji, toggleEdi
|
|
|
87
86
|
/>
|
|
88
87
|
</Flexbox>
|
|
89
88
|
}
|
|
90
|
-
destroyOnHidden
|
|
91
89
|
onOpenChange={(open) => {
|
|
92
90
|
if (!open) handleUpdate();
|
|
93
91
|
toggleEditing(open);
|
|
94
92
|
}}
|
|
95
93
|
open={editing}
|
|
96
|
-
placement=
|
|
94
|
+
placement="bottomLeft"
|
|
97
95
|
styles={{
|
|
98
|
-
|
|
96
|
+
content: {
|
|
99
97
|
padding: 4,
|
|
100
98
|
},
|
|
101
99
|
}}
|
|
102
|
-
trigger=
|
|
100
|
+
trigger="click"
|
|
103
101
|
>
|
|
104
102
|
<div />
|
|
105
103
|
</Popover>
|
package/src/app/[variants]/(main)/resource/(home)/_layout/Body/LibraryList/List/Item/Editing.tsx
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Input } from '@lobehub/ui';
|
|
2
|
-
import { Popover } from 'antd';
|
|
1
|
+
import { Input, Popover } from '@lobehub/ui';
|
|
3
2
|
import { memo, useCallback, useEffect, useState } from 'react';
|
|
4
3
|
|
|
5
4
|
import { useKnowledgeBaseStore } from '@/store/knowledgeBase';
|
|
@@ -34,7 +33,6 @@ const Editing = memo<EditingProps>(({ id, name, toggleEditing }) => {
|
|
|
34
33
|
|
|
35
34
|
return (
|
|
36
35
|
<Popover
|
|
37
|
-
arrow={false}
|
|
38
36
|
content={
|
|
39
37
|
<Input
|
|
40
38
|
autoFocus
|
|
@@ -52,20 +50,19 @@ const Editing = memo<EditingProps>(({ id, name, toggleEditing }) => {
|
|
|
52
50
|
}}
|
|
53
51
|
/>
|
|
54
52
|
}
|
|
55
|
-
destroyOnHidden
|
|
56
53
|
onOpenChange={(open) => {
|
|
57
54
|
if (!open) handleUpdate();
|
|
58
55
|
toggleEditing(open);
|
|
59
56
|
}}
|
|
60
57
|
open={editing}
|
|
61
|
-
placement=
|
|
58
|
+
placement="bottomLeft"
|
|
62
59
|
styles={{
|
|
63
|
-
|
|
60
|
+
content: {
|
|
64
61
|
padding: 4,
|
|
65
62
|
width: 320,
|
|
66
63
|
},
|
|
67
64
|
}}
|
|
68
|
-
trigger=
|
|
65
|
+
trigger="click"
|
|
69
66
|
>
|
|
70
67
|
<div />
|
|
71
68
|
</Popover>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ErrorType } from '@lobechat/types';
|
|
2
|
+
import type { AlertProps } from '@lobehub/ui';
|
|
3
|
+
|
|
4
|
+
export default function useBusinessErrorAlertConfig(
|
|
5
|
+
// eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars
|
|
6
|
+
errorType?: ErrorType,
|
|
7
|
+
): AlertProps | undefined {
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ErrorType } from '@lobechat/types';
|
|
2
|
+
|
|
3
|
+
export interface BusinessErrorContentResult {
|
|
4
|
+
errorType?: string;
|
|
5
|
+
hideMessage?: boolean;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export default function useBusinessErrorContent(
|
|
9
|
+
// eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars
|
|
10
|
+
errorType?: ErrorType | string,
|
|
11
|
+
): BusinessErrorContentResult {
|
|
12
|
+
return {};
|
|
13
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface BusinessFileUploadCheckParams {
|
|
2
|
+
actualSize: number;
|
|
3
|
+
clientIp?: string;
|
|
4
|
+
inputSize: number;
|
|
5
|
+
url: string;
|
|
6
|
+
userId: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export async function businessFileUploadCheck(
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11
|
+
params: BusinessFileUploadCheckParams,
|
|
12
|
+
): Promise<void> {}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Highlighter } from '@lobehub/ui';
|
|
2
|
-
import { Popover } from 'antd';
|
|
1
|
+
import { Highlighter, Popover } from '@lobehub/ui';
|
|
3
2
|
import { type ReactNode, memo } from 'react';
|
|
4
3
|
|
|
5
4
|
interface PluginManifestPreviewerProps {
|
|
@@ -11,7 +10,6 @@ interface PluginManifestPreviewerProps {
|
|
|
11
10
|
const ManifestPreviewer = memo<PluginManifestPreviewerProps>(
|
|
12
11
|
({ manifest, children, trigger = 'click' }) => (
|
|
13
12
|
<Popover
|
|
14
|
-
arrow={false}
|
|
15
13
|
content={
|
|
16
14
|
<Highlighter
|
|
17
15
|
language={'json'}
|
|
@@ -21,8 +19,7 @@ const ManifestPreviewer = memo<PluginManifestPreviewerProps>(
|
|
|
21
19
|
</Highlighter>
|
|
22
20
|
}
|
|
23
21
|
placement={'right'}
|
|
24
|
-
|
|
25
|
-
title={'Manifest JSON'}
|
|
22
|
+
styles={{ content: { width: 400 } }}
|
|
26
23
|
trigger={trigger}
|
|
27
24
|
>
|
|
28
25
|
{children}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ActionIcon, Flexbox } from '@lobehub/ui';
|
|
2
|
-
import { ConfigProvider,
|
|
1
|
+
import { ActionIcon, Flexbox, Popover } from '@lobehub/ui';
|
|
2
|
+
import { ConfigProvider, type TooltipProps } from 'antd';
|
|
3
3
|
import { createStaticStyles, cssVar, cx } from 'antd-style';
|
|
4
4
|
import { XIcon } from 'lucide-react';
|
|
5
5
|
import { type CSSProperties, type FC, type ReactNode } from 'react';
|
|
@@ -111,11 +111,10 @@ const TipGuide: FC<TipGuideProps> = ({
|
|
|
111
111
|
}}
|
|
112
112
|
>
|
|
113
113
|
<Popover
|
|
114
|
-
arrow={
|
|
114
|
+
arrow={true}
|
|
115
115
|
classNames={{
|
|
116
116
|
root: cx(className, styles.overlay),
|
|
117
117
|
}}
|
|
118
|
-
color={'blue'}
|
|
119
118
|
content={
|
|
120
119
|
<Flexbox gap={24} horizontal style={{ userSelect: 'none' }}>
|
|
121
120
|
<div>{title}</div>
|
|
@@ -84,7 +84,11 @@ const Action = memo<ActionProps>(
|
|
|
84
84
|
<ActionPopover
|
|
85
85
|
onOpenChange={setShow}
|
|
86
86
|
open={show}
|
|
87
|
-
trigger={
|
|
87
|
+
trigger={
|
|
88
|
+
Array.isArray(trigger)
|
|
89
|
+
? (trigger.filter((t) => t !== 'contextMenu') as ('click' | 'hover')[])
|
|
90
|
+
: trigger
|
|
91
|
+
}
|
|
88
92
|
{...popover}
|
|
89
93
|
minWidth={mobile ? '100%' : popover.minWidth}
|
|
90
94
|
placement={mobile ? 'top' : (dropdownPlacement ?? popover.placement)}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { Flexbox } from '@lobehub/ui';
|
|
4
|
-
import { Popover, type PopoverProps } from 'antd';
|
|
3
|
+
import { Flexbox, Popover, type PopoverProps } from '@lobehub/ui';
|
|
5
4
|
import { createStaticStyles, cssVar, cx } from 'antd-style';
|
|
6
5
|
import { type ReactNode, memo } from 'react';
|
|
7
6
|
|
|
@@ -23,7 +22,8 @@ const styles = createStaticStyles(({ css }) => ({
|
|
|
23
22
|
`,
|
|
24
23
|
}));
|
|
25
24
|
|
|
26
|
-
export interface ActionPopoverProps extends Omit<PopoverProps, 'title' | 'content'> {
|
|
25
|
+
export interface ActionPopoverProps extends Omit<PopoverProps, 'title' | 'content' | 'children'> {
|
|
26
|
+
children?: ReactNode;
|
|
27
27
|
content?: ReactNode;
|
|
28
28
|
extra?: ReactNode;
|
|
29
29
|
loading?: boolean;
|
|
@@ -45,6 +45,7 @@ const ActionPopover = memo<ActionPopoverProps>(
|
|
|
45
45
|
placement,
|
|
46
46
|
loading,
|
|
47
47
|
extra,
|
|
48
|
+
content,
|
|
48
49
|
...rest
|
|
49
50
|
}) => {
|
|
50
51
|
const isMobile = useIsMobile();
|
|
@@ -52,45 +53,48 @@ const ActionPopover = memo<ActionPopoverProps>(
|
|
|
52
53
|
// Properly handle classNames (can be object or function)
|
|
53
54
|
const resolvedClassNames =
|
|
54
55
|
typeof customClassNames === 'function' ? customClassNames : customClassNames;
|
|
55
|
-
const
|
|
56
|
-
typeof resolvedClassNames === 'object' && resolvedClassNames?.
|
|
57
|
-
? cx(styles.popoverContent, resolvedClassNames.
|
|
56
|
+
const contentClassName =
|
|
57
|
+
typeof resolvedClassNames === 'object' && resolvedClassNames?.content
|
|
58
|
+
? cx(styles.popoverContent, resolvedClassNames.content)
|
|
58
59
|
: styles.popoverContent;
|
|
59
60
|
|
|
60
61
|
// Properly handle styles (can be object or function)
|
|
61
62
|
const resolvedStyles = typeof customStyles === 'function' ? customStyles : customStyles;
|
|
62
|
-
const
|
|
63
|
-
typeof resolvedStyles === 'object' && resolvedStyles?.
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
const contentStyle =
|
|
64
|
+
typeof resolvedStyles === 'object' && resolvedStyles?.content ? resolvedStyles.content : {};
|
|
65
|
+
|
|
66
|
+
// Compose content with optional title
|
|
67
|
+
const popoverContent = (
|
|
68
|
+
<>
|
|
69
|
+
{title && (
|
|
70
|
+
<Flexbox gap={8} horizontal justify={'space-between'} style={{ marginBottom: 16 }}>
|
|
71
|
+
{title}
|
|
72
|
+
{extra}
|
|
73
|
+
{loading && <UpdateLoading style={{ color: cssVar.colorTextSecondary }} />}
|
|
74
|
+
</Flexbox>
|
|
75
|
+
)}
|
|
76
|
+
{content}
|
|
77
|
+
</>
|
|
78
|
+
);
|
|
66
79
|
|
|
67
80
|
return (
|
|
68
81
|
<Popover
|
|
69
|
-
arrow={false}
|
|
70
82
|
classNames={{
|
|
71
83
|
...(typeof resolvedClassNames === 'object' ? resolvedClassNames : {}),
|
|
72
|
-
|
|
84
|
+
content: contentClassName,
|
|
73
85
|
}}
|
|
86
|
+
content={popoverContent}
|
|
74
87
|
placement={isMobile ? 'top' : placement}
|
|
75
88
|
styles={{
|
|
76
89
|
...(typeof resolvedStyles === 'object' ? resolvedStyles : {}),
|
|
77
|
-
|
|
90
|
+
content: {
|
|
78
91
|
maxHeight,
|
|
79
92
|
maxWidth: isMobile ? undefined : maxWidth,
|
|
80
93
|
minWidth: isMobile ? undefined : minWidth,
|
|
81
94
|
width: isMobile ? '100vw' : undefined,
|
|
82
|
-
...
|
|
95
|
+
...contentStyle,
|
|
83
96
|
},
|
|
84
97
|
}}
|
|
85
|
-
title={
|
|
86
|
-
title && (
|
|
87
|
-
<Flexbox gap={8} horizontal justify={'space-between'} style={{ marginBottom: 16 }}>
|
|
88
|
-
{title}
|
|
89
|
-
{extra}
|
|
90
|
-
{loading && <UpdateLoading style={{ color: cssVar.colorTextSecondary }} />}
|
|
91
|
-
</Flexbox>
|
|
92
|
-
)
|
|
93
|
-
}
|
|
94
98
|
{...rest}
|
|
95
99
|
>
|
|
96
100
|
{children}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Block, Text } from '@lobehub/ui';
|
|
2
|
-
import { Popover } from 'antd';
|
|
1
|
+
import { Block, Popover, Text } from '@lobehub/ui';
|
|
3
2
|
import { cx } from 'antd-style';
|
|
4
3
|
import { memo } from 'react';
|
|
5
4
|
import { useTranslation } from 'react-i18next';
|
|
@@ -28,13 +27,12 @@ export const MinimapIndicator = memo<MinimapIndicatorProps>(
|
|
|
28
27
|
|
|
29
28
|
return (
|
|
30
29
|
<Popover
|
|
31
|
-
arrow={false}
|
|
32
30
|
content={popoverContent}
|
|
33
31
|
key={id}
|
|
34
32
|
mouseEnterDelay={0.1}
|
|
35
33
|
placement={'left'}
|
|
36
34
|
styles={{
|
|
37
|
-
|
|
35
|
+
content: {
|
|
38
36
|
width: 320,
|
|
39
37
|
},
|
|
40
38
|
}}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { ActionIcon, Flexbox } from '@lobehub/ui';
|
|
3
|
+
import { ActionIcon, Flexbox, PopoverGroup } from '@lobehub/ui';
|
|
4
4
|
import { cx } from 'antd-style';
|
|
5
5
|
import { ChevronDown, ChevronUp } from 'lucide-react';
|
|
6
6
|
import { memo, useState } from 'react';
|
|
@@ -36,19 +36,21 @@ const ChatMinimap = memo(() => {
|
|
|
36
36
|
size={14}
|
|
37
37
|
/>
|
|
38
38
|
<Flexbox className={styles.railContent}>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
39
|
+
<PopoverGroup contentLayoutAnimation>
|
|
40
|
+
{indicators.map(({ id, width, preview, role, virtuosoIndex }, position) => (
|
|
41
|
+
<MinimapIndicator
|
|
42
|
+
activePosition={activeIndicatorPosition}
|
|
43
|
+
id={id}
|
|
44
|
+
key={id}
|
|
45
|
+
onJump={handleJump}
|
|
46
|
+
position={position}
|
|
47
|
+
preview={preview}
|
|
48
|
+
role={role}
|
|
49
|
+
virtuosoIndex={virtuosoIndex}
|
|
50
|
+
width={width}
|
|
51
|
+
/>
|
|
52
|
+
))}
|
|
53
|
+
</PopoverGroup>
|
|
52
54
|
</Flexbox>
|
|
53
55
|
<ActionIcon
|
|
54
56
|
aria-label={t('minimap.nextMessage')}
|
|
@@ -7,6 +7,8 @@ import dynamic from 'next/dynamic';
|
|
|
7
7
|
import { memo, useMemo } from 'react';
|
|
8
8
|
import { useTranslation } from 'react-i18next';
|
|
9
9
|
|
|
10
|
+
import useBusinessErrorAlertConfig from '@/business/client/hooks/useBusinessErrorAlertConfig';
|
|
11
|
+
import useBusinessErrorContent from '@/business/client/hooks/useBusinessErrorContent';
|
|
10
12
|
import useRenderBusinessChatErrorMessageExtra from '@/business/client/hooks/useRenderBusinessChatErrorMessageExtra';
|
|
11
13
|
import ErrorContent from '@/features/Conversation/ChatItem/components/ErrorContent';
|
|
12
14
|
import { useProviderName } from '@/hooks/useProviderName';
|
|
@@ -85,18 +87,26 @@ const getErrorAlertConfig = (
|
|
|
85
87
|
export const useErrorContent = (error: any) => {
|
|
86
88
|
const { t } = useTranslation('error');
|
|
87
89
|
const providerName = useProviderName(error?.body?.provider || '');
|
|
90
|
+
const businessAlertConfig = useBusinessErrorAlertConfig(error?.type);
|
|
91
|
+
const { errorType: businessErrorType, hideMessage } = useBusinessErrorContent(error?.type);
|
|
88
92
|
|
|
89
93
|
return useMemo<AlertProps | undefined>(() => {
|
|
90
94
|
if (!error) return;
|
|
91
95
|
const messageError = error;
|
|
92
96
|
|
|
93
|
-
|
|
97
|
+
// Use business alert config if provided, otherwise fall back to default
|
|
98
|
+
const alertConfig = businessAlertConfig ?? getErrorAlertConfig(messageError.type);
|
|
99
|
+
|
|
100
|
+
// Use business error type if provided, otherwise use original
|
|
101
|
+
const finalErrorType = businessErrorType ?? messageError.type;
|
|
94
102
|
|
|
95
103
|
return {
|
|
96
|
-
message:
|
|
104
|
+
message: hideMessage
|
|
105
|
+
? undefined
|
|
106
|
+
: t(`response.${finalErrorType}` as any, { provider: providerName }),
|
|
97
107
|
...alertConfig,
|
|
98
108
|
};
|
|
99
|
-
}, [error]);
|
|
109
|
+
}, [businessAlertConfig, businessErrorType, error, hideMessage, providerName, t]);
|
|
100
110
|
};
|
|
101
111
|
|
|
102
112
|
interface ErrorExtraProps {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { Avatar, Flexbox, Text } from '@lobehub/ui';
|
|
4
|
-
import { Popover } from 'antd';
|
|
3
|
+
import { Avatar, Flexbox, Popover, Text } from '@lobehub/ui';
|
|
5
4
|
import { createStaticStyles } from 'antd-style';
|
|
6
5
|
import isEqual from 'fast-deep-equal';
|
|
7
6
|
import { memo } from 'react';
|
|
@@ -75,7 +74,6 @@ const Render = memo<MarkdownElementProps<MentionProps>>(({ children, node }) =>
|
|
|
75
74
|
|
|
76
75
|
return (
|
|
77
76
|
<Popover
|
|
78
|
-
arrow={false}
|
|
79
77
|
content={
|
|
80
78
|
<Flexbox gap={12} style={{ overflow: 'hidden' }} width={320}>
|
|
81
79
|
<Flexbox align="center" gap={8} horizontal>
|
|
@@ -93,7 +91,7 @@ const Render = memo<MarkdownElementProps<MentionProps>>(({ children, node }) =>
|
|
|
93
91
|
</Flexbox>
|
|
94
92
|
</Flexbox>
|
|
95
93
|
}
|
|
96
|
-
trigger=
|
|
94
|
+
trigger="click"
|
|
97
95
|
>
|
|
98
96
|
<span className={styles.mention}>
|
|
99
97
|
{'@'}
|