Integrate SillyTavern ecosystem (lorebooks, presets, AI chat) into any web project. Activates when users want to add SillyTavern features, world info, character cards, lorebook management, or AI chat with persistent data to their website. Triggers on: sillytavern, world book, lorebook, character card, AI chat, preset, prompt engineering, add SillyTavern to my site, integrate lorebook.
Integrate SillyTavern's powerful lorebook system into any web project. Transform static character sites into interactive AI chat experiences, or add intelligent world-building to your applications.
User invokes /sillytavern-web or mentions related concepts:
/sillytavern-web Add lorebook support to my React app
/sillytavern-web I want AI chat with world info on my site
Add SillyTavern features to this project
Integrate character cards and presets
Help me set up lorebook management
First, understand the user's project:
Detect framework — React, Vue, or vanilla JS?
package.json dependencies.tsx, .vue, .js)Assess current state — What exists?
Determine integration mode — Two options:
Copy the pre-built enhancer to their project:
Project/
├── index.html ← Add one line
└── sillytavern-enhancer.js ← Copy this file
Add to HTML:
<script type="module" src="./sillytavern-enhancer.js"></script>
Install and integrate modular components:
npm install dexie
Copy core files:
src/
└── sillytavern/
├── types.ts
├── database.ts
├── lorebook-engine.ts
├── prompt-assembler.ts
└── importer.ts
Create framework-specific hooks/composables.
Add management interface:
Wire up the chat flow:
import { createLorebookEngine } from './sillytavern/lorebook-engine';
const engine = createLorebookEngine(lorebook);
const matches = engine.scan(userInput);
// Returns entries where keywords match input
import { assemblePrompt } from './sillytavern/prompt-assembler';
const prompt = assemblePrompt({
userInput,
lorebookEntries,
preset,
macros: { user: 'Alice', char: 'Elena' }
});
All data stored locally in IndexedDB:
// hooks/useSillytavern.ts
import { useState, useEffect } from 'react';
import { getLorebooks, saveLorebook } from '../sillytavern/database';
export function useLorebooks() {
const [lorebooks, setLorebooks] = useState([]);
const [activeIds, setActiveIds] = useState([]);
useEffect(() => {
loadLorebooks();
}, []);
const loadLorebooks = async () => {
const data = await getLorebooks();
setLorebooks(data);
};
return { lorebooks, activeIds, refresh: loadLorebooks };
}
// composables/useLorebooks.ts
import { ref, onMounted } from 'vue';
import { getLorebooks } from '../sillytavern/database';
export function useLorebooks() {
const lorebooks = ref([]);
onMounted(async () => {
lorebooks.value = await getLorebooks();
});
return { lorebooks };
}
// app.js
import { initializeDatabase, getLorebooks } from './sillytavern/index.js';
async function init() {
await initializeDatabase();
const lorebooks = await getLorebooks();
renderLorebookList(lorebooks);
}
init();
Import existing SillyTavern lorebooks:
import { importLorebook } from './sillytavern/importer';
const file = await fetch('/lorebook.json').then(r => r.json());
const lorebook = importLorebook(file);
await saveLorebook(lorebook);
import { exportLorebook } from './sillytavern/importer';
const json = exportLorebook(lorebook);
// Download or share this JSON
Supports any OpenAI-compatible API:
https://api.moonshot.cn/v1https://api.openai.com/v1https://api.deepseek.com/v1http://localhost:1234/v1 (LM Studio)After implementation, verify:
A working SillyTavern integration with: