MCPcopy Index your code
hub / github.com/thesysdev/openui / mergeThreadList

Function mergeThreadList

packages/react-headless/src/store/createChatStore.ts:12–15  ·  view source on GitHub ↗
(existing: Thread[], incoming: Thread[])

Source from the content-addressed store, hash-verified

10}
11
12const mergeThreadList = (existing: Thread[], incoming: Thread[]): Thread[] =>
13 Array.from(new Map([...existing, ...incoming].map((t) => [t.id, t])).values()).sort(
14 (a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime(),
15 );
16
17export const createChatStore = (config: CreateChatStoreConfig) => {
18 const { storage, llm } = config;

Callers 1

createChatStoreFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected