UNPKG

@assistant-ui/react

Version:

Typescript/React library for AI Chat

23 lines 765 B
const symbolInnerMessage = Symbol("innerMessage"); const symbolInnerMessages = Symbol("innerMessages"); const getExternalStoreMessage = (input) => { const withInnerMessages = input; return withInnerMessages[symbolInnerMessage]; }; const EMPTY_ARRAY = []; const getExternalStoreMessages = (input) => { const container = "messages" in input ? input.messages : input; const value = container[symbolInnerMessages] || container[symbolInnerMessage]; if (!value) return EMPTY_ARRAY; if (Array.isArray(value)) { return value; } container[symbolInnerMessages] = [value]; return container[symbolInnerMessages]; }; export { getExternalStoreMessage, getExternalStoreMessages, symbolInnerMessage }; //# sourceMappingURL=getExternalStoreMessage.js.map