Commit Graph

3712 Commits

Author SHA1 Message Date
kwaroran
6f3abd385a Feature: Preserve scroll position in menuMode 0 navigation (Trigger V2) (#868)
# 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
Implements scroll position preservation functionality for RisuAI's
Trigger V2 menuMode 0. When users navigate away from menuMode 0 and then
return, the scroll position is now automatically restored to where they
left off.

Changes:
- Saves scroll position when leaving menuMode 0
- Restores saved scroll position when returning to menuMode 0
- Improves user experience by maintaining navigation context"

This enhancement provides a smoother user experience by eliminating the
need to manually scroll back to previous positions after navigation.
2025-05-24 20:38:10 +09:00
kwaroran
0c2ec7d445 Feature: Trigger V2 Improvements (#867)
# 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 adds a back button functionality and improves textarea
components in Trigger V2.

## Changes Made
- Added back button for better navigation
- Updated textarea components for improved user experience
- Enhanced UI/UX in Trigger V2 section

This is my first pull request to this project. I would greatly
appreciate thorough review and feedback from maintainers. Please let me
know if any changes or improvements are needed.

Thank you for your time and consideration!


![image](https://github.com/user-attachments/assets/593b8390-c609-4f2f-b247-cf40cf82ff79)


![image](https://github.com/user-attachments/assets/0ae54a4f-20f3-4e11-a19d-81176a7b27bf)


![image](https://github.com/user-attachments/assets/52a04014-0e23-4090-b7ff-595b06d3be10)
2025-05-24 20:37:29 +09:00
kwaroran
f12652b805 fix: Respect module lowLevelAccess for Lua button triggers (#866)
# 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

For Lua scripts triggered by button clicks, `lowLevelAccess` flag is not
respecting module level settings, only character's.

This PR allows modules with low level access set run low level functions
in `onButtonClick`.
2025-05-24 20:36:46 +09:00
kwaroran
b2061cfd02 feat: aws claude 4 && fix: module lore sort properly (#865)
# 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
In my previous PR #822 there's an issue where the module lore sort was
not saving properly. I believe this PR will fix that. I appreciate your
time.
2025-05-24 20:36:17 +09:00
kwaroran
acf97b7fb1 fix: prevent Buffer.from(undefined) error in native fetch for GET/DELETE requests (#862)
# 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?
- [ ] Have you added type definitions?

# Description

While tracking down the error "The first argument must be one of type
string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type
undefined" that occurs during ComfyUI image generation, I found an issue
in the `fetchNative` function.

## Issue

When sending GET or DELETE requests, the `realBody` variable is set to
`undefined`, but it's directly passed to `Buffer.from()` without null
checking, causing the error.

## Fix

Added a simple null check to prevent the error:

```typescript
// Before
body: Buffer.from(realBody).toString('base64'),

// After
body: realBody ? Buffer.from(realBody).toString('base64') : '',
2025-05-24 20:36:08 +09:00
kwaroran
206d509482 feat: add memory selection metrics to HypaV3 (#861)
# 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

![preview](https://github.com/user-attachments/assets/8b805ff5-6242-401b-a1c2-ca3ca17355d6)

# Description
This PR introduces following:
- Add memory selection metrics to HypaV3
2025-05-24 20:35:47 +09:00
kwaroran
2f251811c1 fix: re‑implement prompt text storage without memo field (#860)
# 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.
2025-05-24 20:26:42 +09:00
kwaroran
d68bf50e34 fix: allow HTTP requests to localhost with custom ports (#859)
# 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://*:**"
}
2025-05-24 20:23:39 +09:00
kwaroran
4b1e9f4e8f fix: error alert not showing when parameter is error type (#858)
# 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.
2025-05-24 20:23:28 +09:00
kwaroran
598ffe302b fix: Prevent error with loadLoreBooks() in short context length (#857)
# 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.
2025-05-24 20:23:15 +09:00
kwaroran
6291a4cc43 fix: resolve Hypa V3 button disappearing from menu (#855)
# 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)
2025-05-24 20:18:29 +09:00
kwaroran
431a745cd3 feat: Allow more data to be readable from Lua in editDisplay step (#854)
# 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.
2025-05-24 20:18:19 +09:00
kwaroran
02a5a1eb0d fix: improve scrolling in Show Request Logs (#853)
# 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
2025-05-24 20:16:32 +09:00
kwaroran
6d39e5f50f Add getDescription function to LUA script (was missing) (#852)
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
2025-05-24 20:16:23 +09:00
cubicj
f46d6f2b02 set timeout 0 2025-05-24 16:26:39 +09:00
cubicj
4c993bb46a save/load scroll position 2025-05-24 00:16:19 +09:00
bangonicdd
a8c87693b6 feat: aws claude 4 2025-05-23 21:53:18 +09:00
cubicj
b6fec1d97c change textinput to textarea 2025-05-23 16:08:36 +09:00
cubicj
614ce38d48 add back button 2025-05-23 16:05:26 +09:00
enzi221
ff9dbe7aa1 fix: Respect module lowLevelAccess for Lua button triggers 2025-05-22 23:53:40 +09:00
bangonicdd
23bd2a4673 fix: module lore sort properly 2025-05-22 19:01:36 +09:00
enzi221
5e10607cb6 fix: Protect loadLoreBooks() from very short max context length 2025-05-21 13:58:43 +09:00
enzi221
8fdd8d3beb feat: Allow more data to be readable from Lua 2025-05-21 13:58:16 +09:00
Kwaroran
6e5cf5eb48 Add escapes 2025-05-21 00:41:51 +09:00
Kim, Harim
a20485c782 fix: prevent native fetch error
Fix "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type undefined" error
2025-05-20 20:38:41 +09:00
Kwaroran
d0f254c227 Fix escapes parsing double brackets 2025-05-20 04:22:01 +09:00
Kwaroran
71059bae47 Add 2025-05-20 04:17:36 +09:00
Kwaroran
14955b7698 Bump version to 160.1.0 in configuration files 2025-05-20 04:06:36 +09:00
Kwaroran
7ac5f4a6e3 Add decorators 2025-05-20 04:02:12 +09:00
poroyo
8dc05ccace feat: exclude globalNote type from per-message prompt text storage 2025-05-20 01:03:35 +09:00
Bo26fhmC5M
557bfe194a feat: add memory selection metrics to HypaV3 2025-05-19 23:33:50 +09:00
poroyo
fbd25a3770 feat: re‑implement per‑message prompt text storage with new logic 2025-05-19 22:50:17 +09:00
Kim, Harim
640caa12d9 fix: request from localhost:xxx failed 2025-05-19 21:41:28 +09:00
Kim, Harim
ec7ffa0314 fix: error alert not showing when parameter is error type 2025-05-19 21:02:45 +09:00
poroyo
bf1ea155a3 revert: remove memo field logic from prompt text processing
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.
2025-05-19 19:58:56 +09:00
kwaroran
57568ed7bc Add cbs non-underline variant 2025-05-19 17:34:25 +09:00
kwaroran
efab44e4c1 Add new cbs, and update docs 2025-05-19 17:28:22 +09:00
kwaroran
bda7871c76 Merge branch 'main' of https://github.com/kwaroran/RisuAI 2025-05-19 13:33:33 +09:00
kwaroran
4b6cb0727f Add MCP related functions 2025-05-19 13:33:06 +09:00
Kwaroran
42b2fe5486 fix: ensure basicMatcher returns an empty string for unmatched cases 2025-05-18 23:14:45 +09:00
Kwaroran
fe9e6e97ef fix: update return value in basicMatcher for risuaixa case 2025-05-18 23:14:30 +09:00
Kwaroran
171c5e5e3a Add documentation related 2025-05-18 23:13:55 +09:00
Bo26fhmC5M
6d113ac152 fix: resolve Hypa V3 button disappearing from menu 2025-05-18 22:17:24 +09:00
Bo26fhmC5M
2c4c2a0f2b fix: improve scrolling in Show Request Logs 2025-05-18 22:09:27 +09:00
Kwaroran
12d87ac706 feat: add 'iserror' cbs 2025-05-18 21:44:23 +09:00
Kwaroran
61e21cea49 Add metadata cbs 2025-05-18 21:43:40 +09:00
Kwaroran
a9d3ceea19 Make korean more smooth 2025-05-18 20:13:51 +09:00
Kwaroran
d398c8cced Change setup 2025-05-18 20:07:43 +09:00
Kwaroran
8815a71440 Update node version to 22 2025-05-18 17:24:27 +09:00
Kwaroran
45bef69d7a fix: add Cargo.lock to .gitignore to prevent build failures 2025-05-18 17:21:55 +09:00