MCPcopy Create free account
hub / github.com/bytebase/bytebase / selectFor

Function selectFor

frontend/src/plugins/ai/react/context.tsx:220–229  ·  view source on GitHub ↗
(conn: { instance: string; database: string })

Source from the content-addressed store, hash-verified

218 // `selectedIdByConnRef`.
219 useEffect(() => {
220 const selectFor = (conn: { instance: string; database: string }) => {
221 const ck = `${conn.instance}/${conn.database}`;
222 const list = conversationListByConnection(
223 useConversationStore.getState(),
224 conn
225 );
226 const selId = selectedIdByConnRef.current[ck];
227 const explicit = selId ? list.find((c) => c.id === selId) : undefined;
228 return { ck, list, selected: explicit ?? last(list) };
229 };
230
231 const offNewConversation = events.on(
232 "new-conversation",

Callers 1

AIContextProviderFunction · 0.85

Calls 1

Tested by

no test coverage detected