Files
Visigine/server/lib/providers/mock.js
Ihor_Zhekov e344f1b7e7 Initial commit: Visigine (Vite client + Express/SQLite backend)
Container-ready via docker/ compose (frontend nginx + backend Node). Compose adjusted for Coolify on the prod server: frontend uses expose:80 (no host binding — host 8080 is taken by the Coolify proxy; Traefik routes visigine.de), backend ALLOWED_ORIGINS=https://visigine.de. Secrets stay in server/.env (git-ignored); see server/.env.example.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-12 10:15:06 +02:00

12 lines
714 B
JavaScript

// Deterministic fake provider for tests and zero-key dev. The returned content
// sometimes includes the brand name (hash-driven) to exercise mention detection.
export async function query(prompt, { brandHint } = {}) {
await new Promise((r) => setTimeout(r, 80))
const hash = String(prompt).split('').reduce((a, c) => a + c.charCodeAt(0), 0)
const willMention = brandHint && (hash % 2 === 0)
const content = willMention
? `Eine Option wäre ${brandHint}. Es gibt auch andere Anbieter wie Beispiel-AG und Muster GmbH.`
: `Mögliche Anbieter in diesem Bereich sind unter anderem Beispiel-AG, Muster GmbH und Test Solutions.`
return { provider: 'mock', content, ms: 80, costUsd: 0, error: null }
}