@lobehub/chat 1.142.0 → 1.142.2
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 +50 -0
- package/Dockerfile +3 -3
- package/Dockerfile.database +3 -3
- package/Dockerfile.pglite +3 -3
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/changelog/v1.json +18 -0
- package/docs/self-hosting/advanced/model-list.mdx +11 -0
- package/docs/self-hosting/advanced/model-list.zh-CN.mdx +11 -0
- package/docs/self-hosting/environment-variables/model-provider.mdx +23 -14
- package/docs/self-hosting/environment-variables/model-provider.zh-CN.mdx +23 -14
- package/docs/usage/providers/aihubmix.zh-CN.mdx +1 -4
- package/locales/ar/models.json +17 -8
- package/locales/bg-BG/models.json +17 -8
- package/locales/de-DE/models.json +17 -8
- package/locales/en-US/models.json +17 -8
- package/locales/es-ES/models.json +17 -8
- package/locales/fa-IR/models.json +17 -8
- package/locales/fr-FR/models.json +17 -8
- package/locales/it-IT/models.json +17 -8
- package/locales/ja-JP/models.json +17 -8
- package/locales/ko-KR/models.json +17 -8
- package/locales/nl-NL/models.json +17 -8
- package/locales/pl-PL/models.json +17 -8
- package/locales/pt-BR/models.json +17 -8
- package/locales/ru-RU/models.json +17 -8
- package/locales/tr-TR/models.json +17 -8
- package/locales/vi-VN/models.json +17 -8
- package/locales/zh-CN/models.json +17 -8
- package/locales/zh-TW/models.json +17 -8
- package/package.json +2 -2
- package/packages/context-engine/src/processors/__tests__/MessageContent.test.ts +17 -17
- package/packages/context-engine/src/types.ts +4 -4
- package/packages/database/src/models/__tests__/generation.test.ts +2 -2
- package/packages/database/src/models/__tests__/generationBatch.test.ts +1 -1
- package/packages/database/src/models/__tests__/generationTopic.test.ts +2 -4
- package/packages/database/src/models/__tests__/message.test.ts +2 -2
- package/packages/database/src/models/asyncTask.ts +3 -4
- package/packages/database/src/models/chatGroup.ts +2 -2
- package/packages/database/src/models/chunk.ts +2 -3
- package/packages/database/src/models/drizzleMigration.ts +1 -1
- package/packages/database/src/models/file.ts +1 -2
- package/packages/database/src/models/generation.ts +8 -4
- package/packages/database/src/models/generationBatch.ts +1 -1
- package/packages/database/src/models/generationTopic.ts +2 -2
- package/packages/database/src/models/knowledgeBase.ts +2 -3
- package/packages/database/src/models/message.ts +9 -9
- package/packages/database/src/models/session.ts +8 -10
- package/packages/database/src/models/thread.ts +2 -3
- package/packages/database/src/models/topic.ts +2 -4
- package/packages/database/src/models/user.ts +1 -2
- package/packages/database/src/schemas/generation.ts +1 -2
- package/packages/database/src/schemas/message.ts +1 -3
- package/packages/model-runtime/src/core/streams/anthropic.ts +1 -2
- package/packages/model-runtime/src/core/streams/protocol.ts +1 -2
- package/packages/model-runtime/src/core/usageConverters/anthropic.ts +1 -2
- package/packages/model-runtime/src/core/usageConverters/google-ai.ts +1 -2
- package/packages/model-runtime/src/core/usageConverters/utils/computeChatCost.test.ts +1 -2
- package/packages/model-runtime/src/core/usageConverters/utils/computeChatCost.ts +1 -2
- package/packages/model-runtime/src/core/usageConverters/utils/withUsageCost.ts +1 -2
- package/packages/model-runtime/src/types/image.ts +1 -2
- package/packages/prompts/src/chains/__tests__/summaryHistory.test.ts +2 -2
- package/packages/prompts/src/chains/summaryHistory.ts +2 -2
- package/packages/prompts/src/chains/summaryTitle.ts +2 -3
- package/packages/prompts/src/contexts/supervisor/makeDecision.ts +2 -2
- package/packages/prompts/src/prompts/chatMessages/index.test.ts +11 -11
- package/packages/prompts/src/prompts/chatMessages/index.ts +13 -10
- package/packages/prompts/src/prompts/groupChat/index.test.ts +3 -4
- package/packages/prompts/src/prompts/groupChat/index.ts +3 -3
- package/packages/types/src/aiChat.ts +2 -2
- package/packages/types/src/exportConfig.ts +6 -6
- package/packages/types/src/importer.ts +2 -2
- package/packages/types/src/index.ts +2 -0
- package/packages/types/src/message/common/base.ts +27 -0
- package/packages/types/src/message/common/index.ts +5 -0
- package/packages/types/src/message/common/metadata.ts +67 -0
- package/packages/types/src/message/{tools.ts → common/tools.ts} +1 -1
- package/packages/types/src/message/common/translate.ts +8 -0
- package/packages/types/src/message/db/index.ts +2 -0
- package/packages/types/src/message/db/item.ts +29 -0
- package/packages/types/src/message/db/params.ts +57 -0
- package/packages/types/src/message/index.ts +3 -6
- package/packages/types/src/message/{chat.ts → ui/chat.ts} +13 -40
- package/packages/types/src/message/ui/extra.ts +16 -0
- package/packages/types/src/message/ui/index.ts +4 -0
- package/packages/types/src/message/{rag.ts → ui/rag.ts} +11 -1
- package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatInput/V1Mobile/useSend.ts +1 -1
- package/src/app/[variants]/(main)/chat/(workspace)/features/ShareButton/index.tsx +0 -3
- package/src/app/[variants]/(main)/profile/stats/features/ModelsRank.tsx +1 -1
- package/src/app/[variants]/(main)/settings/llm/components/Checker.tsx +1 -2
- package/src/app/[variants]/(main)/settings/provider/detail/ollama/CheckError.tsx +1 -2
- package/src/app/[variants]/(main)/settings/provider/features/CreateNewProvider/index.tsx +1 -2
- package/src/app/[variants]/(main)/settings/provider/features/ProviderConfig/Checker.tsx +1 -2
- package/src/database/_deprecated/models/__tests__/message.test.ts +6 -7
- package/src/database/_deprecated/models/message.ts +13 -13
- package/src/features/AgentSetting/AgentTTS/SelectWithTTSPreview.tsx +1 -1
- package/src/features/ChatInput/ActionBar/STT/browser.tsx +1 -1
- package/src/features/ChatInput/ActionBar/STT/common.tsx +1 -2
- package/src/features/ChatInput/ActionBar/STT/openai.tsx +1 -1
- package/src/features/ChatItem/components/ErrorContent.tsx +5 -0
- package/src/features/Conversation/Error/ErrorJsonViewer.tsx +1 -2
- package/src/features/Conversation/Error/OllamaBizError/index.tsx +2 -3
- package/src/features/Conversation/Error/index.tsx +3 -4
- package/src/features/Conversation/Error/style.tsx +5 -1
- package/src/features/Conversation/Messages/Assistant/Actions/index.tsx +2 -2
- package/src/features/Conversation/Messages/Assistant/Block.tsx +1 -1
- package/src/features/Conversation/Messages/Assistant/Extra/index.test.tsx +2 -2
- package/src/features/Conversation/Messages/Assistant/Extra/index.tsx +1 -1
- package/src/features/Conversation/Messages/Assistant/FileChunks/Item/index.tsx +1 -1
- package/src/features/Conversation/Messages/Assistant/FileChunks/index.tsx +1 -2
- package/src/features/Conversation/Messages/Assistant/MessageContent.tsx +2 -2
- package/src/features/Conversation/Messages/Assistant/Tool/Render/CustomRender.tsx +2 -2
- package/src/features/Conversation/Messages/Assistant/Tool/Render/ErrorResponse.tsx +1 -2
- package/src/features/Conversation/Messages/Assistant/Tool/Render/PluginSettings.tsx +1 -1
- package/src/features/Conversation/Messages/Assistant/index.tsx +2 -2
- package/src/features/Conversation/Messages/Default.tsx +3 -3
- package/src/features/Conversation/Messages/Supervisor/index.tsx +2 -2
- package/src/features/Conversation/Messages/User/Actions.tsx +2 -2
- package/src/features/Conversation/Messages/User/FileListViewer/Item.tsx +1 -1
- package/src/features/Conversation/Messages/User/FileListViewer/index.tsx +1 -2
- package/src/features/Conversation/Messages/User/MessageContent.tsx +2 -3
- package/src/features/Conversation/Messages/User/VideoFileListViewer.tsx +1 -2
- package/src/features/Conversation/Messages/User/index.tsx +2 -2
- package/src/features/Conversation/components/ChatItem/ShareMessageModal/SharePdf/index.tsx +2 -2
- package/src/features/Conversation/components/ChatItem/ShareMessageModal/SharePdf/template.ts +2 -2
- package/src/features/Conversation/components/Extras/TTS/InitPlayer.tsx +1 -1
- package/src/features/Conversation/components/Extras/TTS/Player.tsx +1 -2
- package/src/features/Conversation/components/Extras/Translate.tsx +1 -1
- package/src/features/Conversation/components/Extras/Usage/UsageDetail/index.tsx +1 -1
- package/src/features/Conversation/components/Extras/Usage/UsageDetail/tokens.ts +1 -1
- package/src/features/Conversation/components/Extras/Usage/index.tsx +1 -2
- package/src/features/Conversation/components/ShareMessageModal/ShareImage/Preview.tsx +2 -2
- package/src/features/Conversation/components/ShareMessageModal/ShareImage/index.tsx +2 -2
- package/src/features/Conversation/components/ShareMessageModal/ShareText/index.tsx +2 -2
- package/src/features/Conversation/components/ShareMessageModal/ShareText/template.test.ts +3 -3
- package/src/features/Conversation/components/ShareMessageModal/ShareText/template.ts +2 -2
- package/src/features/Conversation/components/ShareMessageModal/index.tsx +3 -3
- package/src/features/Conversation/types/index.ts +5 -5
- package/src/features/Portal/Home/Body/Files/FileList/Item.tsx +1 -1
- package/src/features/Portal/Home/Body/Plugins/ArtifactList/Item/index.tsx +1 -1
- package/src/features/Portal/Thread/Chat/ChatInput/useSend.ts +1 -1
- package/src/features/ShareModal/ShareJSON/generateMessages.test.ts +3 -3
- package/src/features/ShareModal/ShareJSON/generateMessages.ts +3 -2
- package/src/features/ShareModal/SharePdf/index.tsx +2 -2
- package/src/features/ShareModal/ShareText/template.test.ts +3 -3
- package/src/features/ShareModal/ShareText/template.ts +2 -2
- package/src/libs/langchain/loaders/code/__tests__/long.json +1 -1
- package/src/libs/langchain/loaders/code/__tests__/long.txt +1 -1
- package/src/server/routers/lambda/__tests__/message.test.ts +2 -3
- package/src/server/routers/lambda/message.ts +2 -4
- package/src/services/chat/chat.test.ts +27 -25
- package/src/services/chat/contextEngineering.test.ts +21 -21
- package/src/services/chat/contextEngineering.ts +2 -2
- package/src/services/chat/index.ts +5 -8
- package/src/services/message/_deprecated.test.ts +7 -7
- package/src/services/message/_deprecated.ts +10 -10
- package/src/services/message/client.test.ts +10 -10
- package/src/services/message/client.ts +6 -5
- package/src/services/message/server.ts +4 -3
- package/src/services/message/type.ts +10 -11
- package/src/services/thread/type.ts +2 -1
- package/src/store/chat/helpers.test.ts +5 -5
- package/src/store/chat/helpers.ts +5 -5
- package/src/store/chat/initialState.ts +0 -3
- package/src/store/chat/slices/aiChat/actions/__tests__/fixtures.ts +5 -4
- package/src/store/chat/slices/aiChat/actions/__tests__/generateAIChatV2.test.ts +4 -4
- package/src/store/chat/slices/aiChat/actions/__tests__/rag.test.ts +6 -6
- package/src/store/chat/slices/aiChat/actions/generateAIChat.ts +17 -12
- package/src/store/chat/slices/aiChat/actions/generateAIChatV2.ts +7 -8
- package/src/store/chat/slices/aiChat/actions/generateAIGroupChat.ts +10 -6
- package/src/store/chat/slices/aiChat/actions/memory.ts +2 -3
- package/src/store/chat/slices/builtinTool/actions/__tests__/dalle.test.ts +3 -3
- package/src/store/chat/slices/builtinTool/actions/__tests__/search.test.ts +3 -3
- package/src/store/chat/slices/message/action.test.ts +13 -8
- package/src/store/chat/slices/message/action.ts +19 -18
- package/src/store/chat/slices/message/initialState.ts +3 -2
- package/src/store/chat/slices/message/reducer.test.ts +6 -6
- package/src/store/chat/slices/message/reducer.ts +11 -8
- package/src/store/chat/slices/message/selectors.test.ts +9 -9
- package/src/store/chat/slices/message/selectors.ts +10 -9
- package/src/store/chat/slices/message/supervisor.ts +2 -2
- package/src/store/chat/slices/plugin/action.test.ts +16 -13
- package/src/store/chat/slices/plugin/action.ts +11 -11
- package/src/store/chat/slices/portal/selectors.test.ts +8 -8
- package/src/store/chat/slices/thread/action.test.ts +2 -2
- package/src/store/chat/slices/thread/action.ts +9 -5
- package/src/store/chat/slices/thread/selectors/index.ts +11 -11
- package/src/store/chat/slices/thread/selectors/util.ts +2 -3
- package/src/store/chat/slices/topic/action.test.ts +6 -6
- package/src/store/chat/slices/topic/action.ts +2 -3
- package/src/store/chat/slices/translate/action.ts +2 -3
- package/src/store/chat/slices/tts/action.ts +1 -1
- package/src/store/chat/store.ts +0 -3
- package/src/store/image/slices/createImage/action.test.ts +9 -2
- package/src/store/image/slices/createImage/action.ts +6 -4
- package/src/tools/local-system/Render/ListFiles/Result.tsx +1 -1
- package/src/tools/local-system/Render/ListFiles/index.tsx +1 -1
- package/src/tools/local-system/Render/ReadLocalFile/index.tsx +1 -1
- package/src/tools/local-system/Render/RenameLocalFile/index.tsx +1 -1
- package/src/tools/local-system/Render/RunCommand/index.tsx +1 -1
- package/src/tools/local-system/Render/SearchFiles/index.tsx +1 -1
- package/src/tools/local-system/Render/WriteFile/index.tsx +1 -1
- package/src/tools/web-browsing/Render/Search/index.tsx +1 -3
- package/packages/types/src/message/base.ts +0 -173
- package/packages/types/src/message/translate.ts +0 -4
- package/src/store/chat/slices/share/action.test.ts +0 -22
- package/src/store/chat/slices/share/action.ts +0 -18
- package/src/store/chat/slices/share/initialState.ts +0 -7
- /package/packages/types/src/message/{image.ts → common/image.ts} +0 -0
- /package/packages/types/src/message/{video.ts → ui/video.ts} +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UIChatMessage } from '@lobechat/types';
|
|
1
2
|
import { ReactNode, memo } from 'react';
|
|
2
3
|
import { Flexbox } from 'react-layout-kit';
|
|
3
4
|
|
|
@@ -7,7 +8,6 @@ import ImageFileListViewer from '@/features/Conversation/Messages/User/ImageFile
|
|
|
7
8
|
import VideoFileListViewer from '@/features/Conversation/Messages/User/VideoFileListViewer';
|
|
8
9
|
import { useChatStore } from '@/store/chat';
|
|
9
10
|
import { aiChatSelectors, chatSelectors } from '@/store/chat/selectors';
|
|
10
|
-
import { ChatMessage } from '@/types/message';
|
|
11
11
|
|
|
12
12
|
import { DefaultMessage } from '../Default';
|
|
13
13
|
import FileChunks from './FileChunks';
|
|
@@ -17,7 +17,7 @@ import SearchGrounding from './SearchGrounding';
|
|
|
17
17
|
import Tool from './Tool';
|
|
18
18
|
|
|
19
19
|
export const AssistantMessageContent = memo<
|
|
20
|
-
|
|
20
|
+
UIChatMessage & {
|
|
21
21
|
editableContent: ReactNode;
|
|
22
22
|
}
|
|
23
23
|
>(({ id, tools, content, chunksList, search, imageList, videoList, children, ...props }) => {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UIChatMessage } from '@lobechat/types';
|
|
1
2
|
import { ActionIcon } from '@lobehub/ui';
|
|
2
3
|
import { App } from 'antd';
|
|
3
4
|
import { Edit3Icon, PlayCircleIcon } from 'lucide-react';
|
|
@@ -10,7 +11,6 @@ import PluginResult from '@/features/Conversation/Messages/Assistant/Tool/Inspec
|
|
|
10
11
|
import PluginRender from '@/features/PluginsUI/Render';
|
|
11
12
|
import { useChatStore } from '@/store/chat';
|
|
12
13
|
import { chatSelectors } from '@/store/chat/selectors';
|
|
13
|
-
import { ChatMessage } from '@/types/message';
|
|
14
14
|
|
|
15
15
|
import Arguments from './Arguments';
|
|
16
16
|
import KeyValueEditor from './KeyValueEditor';
|
|
@@ -24,7 +24,7 @@ const safeParseJson = (str: string): Record<string, any> => {
|
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
interface CustomRenderProps extends
|
|
27
|
+
interface CustomRenderProps extends UIChatMessage {
|
|
28
28
|
requestArgs?: string;
|
|
29
29
|
setShowPluginRender: (value: boolean) => void;
|
|
30
30
|
showPluginRender: boolean;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
+
import { ChatMessageError, ChatPluginPayload } from '@lobechat/types';
|
|
1
2
|
import { Alert, Highlighter } from '@lobehub/ui';
|
|
2
3
|
import { memo } from 'react';
|
|
3
4
|
import { useTranslation } from 'react-i18next';
|
|
4
5
|
import { Flexbox } from 'react-layout-kit';
|
|
5
6
|
|
|
6
|
-
import { ChatMessageError, ChatPluginPayload } from '@/types/message';
|
|
7
|
-
|
|
8
7
|
import PluginSettings from './PluginSettings';
|
|
9
8
|
|
|
10
9
|
interface ErrorResponseProps extends ChatMessageError {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ChatPluginPayload } from '@lobechat/types';
|
|
1
2
|
import { Avatar, Button } from '@lobehub/ui';
|
|
2
3
|
import { Divider } from 'antd';
|
|
3
4
|
import { useTheme } from 'antd-style';
|
|
@@ -10,7 +11,6 @@ import PluginSettingsConfig from '@/features/PluginSettings';
|
|
|
10
11
|
import { useChatStore } from '@/store/chat';
|
|
11
12
|
import { pluginHelpers, useToolStore } from '@/store/tool';
|
|
12
13
|
import { pluginSelectors } from '@/store/tool/selectors';
|
|
13
|
-
import { ChatPluginPayload } from '@/types/message';
|
|
14
14
|
|
|
15
15
|
import { ErrorActionContainer, useStyles } from '../../../../Error/style';
|
|
16
16
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { UIChatMessage } from '@lobechat/types';
|
|
4
4
|
import { Tag } from '@lobehub/ui';
|
|
5
5
|
import { useResponsive } from 'antd-style';
|
|
6
6
|
import { ReactNode, memo, useCallback, useMemo } from 'react';
|
|
@@ -47,7 +47,7 @@ const isHtmlCode = (content: string, language: string) => {
|
|
|
47
47
|
};
|
|
48
48
|
const MOBILE_AVATAR_SIZE = 32;
|
|
49
49
|
|
|
50
|
-
interface AssistantMessageProps extends
|
|
50
|
+
interface AssistantMessageProps extends UIChatMessage {
|
|
51
51
|
disableEditing?: boolean;
|
|
52
52
|
index: number;
|
|
53
53
|
showTitle?: boolean;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { UIChatMessage } from '@lobechat/types';
|
|
1
2
|
import { ReactNode, memo } from 'react';
|
|
2
3
|
|
|
3
4
|
import BubblesLoading from '@/components/BubblesLoading';
|
|
4
5
|
import { LOADING_FLAT } from '@/const/message';
|
|
5
6
|
import { useChatStore } from '@/store/chat';
|
|
6
7
|
import { chatSelectors } from '@/store/chat/selectors';
|
|
7
|
-
import { ChatMessage } from '@/types/message';
|
|
8
8
|
|
|
9
9
|
export const DefaultMessage = memo<
|
|
10
|
-
|
|
10
|
+
UIChatMessage & {
|
|
11
11
|
addIdOnDOM?: boolean;
|
|
12
12
|
editableContent: ReactNode;
|
|
13
13
|
isToolCallGenerating?: boolean;
|
|
@@ -22,6 +22,6 @@ export const DefaultMessage = memo<
|
|
|
22
22
|
return <div id={addIdOnDOM ? id : undefined}>{editableContent}</div>;
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
export const DefaultBelowMessage = memo<
|
|
25
|
+
export const DefaultBelowMessage = memo<UIChatMessage>(() => {
|
|
26
26
|
return null;
|
|
27
27
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import { UIChatMessage } from '@lobechat/types';
|
|
3
4
|
import { ModelIcon } from '@lobehub/icons';
|
|
4
5
|
import { Button, Text } from '@lobehub/ui';
|
|
5
6
|
import { createStyles, useTheme } from 'antd-style';
|
|
@@ -12,7 +13,6 @@ import { DEFAULT_SUPERVISOR_AVATAR } from '@/const/meta';
|
|
|
12
13
|
import { ChatItem } from '@/features/ChatItem';
|
|
13
14
|
import { useChatStore } from '@/store/chat';
|
|
14
15
|
import { ChatErrorType } from '@/types/fetch';
|
|
15
|
-
import { ChatMessage } from '@/types/message';
|
|
16
16
|
|
|
17
17
|
import TodoList, { TodoData } from './TodoList';
|
|
18
18
|
|
|
@@ -54,7 +54,7 @@ const parseMarkdownTodos = (content: string): TodoData => {
|
|
|
54
54
|
};
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
-
interface SupervisorMessageProps extends
|
|
57
|
+
interface SupervisorMessageProps extends UIChatMessage {
|
|
58
58
|
disableEditing?: boolean;
|
|
59
59
|
index: number;
|
|
60
60
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UIChatMessage } from '@lobechat/types';
|
|
2
2
|
import { ActionIconGroup } from '@lobehub/ui';
|
|
3
3
|
import { ActionIconGroupItemType } from '@lobehub/ui/es/ActionIconGroup';
|
|
4
4
|
import { ActionIconGroupEvent } from '@lobehub/ui/es/ActionIconGroup/type';
|
|
@@ -17,7 +17,7 @@ import { InPortalThreadContext } from '../../context/InPortalThreadContext';
|
|
|
17
17
|
import { useChatListActionsBar } from '../../hooks/useChatListActionsBar';
|
|
18
18
|
|
|
19
19
|
interface UserActionsProps {
|
|
20
|
-
data:
|
|
20
|
+
data: UIChatMessage;
|
|
21
21
|
id: string;
|
|
22
22
|
index: number;
|
|
23
23
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ChatFileItem } from '@lobechat/types';
|
|
1
2
|
import { Text } from '@lobehub/ui';
|
|
2
3
|
import { createStyles } from 'antd-style';
|
|
3
4
|
import { memo } from 'react';
|
|
@@ -5,7 +6,6 @@ import { Flexbox } from 'react-layout-kit';
|
|
|
5
6
|
|
|
6
7
|
import FileIcon from '@/components/FileIcon';
|
|
7
8
|
import { useChatStore } from '@/store/chat';
|
|
8
|
-
import { ChatFileItem } from '@/types/message';
|
|
9
9
|
import { formatSize } from '@/utils/format';
|
|
10
10
|
|
|
11
11
|
const useStyles = createStyles(({ css, token, isDarkMode }) => ({
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
+
import { UIChatMessage } from '@lobechat/types';
|
|
1
2
|
import { ReactNode, memo } from 'react';
|
|
2
3
|
import { Flexbox } from 'react-layout-kit';
|
|
3
4
|
|
|
4
|
-
import { ChatMessage } from '@/types/message';
|
|
5
|
-
|
|
6
5
|
import FileListViewer from './FileListViewer';
|
|
7
6
|
import ImageFileListViewer from './ImageFileListViewer';
|
|
8
7
|
import VideoFileListViewer from './VideoFileListViewer';
|
|
9
8
|
|
|
10
9
|
export const UserMessageContent = memo<
|
|
11
|
-
|
|
10
|
+
UIChatMessage & {
|
|
12
11
|
editableContent: ReactNode;
|
|
13
12
|
}
|
|
14
13
|
>(({ id, editableContent, imageList, videoList, fileList }) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UIChatMessage } from '@lobechat/types';
|
|
2
2
|
import { Tag } from '@lobehub/ui';
|
|
3
3
|
import { useResponsive } from 'antd-style';
|
|
4
4
|
import { ReactNode, memo, useCallback, useMemo } from 'react';
|
|
@@ -28,7 +28,7 @@ import { UserMessageExtra } from './Extra';
|
|
|
28
28
|
import { MarkdownRender as UserMarkdownRender } from './MarkdownRender';
|
|
29
29
|
import { UserMessageContent } from './MessageContent';
|
|
30
30
|
|
|
31
|
-
interface UserMessageProps extends
|
|
31
|
+
interface UserMessageProps extends UIChatMessage {
|
|
32
32
|
disableEditing?: boolean;
|
|
33
33
|
index: number;
|
|
34
34
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UIChatMessage } from '@lobechat/types';
|
|
1
2
|
import { Button } from '@lobehub/ui';
|
|
2
3
|
import { App } from 'antd';
|
|
3
4
|
import { DownloadIcon, FileText } from 'lucide-react';
|
|
@@ -7,7 +8,6 @@ import { Flexbox } from 'react-layout-kit';
|
|
|
7
8
|
|
|
8
9
|
import { useIsMobile } from '@/hooks/useIsMobile';
|
|
9
10
|
import { useChatStore } from '@/store/chat';
|
|
10
|
-
import { ChatMessage } from '@/types/message';
|
|
11
11
|
|
|
12
12
|
import PdfPreview from './PdfPreview';
|
|
13
13
|
import { useContainerStyles, useStyles } from './style';
|
|
@@ -15,7 +15,7 @@ import { generateMarkdown } from './template';
|
|
|
15
15
|
import { usePdfGeneration } from './usePdfGeneration';
|
|
16
16
|
|
|
17
17
|
interface SharePdfProps {
|
|
18
|
-
message:
|
|
18
|
+
message: UIChatMessage;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
const SharePdf = memo<SharePdfProps>(({ message }) => {
|
package/src/features/Conversation/components/ChatItem/ShareMessageModal/SharePdf/template.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { UIChatMessage } from '@lobechat/types';
|
|
1
2
|
import { template } from 'lodash-es';
|
|
2
3
|
|
|
3
4
|
import { LOADING_FLAT } from '@/const/message';
|
|
4
|
-
import { ChatMessage } from '@/types/message';
|
|
5
5
|
|
|
6
6
|
const markdownTemplate = template(`{{message.content}}`, {
|
|
7
7
|
evaluate: /<%([\S\s]+?)%>/g,
|
|
@@ -9,7 +9,7 @@ const markdownTemplate = template(`{{message.content}}`, {
|
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
interface MarkdownParams {
|
|
12
|
-
message:
|
|
12
|
+
message: UIChatMessage;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export const generateMarkdown = ({ message }: MarkdownParams) => {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { ChatMessageError, ChatTTS } from '@lobechat/types';
|
|
1
2
|
import { memo, useCallback, useEffect, useState } from 'react';
|
|
2
3
|
import { useTranslation } from 'react-i18next';
|
|
3
4
|
|
|
4
5
|
import { useTTS } from '@/hooks/useTTS';
|
|
5
6
|
import { useChatStore } from '@/store/chat';
|
|
6
7
|
import { useFileStore } from '@/store/file';
|
|
7
|
-
import { ChatMessageError, ChatTTS } from '@/types/message';
|
|
8
8
|
import { getMessageError } from '@/utils/fetch';
|
|
9
9
|
|
|
10
10
|
import Player from './Player';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ChatMessageError } from '@lobechat/types';
|
|
1
2
|
import { AudioPlayer, AudioPlayerProps } from '@lobehub/tts/react';
|
|
2
3
|
import { ActionIcon, Alert, Button, Highlighter } from '@lobehub/ui';
|
|
3
4
|
import { TrashIcon } from 'lucide-react';
|
|
@@ -5,8 +6,6 @@ import { memo } from 'react';
|
|
|
5
6
|
import { useTranslation } from 'react-i18next';
|
|
6
7
|
import { Flexbox } from 'react-layout-kit';
|
|
7
8
|
|
|
8
|
-
import { ChatMessageError } from '@/types/message';
|
|
9
|
-
|
|
10
9
|
interface PlayerProps extends AudioPlayerProps {
|
|
11
10
|
error?: ChatMessageError;
|
|
12
11
|
onDelete: () => void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ChatTranslate } from '@lobechat/types';
|
|
1
2
|
import { ActionIcon, Icon, Markdown, Tag, copyToClipboard } from '@lobehub/ui';
|
|
2
3
|
import { App } from 'antd';
|
|
3
4
|
import { useTheme } from 'antd-style';
|
|
@@ -8,7 +9,6 @@ import { Flexbox } from 'react-layout-kit';
|
|
|
8
9
|
|
|
9
10
|
import BubblesLoading from '@/components/BubblesLoading';
|
|
10
11
|
import { useChatStore } from '@/store/chat';
|
|
11
|
-
import { ChatTranslate } from '@/types/message';
|
|
12
12
|
|
|
13
13
|
interface TranslateProps extends ChatTranslate {
|
|
14
14
|
id: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MessageMetadata } from '@lobechat/types';
|
|
1
2
|
import { Icon } from '@lobehub/ui';
|
|
2
3
|
import { Divider, Popover } from 'antd';
|
|
3
4
|
import { useTheme } from 'antd-style';
|
|
@@ -10,7 +11,6 @@ import InfoTooltip from '@/components/InfoTooltip';
|
|
|
10
11
|
import { aiModelSelectors, useAiInfraStore } from '@/store/aiInfra';
|
|
11
12
|
import { useGlobalStore } from '@/store/global';
|
|
12
13
|
import { systemStatusSelectors } from '@/store/global/selectors';
|
|
13
|
-
import { MessageMetadata } from '@/types/message';
|
|
14
14
|
import { formatNumber } from '@/utils/format';
|
|
15
15
|
|
|
16
16
|
import ModelCard from './ModelCard';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { ModelTokensUsage } from '@lobechat/types';
|
|
1
2
|
import { LobeDefaultAiModelListItem } from 'model-bank';
|
|
2
3
|
|
|
3
|
-
import type { ModelTokensUsage } from '@/types/message';
|
|
4
4
|
import { getAudioInputUnitRate, getAudioOutputUnitRate } from '@/utils/pricing';
|
|
5
5
|
|
|
6
6
|
import { getPrice } from './pricing';
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
+
import { MessageMetadata } from '@lobechat/types';
|
|
1
2
|
import { ModelIcon } from '@lobehub/icons';
|
|
2
3
|
import { createStyles } from 'antd-style';
|
|
3
4
|
import { memo } from 'react';
|
|
4
5
|
import { Center, Flexbox } from 'react-layout-kit';
|
|
5
6
|
|
|
6
|
-
import { MessageMetadata } from '@/types/message';
|
|
7
|
-
|
|
8
7
|
import TokenDetail from './UsageDetail';
|
|
9
8
|
|
|
10
9
|
export const useStyles = createStyles(({ token, css, cx }) => ({
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UIChatMessage } from '@lobechat/types';
|
|
1
2
|
import { ModelTag } from '@lobehub/icons';
|
|
2
3
|
import { Avatar } from '@lobehub/ui';
|
|
3
4
|
import { ChatHeaderTitle } from '@lobehub/ui/chat';
|
|
@@ -12,7 +13,6 @@ import { useAgentStore } from '@/store/agent';
|
|
|
12
13
|
import { agentSelectors } from '@/store/agent/selectors';
|
|
13
14
|
import { useSessionStore } from '@/store/session';
|
|
14
15
|
import { sessionMetaSelectors, sessionSelectors } from '@/store/session/selectors';
|
|
15
|
-
import { ChatMessage } from '@/types/message';
|
|
16
16
|
|
|
17
17
|
import pkg from '../../../../../../package.json';
|
|
18
18
|
import { useContainerStyles } from '../style';
|
|
@@ -20,7 +20,7 @@ import { useStyles } from './style';
|
|
|
20
20
|
import { FieldType } from './type';
|
|
21
21
|
|
|
22
22
|
interface PreviewProps extends FieldType {
|
|
23
|
-
message:
|
|
23
|
+
message: UIChatMessage;
|
|
24
24
|
previewId?: string;
|
|
25
25
|
title?: string;
|
|
26
26
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UIChatMessage } from '@lobechat/types';
|
|
1
2
|
import { Button, Form, type FormItemProps, Segmented } from '@lobehub/ui';
|
|
2
3
|
import { Switch } from 'antd';
|
|
3
4
|
import { CopyIcon } from 'lucide-react';
|
|
@@ -11,7 +12,6 @@ import { useIsMobile } from '@/hooks/useIsMobile';
|
|
|
11
12
|
import { ImageType, imageTypeOptions, useScreenshot } from '@/hooks/useScreenshot';
|
|
12
13
|
import { useSessionStore } from '@/store/session';
|
|
13
14
|
import { sessionMetaSelectors } from '@/store/session/selectors';
|
|
14
|
-
import { ChatMessage } from '@/types/message';
|
|
15
15
|
|
|
16
16
|
import { useStyles } from '../style';
|
|
17
17
|
import Preview from './Preview';
|
|
@@ -23,7 +23,7 @@ const DEFAULT_FIELD_VALUE: FieldType = {
|
|
|
23
23
|
withFooter: true,
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
const ShareImage = memo<{ message:
|
|
26
|
+
const ShareImage = memo<{ message: UIChatMessage; mobile?: boolean; uniqueId?: string }>(
|
|
27
27
|
({ message, uniqueId }) => {
|
|
28
28
|
const currentAgentTitle = useSessionStore(sessionMetaSelectors.currentAgentTitle);
|
|
29
29
|
const [fieldValue, setFieldValue] = useState<FieldType>(DEFAULT_FIELD_VALUE);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UIChatMessage } from '@lobechat/types';
|
|
1
2
|
import { Button, copyToClipboard } from '@lobehub/ui';
|
|
2
3
|
import { App } from 'antd';
|
|
3
4
|
import isEqual from 'fast-deep-equal';
|
|
@@ -9,7 +10,6 @@ import { Flexbox } from 'react-layout-kit';
|
|
|
9
10
|
import { useIsMobile } from '@/hooks/useIsMobile';
|
|
10
11
|
import { useChatStore } from '@/store/chat';
|
|
11
12
|
import { topicSelectors } from '@/store/chat/selectors';
|
|
12
|
-
import { ChatMessage } from '@/types/message';
|
|
13
13
|
import { exportFile } from '@/utils/client';
|
|
14
14
|
|
|
15
15
|
import { useStyles } from '../style';
|
|
@@ -17,7 +17,7 @@ import Preview from './Preview';
|
|
|
17
17
|
import { generateMarkdown } from './template';
|
|
18
18
|
|
|
19
19
|
interface ShareTextProps {
|
|
20
|
-
item:
|
|
20
|
+
item: UIChatMessage;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
const ShareText = memo<ShareTextProps>(({ item }) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { UIChatMessage } from '@lobechat/types';
|
|
1
2
|
import { describe, expect, it } from 'vitest';
|
|
2
3
|
|
|
3
4
|
import { LOADING_FLAT } from '@/const/message';
|
|
4
|
-
import { ChatMessage } from '@/types/message';
|
|
5
5
|
|
|
6
6
|
import { generateMarkdown } from './template';
|
|
7
7
|
|
|
@@ -40,7 +40,7 @@ describe('generateMarkdown', () => {
|
|
|
40
40
|
createdAt: Date.now(),
|
|
41
41
|
tools: [{ name: 'calculator', result: '42' }],
|
|
42
42
|
},
|
|
43
|
-
] as
|
|
43
|
+
] as UIChatMessage[];
|
|
44
44
|
|
|
45
45
|
const defaultParams = {
|
|
46
46
|
messages: mockMessages,
|
|
@@ -66,7 +66,7 @@ describe('generateMarkdown', () => {
|
|
|
66
66
|
role: 'user',
|
|
67
67
|
createdAt: Date.now(),
|
|
68
68
|
},
|
|
69
|
-
] as
|
|
69
|
+
] as UIChatMessage[];
|
|
70
70
|
|
|
71
71
|
const result = generateMarkdown({
|
|
72
72
|
...defaultParams,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { UIChatMessage } from '@lobechat/types';
|
|
1
2
|
import { template } from 'lodash-es';
|
|
2
3
|
|
|
3
4
|
import { LOADING_FLAT } from '@/const/message';
|
|
4
|
-
import { ChatMessage } from '@/types/message';
|
|
5
5
|
|
|
6
6
|
const markdownTemplate = template(
|
|
7
7
|
`<% messages.forEach(function(chat) { %>
|
|
@@ -17,7 +17,7 @@ const markdownTemplate = template(
|
|
|
17
17
|
);
|
|
18
18
|
|
|
19
19
|
interface MarkdownParams {
|
|
20
|
-
messages:
|
|
20
|
+
messages: UIChatMessage[];
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export const generateMarkdown = ({ messages }: MarkdownParams) =>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import { UIChatMessage } from '@lobechat/types';
|
|
1
2
|
import { Modal, Segmented, Tabs } from '@lobehub/ui';
|
|
2
3
|
import { memo, useId, useMemo, useState } from 'react';
|
|
3
4
|
import { useTranslation } from 'react-i18next';
|
|
4
5
|
import { Flexbox } from 'react-layout-kit';
|
|
5
6
|
|
|
6
7
|
import { isServerMode } from '@/const/version';
|
|
8
|
+
import SharePdf from '@/features/ShareModal/SharePdf';
|
|
7
9
|
import { useIsMobile } from '@/hooks/useIsMobile';
|
|
8
|
-
import { ChatMessage } from '@/types/message';
|
|
9
10
|
|
|
10
11
|
import ShareImage from './ShareImage';
|
|
11
12
|
import ShareText from './ShareText';
|
|
12
|
-
import SharePdf from '@/features/ShareModal/SharePdf';
|
|
13
13
|
|
|
14
14
|
enum Tab {
|
|
15
15
|
PDF = 'pdf',
|
|
@@ -18,7 +18,7 @@ enum Tab {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
interface ShareModalProps {
|
|
21
|
-
message:
|
|
21
|
+
message: UIChatMessage;
|
|
22
22
|
onCancel: () => void;
|
|
23
23
|
open: boolean;
|
|
24
24
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { UIChatMessage } from '@lobechat/types';
|
|
1
2
|
import { type ChatItemProps } from '@lobehub/ui/chat';
|
|
2
3
|
import { FC, ReactNode } from 'react';
|
|
3
4
|
|
|
4
5
|
import { LLMRoleType } from '@/types/llm';
|
|
5
|
-
import { ChatMessage } from '@/types/message';
|
|
6
6
|
|
|
7
7
|
export type RenderRole = LLMRoleType | 'default' | 'history' | string;
|
|
8
|
-
export type RenderMessage = FC<
|
|
9
|
-
export type RenderBelowMessage = FC<
|
|
10
|
-
export type RenderMessageExtra = FC<
|
|
8
|
+
export type RenderMessage = FC<UIChatMessage & { editableContent: ReactNode }>;
|
|
9
|
+
export type RenderBelowMessage = FC<UIChatMessage>;
|
|
10
|
+
export type RenderMessageExtra = FC<UIChatMessage>;
|
|
11
11
|
export type MarkdownCustomRender = (props: {
|
|
12
12
|
displayMode: 'chat' | 'docs';
|
|
13
13
|
dom: ReactNode;
|
|
@@ -15,7 +15,7 @@ export type MarkdownCustomRender = (props: {
|
|
|
15
15
|
text: string;
|
|
16
16
|
}) => ReactNode;
|
|
17
17
|
|
|
18
|
-
export type RenderItem = FC<{ key: string } &
|
|
18
|
+
export type RenderItem = FC<{ key: string } & UIChatMessage & ListItemProps>;
|
|
19
19
|
|
|
20
20
|
export interface ListItemProps {
|
|
21
21
|
groupNav?: ChatItemProps['avatarAddon'];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ChatFileItem } from '@lobechat/types';
|
|
1
2
|
import { Text } from '@lobehub/ui';
|
|
2
3
|
import { createStyles } from 'antd-style';
|
|
3
4
|
import { memo } from 'react';
|
|
@@ -5,7 +6,6 @@ import { Flexbox } from 'react-layout-kit';
|
|
|
5
6
|
|
|
6
7
|
import FileIcon from '@/components/FileIcon';
|
|
7
8
|
import { useChatStore } from '@/store/chat';
|
|
8
|
-
import { ChatFileItem } from '@/types/message';
|
|
9
9
|
import { formatSize } from '@/utils/format';
|
|
10
10
|
|
|
11
11
|
const useStyles = createStyles(({ css, token }) => ({
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ChatPluginPayload } from '@lobechat/types';
|
|
1
2
|
import { Icon, Tag, Text } from '@lobehub/ui';
|
|
2
3
|
import isEqual from 'fast-deep-equal';
|
|
3
4
|
import { CircuitBoard } from 'lucide-react';
|
|
@@ -10,7 +11,6 @@ import { useYamlArguments } from '@/hooks/useYamlArguments';
|
|
|
10
11
|
import { useChatStore } from '@/store/chat';
|
|
11
12
|
import { pluginHelpers, useToolStore } from '@/store/tool';
|
|
12
13
|
import { toolSelectors } from '@/store/tool/selectors';
|
|
13
|
-
import { ChatPluginPayload } from '@/types/message';
|
|
14
14
|
|
|
15
15
|
import { useStyles } from './style';
|
|
16
16
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SendMessageParams } from '@lobechat/types';
|
|
1
2
|
import { useMemo, useState } from 'react';
|
|
2
3
|
|
|
3
4
|
import { useGeminiChineseWarning } from '@/hooks/useGeminiChineseWarning';
|
|
@@ -5,7 +6,6 @@ import { getAgentStoreState } from '@/store/agent';
|
|
|
5
6
|
import { agentSelectors } from '@/store/agent/slices/chat';
|
|
6
7
|
import { useChatStore } from '@/store/chat';
|
|
7
8
|
import { threadSelectors } from '@/store/chat/selectors';
|
|
8
|
-
import { SendMessageParams } from '@/types/message';
|
|
9
9
|
|
|
10
10
|
export type UseSendMessageParams = Pick<
|
|
11
11
|
SendMessageParams,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { UIChatMessage } from '@lobechat/types';
|
|
1
2
|
import { describe, expect, it } from 'vitest';
|
|
2
3
|
|
|
3
4
|
import { LOADING_FLAT } from '@/const/message';
|
|
4
|
-
import { ChatMessage } from '@/types/message';
|
|
5
5
|
|
|
6
6
|
import { generateMessages } from './generateMessages';
|
|
7
7
|
|
|
@@ -33,7 +33,7 @@ describe('generateMessages', () => {
|
|
|
33
33
|
createdAt: Date.now(),
|
|
34
34
|
tool_call_id: 'tool1',
|
|
35
35
|
},
|
|
36
|
-
] as
|
|
36
|
+
] as UIChatMessage[];
|
|
37
37
|
|
|
38
38
|
it('should filter out loading messages', () => {
|
|
39
39
|
const result = generateMessages({
|
|
@@ -109,7 +109,7 @@ describe('generateMessages', () => {
|
|
|
109
109
|
role: 'user',
|
|
110
110
|
createdAt: Date.now(),
|
|
111
111
|
},
|
|
112
|
-
] as
|
|
112
|
+
] as UIChatMessage[];
|
|
113
113
|
|
|
114
114
|
const result = generateMessages({
|
|
115
115
|
messages: messagesWithSpaces,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { UIChatMessage } from '@lobechat/types';
|
|
2
|
+
|
|
1
3
|
import { LOADING_FLAT } from '@/const/message';
|
|
2
|
-
import { ChatMessage } from '@/types/message';
|
|
3
4
|
|
|
4
5
|
import { FieldType } from './type';
|
|
5
6
|
|
|
6
7
|
interface JSONParams extends FieldType {
|
|
7
|
-
messages:
|
|
8
|
+
messages: UIChatMessage[];
|
|
8
9
|
systemRole: string;
|
|
9
10
|
}
|
|
10
11
|
export const generateMessages = ({
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UIChatMessage } from '@lobechat/types';
|
|
1
2
|
import { Button, Form, type FormItemProps } from '@lobehub/ui';
|
|
2
3
|
import { App, Switch } from 'antd';
|
|
3
4
|
import isEqual from 'fast-deep-equal';
|
|
@@ -18,7 +19,6 @@ import { FieldType } from '../ShareText/type';
|
|
|
18
19
|
import { useContainerStyles, useStyles } from '../style';
|
|
19
20
|
import PdfPreview from './PdfPreview';
|
|
20
21
|
import { usePdfGeneration } from './usePdfGeneration';
|
|
21
|
-
import { ChatMessage } from '@/types/message';
|
|
22
22
|
|
|
23
23
|
const DEFAULT_FIELD_VALUE: FieldType = {
|
|
24
24
|
includeTool: true,
|
|
@@ -27,7 +27,7 @@ const DEFAULT_FIELD_VALUE: FieldType = {
|
|
|
27
27
|
withSystemRole: false,
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
const SharePdf = memo((props: {message?:
|
|
30
|
+
const SharePdf = memo((props: { message?: UIChatMessage }) => {
|
|
31
31
|
const [fieldValue, setFieldValue] = useState(DEFAULT_FIELD_VALUE);
|
|
32
32
|
const { t } = useTranslation(['chat', 'common']);
|
|
33
33
|
const { styles } = useStyles();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { UIChatMessage } from '@lobechat/types';
|
|
1
2
|
import { describe, expect, it } from 'vitest';
|
|
2
3
|
|
|
3
4
|
import { LOADING_FLAT } from '@/const/message';
|
|
4
|
-
import { ChatMessage } from '@/types/message';
|
|
5
5
|
|
|
6
6
|
import { generateMarkdown } from './template';
|
|
7
7
|
|
|
@@ -40,7 +40,7 @@ describe('generateMarkdown', () => {
|
|
|
40
40
|
createdAt: Date.now(),
|
|
41
41
|
tools: [{ name: 'calculator', result: '42' }],
|
|
42
42
|
},
|
|
43
|
-
] as
|
|
43
|
+
] as UIChatMessage[];
|
|
44
44
|
|
|
45
45
|
const defaultParams = {
|
|
46
46
|
messages: mockMessages,
|
|
@@ -166,7 +166,7 @@ describe('generateMarkdown', () => {
|
|
|
166
166
|
role: 'user',
|
|
167
167
|
createdAt: Date.now(),
|
|
168
168
|
},
|
|
169
|
-
] as
|
|
169
|
+
] as UIChatMessage[];
|
|
170
170
|
|
|
171
171
|
const result = generateMarkdown({
|
|
172
172
|
...defaultParams,
|