bookwiz.io / lib / config / chat-strategy.ts
chat-strategy.ts
Raw
export const CHAT_STRATEGY = {
  // **RECOMMENDED**: Stream text, non-stream tool calls
  HYBRID: 'hybrid',
  
  // **MOST ROBUST**: No streaming at all  
  NON_STREAMING: 'non-streaming',
  
  // **CURRENT**: Full streaming (fragile)
  FULL_STREAMING: 'full-streaming'
} as const

export type ChatStrategy = typeof CHAT_STRATEGY[keyof typeof CHAT_STRATEGY]

// Configuration
export const CURRENT_STRATEGY = 'hybrid' as const

export const STREAMING_CONFIG = {
  // When true, show typing effect for text content
  STREAM_TEXT_CONTENT: true,
  
  // When true, stream tool call arguments (causes JSON issues)
  STREAM_TOOL_CALLS: false,
  
  // Retry failed tool calls automatically
  RETRY_FAILED_TOOLS: true,
  
  // Max retries for malformed JSON
  MAX_TOOL_RETRIES: 2,
  
  // Timeout for complete responses (ms)
  RESPONSE_TIMEOUT: 30000
}