Skip to content

Commit

Permalink
fix: remove settings preparation from sidepanel page
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-jianliang authored Apr 7, 2024
1 parent a309d8c commit ee5ee07
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/pages/sidepanel/SidePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,15 @@ import withErrorBoundary from '@src/shared/hoc/withErrorBoundary';
import { Box, Button, Center, Divider, Grid, GridItem, Text } from '@chakra-ui/react';
import { ChatSession, deleteSession, getSessions } from '@pages/storage/chat';
import ChatBox from '@pages/components/ChatBox';
import EngineSettings from '@src/engines/engineSettings';
import { globalConfigKey_CurrentSessionId, getGlobalConfig, saveGlobalConfig } from '@pages/storage/global';
import { SessionList } from '@pages/sidepanel/SessionList';
import { GLOBAL_CONFIG_KEY_ENGINE_SETTINGS } from '@src/constants';
import { createNewSession } from '@pages/content/storageUtils';
import * as AgentChat from '@src/agent/chat-with-the-bot.json';
import AgentV2 from '@src/agent/agentV2';

const SidePanel = () => {
const [sessions, setSessions] = useState<Map<number, ChatSession>>(new Map<number, ChatSession>());
const [currentSessionId, setCurrentSessionId] = useState<number | null>(null);
const [settings, setSettings] = useState<EngineSettings | null>(null);

const createNewChat = () => {
createNewSession('', AgentChat as unknown as AgentV2).then(id => {
Expand All @@ -27,12 +24,6 @@ const SidePanel = () => {
});
};

useEffect(() => {
getGlobalConfig(GLOBAL_CONFIG_KEY_ENGINE_SETTINGS).then((settings: EngineSettings) => {
setSettings(settings);
});
}, []);

useEffect(() => {
getSessions(100).then(sessions => {
console.log('sessions', sessions);
Expand Down Expand Up @@ -96,7 +87,7 @@ const SidePanel = () => {
/>
</GridItem>
<GridItem pl="2" area={'main'}>
{currentSessionId && <ChatBox inputType="selection" settings={settings} sessionId={currentSessionId} />}
{currentSessionId && <ChatBox inputType="selection" sessionId={currentSessionId} />}
</GridItem>
</Grid>
);
Expand Down

0 comments on commit ee5ee07

Please sign in to comment.