Skip to content

System message editor #1049

Answered by Yonom
igo asked this question in Q&A
Oct 21, 2024 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

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

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@igo
Comment options

@Yonom
Comment options

Answer selected by Yonom
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants