Skip to content

Project NOMAD is an offline-first knowledge and education server. Wikipedia, thousands of books, courses, maps, and optional local AI, all running on hardware you own with no internet required.

TypeScript
706 B
Raw Blame
import assert from 'node:assert/strict'
import test from 'node:test'
import { chatStreamErrorMessage } from '../../inertia/lib/chat_stream.js'

test('chat stream preserves an actionable server error message', () => {
  assert.equal(
    chatStreamErrorMessage({
      error: true,
      message:
        'NOMAD cannot confirm that this model accepts images. Choose a model marked “Supports images”.',
    }),
    'NOMAD cannot confirm that this model accepts images. Choose a model marked “Supports images”.'
  )
  assert.equal(
    chatStreamErrorMessage({ error: true }),
    'The model encountered an error. Please try again.'
  )
  assert.equal(chatStreamErrorMessage({ done: true }), null)
})