System message editor
#1049
-
Hi, how can I show system message and allow editing it? (while preserving first user message in a branch) |
Beta Was this translation helpful? Give feedback.
Answered by
Yonom
Oct 21, 2024
Replies: 1 comment 2 replies
-
Hey, you don't want to use a system message, but rather a system prompt. The system prompt will be sent to the server on every request. Here's a input component that adds its contents to your system prompt: const SystemPromptInput: React.FC = () => {
const [prompt, setPrompt] = useState();
const runtime = useAssistantRuntime();
useEffect(() => {
return runtime.registerModelConfigProvider(() => { system: prompt });
}, [runtime, prompt]);
const handlePromptChange = (e) => {
setPrompt(e.target.value);
};
return (
<input value={prompt} onChange={handlePromptChange} />
);
}; Let me know if this works as expected |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
Yonom
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey,
you don't want to use a system message, but rather a system prompt. The system prompt will be sent to the server on every request.
Here's a input component that adds its contents to your system prompt:
Let me know if this works as expected