import { useState } from 'react' import { ChatCompletionRole, EventName, MessageStatus, ThreadMessage, events, } from '@janhq/core' import { Button, Textarea } from '@janhq/uikit' import { useAtomValue } from 'jotai' import { getActiveConvoIdAtom } from '@/helpers/atoms/Conversation.atom' const ChatInstruction = () => { const activeConvoId = useAtomValue(getActiveConvoIdAtom) const [isSettingInstruction, setIsSettingInstruction] = useState(false) const [instruction, setInstruction] = useState('') const setSystemPrompt = (instruction: string) => { const message: ThreadMessage = { id: 'system-prompt', content: instruction, role: ChatCompletionRole.System, status: MessageStatus.Ready, createdAt: new Date().toISOString(), threadId: activeConvoId, } events.emit(EventName.OnNewMessageResponse, message) events.emit(EventName.OnMessageResponseFinished, message) } return (
{!isSettingInstruction && activeConvoId && ( <>

What does this Assistant do? How does it behave? What should it avoid doing?

)} {isSettingInstruction && (