feat: add copilot setting to config
refactor: move getConfig to actions, extracted Settings
This commit is contained in:
parent
d788ca8eba
commit
79d4d87f24
10 changed files with 140 additions and 113 deletions
|
|
@ -7,7 +7,7 @@ import Chat from './Chat';
|
|||
import EmptyChat from './EmptyChat';
|
||||
import { toast } from 'sonner';
|
||||
import { useSearchParams } from 'next/navigation';
|
||||
import { getSuggestions } from '@/lib/actions';
|
||||
import { getConfig, getSuggestions } from '@/lib/actions';
|
||||
|
||||
export type Message = {
|
||||
id: string;
|
||||
|
|
@ -156,6 +156,15 @@ const ChatWindow = () => {
|
|||
messagesRef.current = messages;
|
||||
}, [messages]);
|
||||
|
||||
useEffect(() => {
|
||||
const fetchConfig = async () => {
|
||||
const config = await getConfig();
|
||||
localStorage.setItem('copilotEnabled', config.copilotEnabled.toString());
|
||||
};
|
||||
|
||||
fetchConfig();
|
||||
});
|
||||
|
||||
const sendMessage = async (message: string) => {
|
||||
if (loading) return;
|
||||
setLoading(true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue