MCPcopy Create free account
hub / github.com/TanStack/ai / getOrCreateConversation

Function getOrCreateConversation

packages/ai-devtools/src/store/ai-context.tsx:419–444  ·  view source on GitHub ↗
(
    id: string,
    type: 'client' | 'server',
    label: string,
  )

Source from the content-addressed store, hash-verified

417 }
418
419 function getOrCreateConversation(
420 id: string,
421 type: 'client' | 'server',
422 label: string,
423 ): void {
424 if (!state.conversations[id]) {
425 setState('conversations', id, {
426 id,
427 type,
428 label,
429 messages: [],
430 chunks: [],
431 iterations: [],
432 imageEvents: [],
433 audioEvents: [],
434 speechEvents: [],
435 transcriptionEvents: [],
436 videoEvents: [],
437 status: 'active',
438 startedAt: Date.now(),
439 })
440 if (!state.activeConversationId) {
441 setState('activeConversationId', id)
442 }
443 }
444 }
445
446 function attachRunToConversation(
447 conversationId: string,

Callers 2

AIProviderFunction · 0.85
recordStructuredOutputFunction · 0.85

Calls 1

nowMethod · 0.80

Tested by

no test coverage detected