mirror of
https://github.com/lobehub/lobehub.git
synced 2026-03-31 14:09:42 +07:00
♻️ refactor: refactor Conversation to ChatList (#10330)
* update * update * update * update * 🐛 fix(test): update test mocks to use ChatList instead of Conversation - Update AssistantMessageExtra test mocks from @/features/Conversation/components/Extras/* to @/features/ChatList/components/Extras/* - Update ComfyUIForm test mock from @/features/Conversation/Error/style to @/features/ChatList/Error/style Fixes module resolution errors after Conversation -> ChatList refactor 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next';
|
||||
import { Flexbox } from 'react-layout-kit';
|
||||
|
||||
import { type ActionKeys, ChatInputProvider, DesktopChatInput } from '@/features/ChatInput';
|
||||
import WideScreenContainer from '@/features/Conversation/components/WideScreenContainer';
|
||||
import WideScreenContainer from '@/features/ChatList/components/WideScreenContainer';
|
||||
import { useChatStore } from '@/store/chat';
|
||||
import { aiChatSelectors } from '@/store/chat/selectors';
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import { Flexbox } from 'react-layout-kit';
|
||||
|
||||
import { DEFAULT_AVATAR } from '@/const/meta';
|
||||
import { type ActionKeys, ChatInputProvider, DesktopChatInput } from '@/features/ChatInput';
|
||||
import WideScreenContainer from '@/features/Conversation/components/WideScreenContainer';
|
||||
import WideScreenContainer from '@/features/ChatList/components/WideScreenContainer';
|
||||
import { useChatStore } from '@/store/chat';
|
||||
import { aiChatSelectors } from '@/store/chat/selectors';
|
||||
import { useSessionStore } from '@/store/session';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { createStyles } from 'antd-style';
|
||||
import React, { memo } from 'react';
|
||||
|
||||
import { ChatItem } from '@/features/Conversation';
|
||||
import { ChatItem } from '@/features/ChatList';
|
||||
import { useAgentStore } from '@/store/agent';
|
||||
import { agentChatConfigSelectors } from '@/store/agent/selectors';
|
||||
import { useChatStore } from '@/store/chat';
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
import React, { memo, useCallback } from 'react';
|
||||
|
||||
import { SkeletonList, VirtualizedList } from '@/features/Conversation';
|
||||
import WideScreenContainer from '@/features/Conversation/components/WideScreenContainer';
|
||||
import { SkeletonList, VirtualizedList } from '@/features/ChatList';
|
||||
import WideScreenContainer from '@/features/ChatList/components/WideScreenContainer';
|
||||
import { useFetchMessages } from '@/hooks/useFetchMessages';
|
||||
import { useChatStore } from '@/store/chat';
|
||||
import { displayMessageSelectors } from '@/store/chat/selectors';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Suspense, lazy } from 'react';
|
||||
import { Flexbox } from 'react-layout-kit';
|
||||
|
||||
import { SkeletonList } from '@/features/Conversation';
|
||||
import { SkeletonList } from '@/features/ChatList';
|
||||
|
||||
const Content = lazy(() => import('./Content'));
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
getVirtuaGlobalRef,
|
||||
subscribeVirtuaActiveIndex,
|
||||
subscribeVirtuaGlobalRef,
|
||||
} from '@/features/Conversation/components/VirtualizedList/VirtuosoContext';
|
||||
} from '@/features/ChatList/components/VirtualizedList/VirtuosoContext';
|
||||
import { useChatStore } from '@/store/chat';
|
||||
import { displayMessageSelectors } from '@/store/chat/selectors';
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { ModelProvider } from 'model-bank';
|
||||
import { memo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { FormAction } from '@/features/Conversation/Error/style';
|
||||
import { FormAction } from '@/features/ChatList/Error/style';
|
||||
import { aiProviderSelectors, useAiInfraStore } from '@/store/aiInfra';
|
||||
|
||||
const BedrockForm = memo<{ description: string }>(({ description }) => {
|
||||
|
||||
@@ -10,7 +10,7 @@ import { Center, Flexbox } from 'react-layout-kit';
|
||||
|
||||
import { FormInput, FormPassword } from '@/components/FormInput';
|
||||
import KeyValueEditor from '@/components/KeyValueEditor';
|
||||
import { FormAction } from '@/features/Conversation/Error/style';
|
||||
import { FormAction } from '@/features/ChatList/Error/style';
|
||||
import { useAiInfraStore } from '@/store/aiInfra';
|
||||
import { ComfyUIKeyVault } from '@/types/user/settings';
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { ReactNode, memo, useContext, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { FormInput, FormPassword } from '@/components/FormInput';
|
||||
import { FormAction } from '@/features/Conversation/Error/style';
|
||||
import { FormAction } from '@/features/ChatList/Error/style';
|
||||
import { useProviderName } from '@/hooks/useProviderName';
|
||||
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
|
||||
import { GlobalLLMProviderKey } from '@/types/user/settings';
|
||||
|
||||
@@ -97,7 +97,7 @@ vi.mock('react-layout-kit', () => ({
|
||||
)),
|
||||
}));
|
||||
|
||||
vi.mock('@/features/Conversation/Error/style', () => ({
|
||||
vi.mock('@/features/ChatList/Error/style', () => ({
|
||||
FormAction: vi.fn(({ children, title, description, avatar, ...props }) => (
|
||||
<div data-testid="form-action" {...props}>
|
||||
<div data-testid="avatar">{avatar}</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { memo } from 'react';
|
||||
|
||||
import { ErrorActionContainer } from '@/features/Conversation/Error/style';
|
||||
import { ErrorActionContainer } from '@/features/ChatList/Error/style';
|
||||
|
||||
import APIKeyForm from './APIKeyForm';
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { toMarkdown } from 'mdast-util-to-markdown';
|
||||
import { Parent } from 'unist';
|
||||
import { expect } from 'vitest';
|
||||
|
||||
import { treeNodeToString } from '@/features/Conversation/MarkdownElements/remarkPlugins/getNodeContent';
|
||||
import { treeNodeToString } from './getNodeContent';
|
||||
|
||||
describe('treeNodeToString', () => {
|
||||
it('with latex', () => {
|
||||
@@ -5,13 +5,13 @@ import { useSearchParams } from 'next/navigation';
|
||||
import { memo, use, useCallback, useContext, useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import ShareMessageModal from '@/features/Conversation/components/ShareMessageModal';
|
||||
import { VirtuaContext } from '@/features/Conversation/components/VirtualizedList/VirtuosoContext';
|
||||
import { useChatStore } from '@/store/chat';
|
||||
import { messageStateSelectors, threadSelectors } from '@/store/chat/selectors';
|
||||
import { useSessionStore } from '@/store/session';
|
||||
import { sessionSelectors } from '@/store/session/selectors';
|
||||
|
||||
import ShareMessageModal from '../../../components/ShareMessageModal';
|
||||
import { VirtuaContext } from '../../../components/VirtualizedList/VirtuosoContext';
|
||||
import { InPortalThreadContext } from '../../../context/InPortalThreadContext';
|
||||
import { useChatListActionsBar } from '../../../hooks/useChatListActionsBar';
|
||||
import { ErrorActionsBar } from './Error';
|
||||
@@ -9,13 +9,13 @@ import { AssistantMessageExtra } from './index';
|
||||
vi.mock('zustand/traditional');
|
||||
|
||||
// Mock TTS and Translate components
|
||||
vi.mock('@/features/Conversation/components/Extras/TTS', () => ({
|
||||
vi.mock('@/features/ChatList/components/Extras/TTS', () => ({
|
||||
default: vi.fn(() => <div>TTS Component</div>),
|
||||
}));
|
||||
vi.mock('@/features/Conversation/components/Extras/Translate', () => ({
|
||||
vi.mock('@/features/ChatList/components/Extras/Translate', () => ({
|
||||
default: vi.fn(() => <div>Translate Component</div>),
|
||||
}));
|
||||
vi.mock('@/features/Conversation/components/Extras/Usage', () => ({
|
||||
vi.mock('@/features/ChatList/components/Extras/Usage', () => ({
|
||||
default: vi.fn(() => <div>Usage Component</div>),
|
||||
}));
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
import { LOADING_FLAT } from '@lobechat/const';
|
||||
import { ModelPerformance, ModelUsage } from '@lobechat/types';
|
||||
import { memo } from 'react';
|
||||
import { Flexbox } from 'react-layout-kit';
|
||||
|
||||
import { LOADING_FLAT } from '@/const/message';
|
||||
import ExtraContainer from '@/features/Conversation/components/Extras/ExtraContainer';
|
||||
import TTS from '@/features/Conversation/components/Extras/TTS';
|
||||
import Translate from '@/features/Conversation/components/Extras/Translate';
|
||||
import Usage from '@/features/Conversation/components/Extras/Usage';
|
||||
import { useChatStore } from '@/store/chat';
|
||||
import { messageStateSelectors } from '@/store/chat/selectors';
|
||||
|
||||
import ExtraContainer from '../../../components/Extras/ExtraContainer';
|
||||
import TTS from '../../../components/Extras/TTS';
|
||||
import Translate from '../../../components/Extras/Translate';
|
||||
import Usage from '../../../components/Extras/Usage';
|
||||
|
||||
interface AssistantMessageExtraProps {
|
||||
content: string;
|
||||
extra?: any;
|
||||
@@ -3,12 +3,12 @@ import { UIChatMessage } from '@lobechat/types';
|
||||
import { ReactNode, memo } from 'react';
|
||||
import { Flexbox } from 'react-layout-kit';
|
||||
|
||||
import { CollapsedMessage } from '@/features/Conversation/Messages/Assistant/CollapsedMessage';
|
||||
import { useChatStore } from '@/store/chat';
|
||||
import { aiChatSelectors, messageStateSelectors } from '@/store/chat/selectors';
|
||||
|
||||
import { DefaultMessage } from '../Default';
|
||||
import ImageFileListViewer from '../User/ImageFileListViewer';
|
||||
import { CollapsedMessage } from './CollapsedMessage';
|
||||
import FileChunks from './FileChunks';
|
||||
import IntentUnderstanding from './IntentUnderstanding';
|
||||
import Reasoning from './Reasoning';
|
||||
@@ -5,13 +5,13 @@ import { useSearchParams } from 'next/navigation';
|
||||
import { memo, use, useCallback, useContext, useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import ShareMessageModal from '@/features/Conversation/components/ShareMessageModal';
|
||||
import { VirtuaContext } from '@/features/Conversation/components/VirtualizedList/VirtuosoContext';
|
||||
import { useChatStore } from '@/store/chat';
|
||||
import { messageStateSelectors, threadSelectors } from '@/store/chat/selectors';
|
||||
import { useSessionStore } from '@/store/session';
|
||||
import { sessionSelectors } from '@/store/session/selectors';
|
||||
|
||||
import ShareMessageModal from '../../../components/ShareMessageModal';
|
||||
import { VirtuaContext } from '../../../components/VirtualizedList/VirtuosoContext';
|
||||
import { InPortalThreadContext } from '../../../context/InPortalThreadContext';
|
||||
import { useChatListActionsBar } from '../../../hooks/useChatListActionsBar';
|
||||
|
||||
@@ -4,13 +4,13 @@ import { memo, useMemo } from 'react';
|
||||
import { Flexbox } from 'react-layout-kit';
|
||||
|
||||
import { LOADING_FLAT } from '@/const/message';
|
||||
import { markdownElements } from '@/features/Conversation/MarkdownElements';
|
||||
import Reasoning from '@/features/Conversation/Messages/Assistant/Reasoning';
|
||||
import { useChatStore } from '@/store/chat';
|
||||
import { aiChatSelectors, messageStateSelectors } from '@/store/chat/selectors';
|
||||
import { useUserStore } from '@/store/user';
|
||||
import { userGeneralSettingsSelectors } from '@/store/user/selectors';
|
||||
|
||||
import { markdownElements } from '../../MarkdownElements';
|
||||
import Reasoning from '../Assistant/Reasoning';
|
||||
import ImageFileListViewer from '../User/ImageFileListViewer';
|
||||
import ErrorContent from './Error';
|
||||
import MessageContent from './MessageContent';
|
||||
@@ -5,9 +5,10 @@ import { memo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Flexbox } from 'react-layout-kit';
|
||||
|
||||
import ErrorMessageExtra, { useErrorContent } from '@/features/Conversation/Error';
|
||||
import { useChatStore } from '@/store/chat';
|
||||
|
||||
import ErrorMessageExtra, { useErrorContent } from '../../../Error';
|
||||
|
||||
export interface ErrorContentProps {
|
||||
error?: ChatMessageError;
|
||||
id: string;
|
||||
@@ -4,10 +4,10 @@ import isEqual from 'fast-deep-equal';
|
||||
import { memo, useMemo } from 'react';
|
||||
import { Flexbox } from 'react-layout-kit';
|
||||
|
||||
import { CollapsedMessage } from '@/features/Conversation/Messages/Group/CollapsedMessage';
|
||||
import { useChatStore } from '@/store/chat';
|
||||
import { messageStateSelectors } from '@/store/chat/slices/message/selectors';
|
||||
|
||||
import { CollapsedMessage } from './CollapsedMessage';
|
||||
import { GroupMessageContext } from './GroupContext';
|
||||
import GroupItem from './GroupItem';
|
||||
|
||||
@@ -3,10 +3,11 @@ import isEqual from 'fast-deep-equal';
|
||||
import { memo, use } from 'react';
|
||||
import { Flexbox } from 'react-layout-kit';
|
||||
|
||||
import { ContentBlock } from '@/features/Conversation/Messages/Group/ContentBlock';
|
||||
import { VirtuaContext } from '@/features/Conversation/components/VirtualizedList/VirtuosoContext';
|
||||
import { useChatStore } from '@/store/chat';
|
||||
|
||||
import { VirtuaContext } from '../../components/VirtualizedList/VirtuosoContext';
|
||||
import { ContentBlock } from './ContentBlock';
|
||||
|
||||
interface GroupItemProps extends AssistantContentBlock {
|
||||
contentId?: string;
|
||||
disableEditing?: boolean;
|
||||
@@ -5,10 +5,10 @@ import { memo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Flexbox } from 'react-layout-kit';
|
||||
|
||||
import { useGroupMessage } from '@/features/Conversation/Messages/Group/GroupContext';
|
||||
import { useChatStore } from '@/store/chat';
|
||||
import { useUserStore } from '@/store/user';
|
||||
|
||||
import { useGroupMessage } from '../../../GroupContext';
|
||||
import { ApprovalMode } from './index';
|
||||
|
||||
interface ApprovalActionsProps {
|
||||
@@ -3,8 +3,7 @@ import { ChatToolResult, ToolIntervention } from '@lobechat/types';
|
||||
import { Suspense, memo } from 'react';
|
||||
import { Flexbox } from 'react-layout-kit';
|
||||
|
||||
import AbortResponse from '@/features/Conversation/Messages/Group/Tool/Render/AbortResponse';
|
||||
|
||||
import AbortResponse from './AbortResponse';
|
||||
import CustomRender from './CustomRender';
|
||||
import ErrorResponse from './ErrorResponse';
|
||||
import Intervention from './Intervention';
|
||||
@@ -9,7 +9,6 @@ import { Flexbox } from 'react-layout-kit';
|
||||
import Avatar from '@/features/ChatItem/components/Avatar';
|
||||
import BorderSpacing from '@/features/ChatItem/components/BorderSpacing';
|
||||
import Title from '@/features/ChatItem/components/Title';
|
||||
import Usage from '@/features/Conversation/components/Extras/Usage';
|
||||
import { useOpenChatSettings } from '@/hooks/useInterceptingRoutes';
|
||||
import { useAgentStore } from '@/store/agent';
|
||||
import { agentChatConfigSelectors } from '@/store/agent/selectors';
|
||||
@@ -19,6 +18,7 @@ import { useGlobalStore } from '@/store/global';
|
||||
import { useSessionStore } from '@/store/session';
|
||||
import { sessionSelectors } from '@/store/session/selectors';
|
||||
|
||||
import Usage from '../../components/Extras/Usage';
|
||||
import { GroupActionsBar } from './Actions';
|
||||
import EditState from './EditState';
|
||||
import Group from './Group';
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user