Skip to content

setMessages function is not working #116

@Marius-brt

Description

@Marius-brt

When I try to call the setMessages function from useChat for reseting the conversation nothing happens.

const { sendMessage, status, stop, error, setMessages } = useChat({
    id: chat_id,
    transport: new DefaultChatTransport({
      fetch: customFetch,
    }),
    onError: (err) => {
      console.error("Error in AI sidebar", err);
      setGlobalError(err);
    },
  });

const handleNewChat = useCallback(() => {
    if (status === "streaming" || status === "submitted") {
      stop();
    }
    setInput("");
    setMessages([]);
  }, [status, stop, setInput, contextStore]);

Do you have any idea?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions