Stream State Store (ui/stream.ts)

deepchat · src/renderer/src/stores/ui/stream.ts · typescript · Apache-2.0
ui, realtime, ai, fw:pinia, tag:state, tag:store

Manages streaming state for AI assistant messages, tracking streaming blocks, session IDs, and metadata.

// Source: https://github.com/ThinkInAIXYZ/deepchat | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
import { defineStore } from 'pinia'
import { ref, shallowRef } from 'vue'
import type { AssistantMessageBlock } from '@shared/types/agent-interface'

export const useStreamStateStore = defineStore('streamState', () => {
  const isStreaming = ref(false)
  // Stream snapshots are schema-validated whole-array replacements. Avoid recursively
  // proxying an ever-growing payload that is never mutated in place.
  const streamingBlocks = shallowRef<AssistantMessageBlock[]>([])
  const currentStreamSessionId = ref<string | null>(null)
  const currentStreamRequestId = ref<string | null>(nul

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key