中文:README.md 链接:https://github.com/TianRang/MAF/blob/main/README_CN.md
A lightweight browser-based roleplay chat UI with multi-session conversation management, role card editing, local persistence, markdown rendering, and optional image generation support.
- Multi-session conversation management
- Create, switch, delete, clear, import, and export conversations
- Each conversation stores:
- messages
- settings snapshot
- role card snapshot
- Role card editor
- Basic info, scenario, creator notes
- Custom detail entries
- Worldbook entries
- Regex rules
- Import / export role cards as JSON
- One-click role generation through your configured text model
- Chat
- Stream and non-stream text generation
- Local message persistence
- Markdown rendering
- Safe inline color tag support:
[color=#7c3aed]text[/color]
- Image generation
- Manual image command:
/img your english prompt/image your english prompt生成图片:your english prompt
- Assistant-triggered illustration generation via:
[[IMAGE: ENGLISH_PROMPT]]
- Supports:
- OpenAI-style
/v1/images/generations - NovelAI-style
/ai/generate-image
- OpenAI-style
- Manual image command:
- Customizable appearance
- Accent colors
- Background colors
- Card / text / border colors
- Wallpaper upload or URL
- Wallpaper opacity
- Fully local persistence with
localStorage - Responsive drawer and modal-based UI
- Vanilla JavaScript
- HTML
- CSS
- No build tools required
├── index.html ├── styles.css └── app.js
This is a pure front-end app.
You only need to open index.html in a browser, then configure your API settings in the UI.
The app stores all data locally in localStorage, including:
- settings
- conversations
- role cards
- wallpaper assets
- generator description drafts
- Clone or download this project.
- Keep these files in the same directory:
index.htmlstyles.cssapp.js
- Open
index.htmlin a modern browser. - Click Settings.
- Fill in:
- Relay API BaseURL
- API Key
- text model
- Optionally configure image generation:
- image relay base URL
- image API key
- image endpoint
- image model
- Save settings and start chatting.
The app expects an OpenAI-compatible chat API:
GET /v1/modelsPOST /v1/chat/completions
Supported modes:
- streaming SSE
- non-stream JSON
Default endpoint:
POST /v1/images/generations
Expected response can contain either:
data[0].urldata[0].b64_json
Endpoint example:
POST /ai/generate-image
The app can build strict NovelAI-compatible JSON payloads for models like:
nai-diffusion-3nai-diffusion-4-curated-previewnai-diffusion-4-fullnai-diffusion-4-5-curatednai-diffusion-4-5-full
Each conversation stores a full snapshot of:
- current role card
- current settings
- message history
When you switch conversations, the app automatically restores:
- API settings
- selected models
- system prompt
- generation parameters
- appearance settings
- role card
- message list
This allows each conversation to behave like an isolated session.
Stored role structure:
{ "basic": { "name": "Night Poet", "avatar": "", "playerAvatar": "", "shortDesc": "", "persona": "", "greeting": "", "talkativeness": 0.4 }, "detail": { "scenario": "", "creatorNotes": "", "custom": [] }, "worldbook": [], "regex": [] }
The importer also supports a flatter JSON structure such as:
{ "name": "Night Poet", "shortDesc": "", "persona": "", "greeting": "", "scenario": "", "creatorNotes": "", "worldbook": [], "regex": [] }
The conversation importer supports:
- Full store format
{ "v": 1, "activeId": "...", "convs": [...] }
-
Single conversation format { "id": "...", "title": "...", "messages": [...] }
-
Legacy plain message array [ { "side": "right", "text": "Hello" }, { "side": "left", "text": "Hi" } ]
For assistant-triggered image generation, the system prompt requires the model to output:
[[IMAGE: <ENGLISH_PROMPT>]]
Important rules:
- must be English only
- must be single-line
- must not contain Chinese characters
- should describe the NPC’s current scene
If Chinese characters are detected in the image prompt, generation will be rejected.
Main keys used by the app:
wy_settings_v1wy_ui_assets_v1wy_chat_history_v1wy_conversations_v1wy_role_card_v2wy_role_gen_desc_v1
- This project is front-end only.
- API keys are stored in browser
localStorage. - Do not use it on untrusted shared devices.
- Large wallpaper images may consume significant storage space.
- Conversation count is capped.
- Message history per conversation is also capped.
Default limits in code:
- max conversations:
30 - max stored messages per conversation:
200
Recommended:
- Chrome
- Edge
- Firefox
- Safari latest versions
Required browser features include:
localStoragefetchReadableStreamFileReadercrypto.randomUUID(fallback exists if unavailable)
You can edit defaults in app.js, including:
- default settings
- default system prompt
- max conversation count
- max message count
- default colors
- default image size
- default role card
Useful constants:
DEFAULT_SETTINGSDEFAULT_ROLECHAT_MAX_ITEMSCONV_MAX
- Data is stored locally in the browser.
- API keys are not encrypted.
- Markdown rendering is custom and limited, but you should still be careful if you import unknown JSON content.
- This project is intended as a personal/local tool template.
Please add your preferred license here.
Built as a lightweight bright-theme RP chat template with:
- role card editing
- multi-session history
- markdown rendering
- image generation integration
- local-first workflow