SafeAI Beta

Recent Chats

Chat
Dolores
Listening...
untitled text
Copied!
D

Settings


VOICE — CHAT


VOICE — DOLORES ASSISTANT


DISPLAY


🤖 YOUR AI KEY

Your personal OpenRouter key. When set, Dolores uses AI for questions her knowledge base doesn't cover.


🧠 DOLORES KNOWLEDGE API

Share Dolores's knowledge base with your friends or plug it into any AI. Use the ready-made JS file below — it wires up everything automatically.

📡 Live endpoint:

https://aidolores.github.io/smart.json

📦 Download dolores-integration.js — drop it in any project:

// dolores-integration.js // Drop into any project to use Dolores's knowledge base + image gen // All files from aidolores.github.io are loaded automatically. const Dolores = { kb: {}, // flat knowledge base (smart.json) functions: {}, // code patterns (functions.json) templates: {}, // project templates (templates.json) ready: false, async init() { const BASE = 'https://aidolores.github.io'; const [smart, funcs, tpls] = await Promise.all([ fetch(BASE + '/smart.json').then(r => r.json()), fetch(BASE + '/functions.json').then(r => r.json()), fetch(BASE + '/templates.json').then(r => r.json()), ]); // Flatten smart.json categories into one lookup if (smart.knowledge) Object.values(smart.knowledge).forEach(cat => Object.assign(this.kb, cat)); if (smart.debug) Object.assign(this.kb, smart.debug); this.functions = funcs; this.templates = tpls; this.ready = true; console.log('[Dolores] Loaded', Object.keys(this.kb).length, 'KB entries,', Object.keys(this.templates.projects||{}).length, 'templates'); return this; }, // Query the knowledge base query(input) { const lower = input.toLowerCase(); const words = lower.split(/\W+/).filter(w => w.length > 2); let best = 0, result = null; for (const [key, val] of Object.entries(this.kb)) { let score = 0; if (lower.includes(key)) score += 10; key.split(' ').forEach(kw => { if (lower.includes(kw)) score += 3; }); words.forEach(w => { if (key.includes(w)) score += 2; }); words.forEach(w => { if (val.toLowerCase().includes(w)) score += 1; }); if (score > best) { best = score; result = val; } } return best >= 2 ? result : null; }, // Generate an image URL via Pollinations.ai (free, no key) imageURL(prompt, w = 512, h = 512) { return 'https://image.pollinations.ai/prompt/' + encodeURIComponent(prompt) + '?width=' + w + '&height=' + h + '&nologo=true'; }, // Get a project template by name template(name) { return this.templates?.projects?.[name] || null; }, // Respond to any message (KB first, then optional OpenRouter AI) async respond(input, openRouterKey = null) { const kbAnswer = this.query(input); if (kbAnswer) return { source: 'kb', text: kbAnswer }; if (openRouterKey) { const res = await fetch( 'https://openrouter.ai/api/v1/chat/completions', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + openRouterKey, }, body: JSON.stringify({ model: 'openrouter/auto', messages: [{ role: 'user', content: input }], max_tokens: 1000, }), }); const data = await res.json(); const text = data.choices?.[0]?.message?.content?.trim(); if (text) return { source: 'ai', text }; } return { source: 'none', text: null }; }, }; // Auto-init when script loads Dolores.init();

System prompt to give your AI access to the KB:

You have access to the Dolores knowledge base. Load it with: await Dolores.init(); (from aidolores.github.io) Or fetch directly: https://aidolores.github.io/smart.json The JSON has .knowledge (categorised) and .debug (error fixes). Flatten with: Object.values(db.knowledge).forEach(c => Object.assign(kb, c)) Always check the KB before generating an answer from scratch.

FILES IN THIS APP

📄 dolores.html — main app (fully self-contained)
🧠 smart.json — knowledge database
🍕 food.js — rich content rendering engine
🎨 food.css — styles for food.js
🖼 image-engine.js — Pollinations.ai image gen
⚙️ dolores-engine.js — intent detection
📦 functions.json — code pattern templates
🗂 templates.json — project templates

All files hosted at aidolores.github.io