Skip to content

l3utterfly/sillytavern-lorebook-studio

Repository files navigation

SillyTavern Lorebook Studio

A Layla mini-app that turns a one-line world premise into a structured, keyword-triggered lorebook ready to import into SillyTavern.

Lorebook Studio guides you through focused areas of your setting, streams context-aware lore drafts from Layla's on-device model, and keeps you in control of what becomes canon. Accept, edit, or reject each entry, answer optional worldbuilding questions, then export the finished work in SillyTavern World Info format.

Features

  • Start from a single sentence, theme, or vibe
  • Explore model-proposed areas or name your own
  • Generate three complementary lore entries per round
  • Edit titles, content, and activation keywords before accepting an entry
  • Reject unwanted ideas so later rounds avoid repeating them
  • Answer probing and detail questions to steer future generations
  • Build multiple connected areas using established lore as context
  • Preview and save a SillyTavern-compatible World Info JSON file
  • Stream generation with stop, retry, and partial-result recovery controls

How It Works

  1. Seed your world. Enter a short premise such as "A desert city where water debts pass down bloodlines."
  2. Choose an area. Pick one of three generated directions or type a specific corner of the setting you want to explore.
  3. Shape the canon. Review each drafted entry, adjust its text and matching keywords, then accept or reject it.
  4. Add your intent. Answer optional questions or leave a creator note to establish conflicts, exceptions, sensory details, and other specifics.
  5. Keep building. Continue the current area or move to another one. Existing entries and answers inform later generations.
  6. Export. Save lorebook_export.json and import it with SillyTavern's World Info/lorebook importer.

Screenshots

Seed your world Choose an area to develop
Seed your world screen Choose an area to develop screen
Review drafted entries Refine the lore
Drafted lorebook entries screen Model questions and creator note screen

Export to SillyTavern

SillyTavern lorebook export screen

Running Locally

Requirements

  • Node.js 20 or newer
  • npm
  • LM Studio, or another OpenAI-compatible streaming chat server

Install dependencies:

npm install

For browser development, start LM Studio's local server at its default OpenAI-compatible endpoint:

http://127.0.0.1:1234/v1/chat/completions

Then start Vite:

npm run dev

During development, the app installs a mock Layla host and forwards model requests to LM Studio. The /lmstudio Vite proxy avoids browser CORS restrictions.

To override the defaults, copy .env.example to .env.local and edit:

VITE_LM_STUDIO_MODEL=local-model
VITE_LM_STUDIO_CHAT_ENDPOINT=/lmstudio/v1/chat/completions
VITE_LM_STUDIO_API_KEY=

VITE_LM_STUDIO_CHAT_ENDPOINT may also be a full URL when the target server allows cross-origin requests.

Running in Layla

In production, chat generation goes through @layla-network/sdk and the bridge provided by the Layla WebView. The app uses Layla's on-device model and file save API, so no model endpoint or API key is embedded in the production build.

Create the production bundle with:

npm run build

The build is written to dist/. vite-plugin-singlefile bundles the app into a WebView-friendly HTML file, while Vite copies the mini-app manifest and artwork from public/.

Layla listing metadata lives in public/app.json:

{
  "title": "SillyTavern Lorebook Studio",
  "tagline": "Build SillyTavern Lorebooks in Layla.",
  "description": "Develop a world premise into focused lore entries, refine the canon with guided questions, and export the result in SillyTavern World Info format.",
  "iconUri": "icon.jpg",
  "backgroundImgUri": "bg.jpg"
}

Export Format

Accepted drafts are exported as keyed SillyTavern World Info entries. Each entry includes:

  • The accepted lore text
  • Its edited or automatically extracted activation keywords
  • An area-prefixed memo for organization
  • Selective matching with 100% probability
  • An insertion depth of 4

Creator answers guide later generation but are not emitted as standalone entries in the exported lorebook.

Project Structure

.
+-- assets/                 # README screenshots
+-- public/
|   +-- app.json            # Layla mini-app metadata
|   +-- bg.jpg              # Listing background
|   +-- icon.jpg            # Listing icon
+-- src/
|   +-- libs/
|   |   +-- defensiveJsonParser.ts
|   |   +-- keywordExtraction.ts
|   |   +-- laylaClient.ts
|   |   +-- lmStudioMock.ts
|   |   +-- lorebookapi.ts
|   +-- App.tsx             # UI, workflow, state, and export
|   +-- index.css
|   +-- main.tsx            # App bootstrap and development mock
+-- .env.example
+-- package.json
+-- vite.config.ts

Scripts

Command Description
npm run dev Start the local Vite server
npm run build Type-check and create the production build
npm run preview Preview the production build locally
npm run lint Run ESLint

Tech Stack

  • React 19
  • TypeScript
  • Vite
  • @layla-network/sdk
  • vite-plugin-singlefile
  • compromise for supplemental keyword extraction
  • Lucide React

Layla App

Visit the official Layla website: https://www.layla-network.ai/

Download the Layla app:

Get it on Google Play    Download on the App Store

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages