# PR Checklist
- [ ] Have you checked if it works normally in all models? *Ignore this
if it doesn't use models.*
- [ ] 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?
- [ ] Have you added type definitions?
# Preview

# Description
This PR introduces following:
- Add memory selection metrics to HypaV3
# 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
## Related PRs
- This PR replaces the previous implementation in
[#848](https://github.com/kwaroran/RisuAI/pull/848).
---
## Problem
- After [#848](https://github.com/kwaroran/RisuAI/pull/848), input token
counts and `\n\n` spacing changed (e.g. custom API & OpenAI compatible
models).
- Before, I used the `memo` field in each message to help get **the
final, parsed and pre-processed prompt template** from the `formated`
array for storage.
- But the `memo` field is used in `pushPrompts()` to decide when to
merge strings inside `formated`:
```js
// Existing code
if (chat.role === 'system') {
const endf = formated.at(-1)
if (endf && endf.role === 'system' && endf.memo === chat.memo && endf.name === chat.name) {
formated[formated.length - 1].content += '\n\n' + chat.content
}
}
```
- Therefore, relying on `memo` produced wrong results.
## Solution
- Rolled back all `memo` logic (For a clean diff, compare with 040652d,
the last version before the memo logic was added).
- Added `pushPromptInfoBody()` (independent of global `formated`):
```js
function pushPromptInfoBody(role, fmt, promptBody) {
if (!fmt.trim()) return;
promptBody.push({
role: role,
content: risuChatParser(fmt),
});
}
```
- Prompt text is now collected in a single switch(`card.type`) block,
without needing to filter with `memo` or external fields.
## Result
Prompt text is still stored per message without side effects.
## Considerations (commit
[8dc05cc](8dc05ccace))
- Extracting only the original `globalNote` is hard unless parser order
is changed.
1. When `positionParser` is called first, sections marked as `position`
are inserted early, making it impossible to extract only the prompt
template afterward.
2. If `risuChatParser` is called separately **just to save the prompt
text**, the saved prompt may differ from the actual prompt sent,
especially in cases involving `{{random}}` values.
- Reordering the function calls might help, but since it could change
the prompt that is actually sent and cause differences from the previous
output, it may be better to leave things as they are.
- Personally, I tend to avoid using `position` in main system prompts;
adding it often makes the main prompt structure a bit messy (Using
`position` is very useful for things that change frequently, such as
bots or personas)
- Global notes are typically used for individual bots, rather than as
prompts shared globally, so skipping them here has no functional
drawback, I think.
- The **Custom Inner Format** fields such as authorNote, persona,
description, and memory mainly serve as labels, so things like
`{{random}}` are rarely used here. For this reason, I used **2(only
`risuChatParser` is called just to save the prompt text)** in this
context.
## Final Note
Sorry for any inconvenience! If you have questions or feedback, please
let me know.
# PR Checklist
- [ ] Have you checked if it works normally in all models? *Ignore this
if it doesn't use models.*
- [ ] 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?
- [ ] Have you added type definitions?
# Description
While testing image generation with ComfyUI, I encountered a permission
error when trying to send requests to the local ComfyUI server. The
application was throwing the following error:
`url not allowed on the configured scope: http://localhost:8188/prompt`
## Solution
Added a wildcard URL pattern to `migrated.json` that explicitly allows
connections to localhost with any port number:
```json
{
"url": "http://*:**"
}
# 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
It fixes a bug identified during the testing of ComfyUI image generation
in Playground. Specifically, the error alert, which is supposed to
display error messages, was not appearing when a parameter was of an
error type. This fix ensures that error alerts are now correctly
displayed under such conditions.
# 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
When a user uses short max context length and `reserve` is bigger than
the length, `loadLoreBooksMain` returns a `nil` but `loadLoreBooks`
tries to decode it as a JSON.
It will return a stringified empty array instead of a nil.
# PR Checklist
- [ ] Have you checked if it works normally in all models? *Ignore this
if it doesn't use models.*
- [ ] 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?
- [ ] Have you added type definitions?
# Description
This PR resolves an issue appeared in [Revert to old loading
temp](858d6c2ad2)
# 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
This PR adds ~~two~~ one function: ~~`getDescription()` for character
description, and~~ (See #852)`getAuthorsNote()` for author's note.
It also removes `LuaSafeIds.has(id)` from most reader functions without
any side effects. Since `getFullChatMain()` has no such check already
and everything else should be lighter than `getFullChatMain()`, I think
it'll be fine.
# PR Checklist
- [ ] Have you checked if it works normally in all models? *Ignore this
if it doesn't use models.*
- [ ] 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?
- [ ] Have you added type definitions?
# Description
This PR introduces following:
- Make only markdown content scrollable while keeping OK button visible
The `getDescription(triggerId)` function, documented at:
https://kwaroran.github.io/docs/srp/lua/#getdescriptiontriggerid was
missing from the codebase and has now been added.
# PR Checklist
- [ ] Have you checked if it works normally in all models? *Ignore this
if it doesn't use models.*
- [ o] 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?
- [ ] Have you added type definitions?
# Description
The memo field was used in prompt text logic, but its usage
affects string merging conditions for the `formated` inside
pushPrompts(). To avoid unintended merging issues, logic
involving the memo field has been rolled back.
# PR Checklist
- [ ] Have you checked if it works normally in all models? *Ignore this
if it doesn't use models.*
- [ ] 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?
- [ ] Have you added type definitions?
# Description
This PR introduces following:
- fix: pass message index when processing regex script in HypaV3 Modal
- feat: add BGE-m3-ko embedding