19d50d1ef12582c3105f58965721166b18411313
# PR Checklist - [ ] Have you checked if it works normally in all models? *Ignore this if it doesn't use models.* - [x] Have you checked if it works normally in all web, local, and node hosted versions? If it doesn't, have you blocked it in those versions? - [x] Have you added type definitions? # Description ## What does this PR do? This PR adds an optional feature to store prompt preset metadata in each chat message. <img width="311" alt="prompt" src="https://github.com/user-attachments/assets/2591ac25-6cb2-41fc-85b2-e12c35b79370" /> --- ## Why is this useful? When writing prompts, it's common to test **dozens of prompt presets** across many messages. After just a day or two, it's hard to remember which message used which prompt. This is especially important for sensitive models, where even small changes to prompt wording or toggle combinations can greatly affect output. --- ## What is stored when enabled? To support this, an option has been added to **Advanced Settings** that stores: - Prompt preset name (*Add Prompt Info to Chat*) - Active custom toggles (*Add Prompt Info to Chat*) - Prompt text (*Add Prompt *Text* To Chat*): Only the **Prompt Template** portion of the final prompt (**as sent**) is stored — character description, persona, lorebook, and long-term memory are excluded to avoid excessive size. This option is separated due to its potential impact on storage. This information is stored per message, if the feature is enabled. <img width="319" alt="setting" src="https://github.com/user-attachments/assets/00600d0c-d38d-46cf-890f-3f08d78ccb0a" /> --- ## Implementation Summary ### `src/ts/storage/database.svelte.ts` - Added `interface MessagePresetInfo` (includes `promptName`, `promptToggles`, `promptText`) - Updated `interface Message` with optional `promptInfo` ### `src/ts/process/index.svelte.ts` - In `sendChat()`, prompt metadata is collected and stored - `promptText` is taken from the existing `formated` array, but only after filtering out types like `'persona'`, `'description'`, `'authornote'`, `'memory'` - Since `formated` is reused, this had to be placed in the **later** part of the `sendChat` function. - However, `promptName` and `promptToggles` are collected **early** to avoid mismatches caused by user changes during message sending. *(A short comment has been added to explain the code separation. See screenshot below.)* <img width="494" alt="comment" src="https://github.com/user-attachments/assets/b43da333-d529-4b3c-b659-579b847135a5" /> - Used this condition when storing partial prompt data (As you can see, these are the types that support Custom Inner Format.): ```ts // only for types supporting Custom Inner Format if (DBState.db.promptInfoInsideChat && DBState.db.promptTextInfoInsideChat) { pushPromptInfoBody('supaMemory', card.innerFormat) } ``` - The final `promptInfo` is added to the message object during `message.push` --- ## Additional Notes - The prompt preset name and active toggles take up very little space, so they are unlikely to be an issue. - The prompt text may increase the message size slightly, but: - Modern models already generate outputs of several thousand tokens, so adding \~2,000 tokens of metadata is relatively minor in comparison. - The `{{slot}}` contents are not included in the saved text. - The prompt text is filtered through `risuChatParser`, which reduces unnecessary parts before saving. - Most importantly, this feature is optional and can be enabled only by those who need it — for example, prompt creators or advanced users. --- ## Final Thoughts This feature is designed to help prompt creators **track, debug, and revisit** messages more easily. If this feature doesn't fit the project goals or introduces any concerns, feel free to let me know or suggest changes. It might also be interesting to allow users to write a note for each message! Thanks for reading.
…
RisuAI
RisuAI, or Risu for short, is a cross platform AI chatting software / web application with powerful features such as multiple API support, assets in the chat, regex functions and much more.
Screenshots
| Screenshot 1 | Screenshot 2 |
|---|---|
Features
- Multiple API Supports: Supports OAI, Claude, Ooba, OpenRouter... and More!
- Emotion Images: Display the image of the current character, according to his/her expressions!
- Group Chats: Multiple characters in one chat.
- Plugins: Add your features and providers, and simply share.
- Regex Script: Modify model's output by regex, to make a custom GUI and others
- Powerful Translators: Automatically translate the input/output, so you can roleplay without knowing model's language.
- Lorebook: Also known as world infos or memory book, which can make character memorize more.
- Themes: Choose it from 3 themes, Classic, WaifuLike, WaifuCut.
- Powerful Prompting: Change the prompting order easily, Impersonate inside prompts, Use conditions, variables... and more!
- Customizable, Friendly UI: Great Accessibility and mobile friendly
- TTS: Use TTS to make the output text into voice.
- Additonal Assets: Embed your images, audios and videos to bot, and make it display at chat or background!
- And More!
You can get detailed information on https://github.com/kwaroran/RisuAI/wiki (Work in Progress)
Discord
Installation
- RisuAI Website (Recommended)
- Github Releases
Docker Installation
You can also run RisuAI using Docker. This method is particularly useful for web hosting.
-
Clone the repository:
git clone https://github.com/kwaroran/RisuAI.git cd RisuAI -
Build and run the Docker container:
docker-compose up -d -
Access RisuAI at
http://localhost:6001in your web browser.
Description
Languages
TypeScript
58.9%
Svelte
35.1%
JavaScript
4.4%
Rust
0.5%
Lua
0.3%
Other
0.7%