Refactor chat panel and move buttons to components folder

- Moved StopButton and RegenerationButton from views to components folder.
- Updated import paths for StopButton and RegenerationButton in ChatPanel.tsx.
- Adjusted import paths for chatSlice in StopButton and RegenerationButton.
- Improved code formatting in ChatPanel.tsx.
This commit is contained in:
Rankin Zheng 2023-08-03 16:34:52 +08:00
parent a9514c62ba
commit 4acbf8a8eb
3 changed files with 8 additions and 8 deletions

View File

@ -6,8 +6,8 @@ import { useResizeObserver, useTimeout, useViewportSize } from '@mantine/hooks';
import messageUtil from '@/util/MessageUtil';
import { useAppDispatch, useAppSelector } from '@/views/hooks';
import CurrentMessage from "@/views/CurrentMessage";
import StopButton from '@/views/StopButton';
import RegenerationButton from '@/views/RegenerationButton';
import StopButton from '@/views/components/StopButton';
import RegenerationButton from '@/views/components/RegenerationButton';
import {
stopGenerating,
@ -21,8 +21,8 @@ import {
onMessagesTop,
onMessagesMiddle,
fetchHistoryMessages,
newMessage,
startSystemMessage,
newMessage,
startSystemMessage,
} from './chatSlice';
import InputMessage from './InputMessage';
@ -82,8 +82,8 @@ const chatPanel = () => {
}
});
messageUtil.registerHandler('systemMessage', (message: { text: string }) => {
dispatch(newMessage({ type: 'system', message: message.text}));
messageUtil.registerHandler('systemMessage', (message: { text: string }) => {
dispatch(newMessage({ type: 'system', message: message.text }));
// start generating
dispatch(startSystemMessage(message.text));
// Clear the input field

View File

@ -6,7 +6,7 @@ import { useAppDispatch } from '@/views/hooks';
import {
reGenerating,
} from './chatSlice';
} from '@/views/chatSlice';
const RegenerationButton = () => {
const dispatch = useAppDispatch();

View File

@ -6,7 +6,7 @@ import { useAppDispatch } from '@/views/hooks';
import {
stopGenerating,
} from './chatSlice';
} from '../../chatSlice';
const StopButton = () => {
const dispatch = useAppDispatch();