Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

733 B
Raw Blame
import { formatLoadDiagnostics } from '@/lib/engineError'
import { getCoworkEnvironment } from '@/lib/coworkEnv'
import { localHomeDir } from '@/lib/localHome'

/**
 * The paste-ready report for a failed engine load, with this app's version and
 * OS filled in. Undefined when the error carries no diagnostics, which is the
 * caller's cue not to offer the action.
 */
export async function buildLoadDiagnosticsReport(
  error: unknown
): Promise<string | undefined> {
  const [env, home] = await Promise.all([
    getCoworkEnvironment(),
    localHomeDir(),
  ])
  return formatLoadDiagnostics(error, {
    appVersion: env.appVersion ?? undefined,
    os: [env.os, env.arch].filter(Boolean).join(' ') || undefined,
    home,
  })
}