Commit Graph

1075 Commits

Author SHA1 Message Date
Bo26fhmC5M
1b2ea2b15b fix: handle null case for firstMessage in HypaV3 modal 2025-01-18 14:16:50 +09:00
kwaroran
e073d66bca feat: improve HypaV3 (#721)
# PR Checklist
- [x] 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
- feat: add translate button to HypaV3 modal
- feat: add dual-action translation (cached/regenerate) in HypaV3 modal
- Implements shift+click (desktop) and double tap (mobile) for
regenerating translations while maintaining regular click/tap for cached
translations.
- feat: improve ratio sliders interaction in HypaV3 settings
- feat: add lastSelectedSummaries property to store selected memory
indices
- feat: display next message to be summarized in HypaV3 modal
2025-01-17 22:54:08 +09:00
Bo26fhmC5M
b43eec49d1 fix: handle empty message edge cases in getNextMessageToSummarize 2025-01-17 09:03:23 +09:00
Bo26fhmC5M
171b267891 feat: display next message to be summarized in HypaV3 modal 2025-01-17 02:22:46 +09:00
Bo26fhmC5M
3c62317f3a feat: add lastSelectedSummaries property to store selected memory indices 2025-01-17 00:17:12 +09:00
Bo26fhmC5M
6a13b33103 refactor: extract repeated summarization logic into retryableSummarize function 2025-01-16 23:36:32 +09:00
Bo26fhmC5M
6ffaa1257e feat: improve ratio sliders interaction in HypaV3 settings 2025-01-16 22:12:32 +09:00
poroyo
0f19952e2a feat: add navigation from prompt comparison tooltip overview to prompt lines 2025-01-16 17:23:11 +09:00
Bo26fhmC5M
682f536c5a refactor: extract double confirmation logic into reusable function 2025-01-16 01:36:29 +09:00
Bo26fhmC5M
c57c256190 fix: reactive declarations 2025-01-16 01:23:02 +09:00
Bo26fhmC5M
d59cc1a29c refactor: update UI management to index-based approach 2025-01-15 19:56:07 +09:00
Bo26fhmC5M
3e234dcb15 feat: add dual-action translation (cached/regenerate) in HypaV3 modal
Implements shift+click (desktop) and double tap (mobile) for regenerating translations while maintaining regular click/tap for cached translations.
2025-01-15 13:45:34 +09:00
Bo26fhmC5M
f397b6ef1a feat: add translate button to HypaV3 modal 2025-01-15 02:05:23 +09:00
Bo26fhmC5M
a10a2c5502 refactor: extract HypaV3 modal into separate component 2025-01-14 13:01:14 +09:00
Bo26fhmC5M
030e802122 fix: message line break display in HypaV3 Data modal 2025-01-14 01:10:06 +09:00
Bo26fhmC5M
f3c6278d21 feat: add important button in HypaV3 Data modal 2025-01-13 23:30:18 +09:00
Bo26fhmC5M
a7c3141cc0 feat: add expandable chat memo in HypaV3 Data modal 2025-01-13 22:33:27 +09:00
Bo26fhmC5M
4176a647a5 fix: restore undefined value from null after importing hypaDataV3 2025-01-13 19:31:24 +09:00
Bo26fhmC5M
a1158ebdb1 fix: adjust memory selection order 2025-01-13 14:09:18 +09:00
kwaroran
3fa199dbfa Improve prompt comparison functionality with usability enhancements (#716)
# 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 introduces a couple of usability improvements to the prompt
comparison functionality.

1. If the two prompts are identical

Instead of showing the content right away, an alert is displayed saying
the two prompts are the same. Only when the user clicks "Yes" the
content will be shown. This avoids unnecessary confirmation of identical
prompts.

<img width="519" alt="a"
src="https://github.com/user-attachments/assets/bf48420e-bf69-4c8a-b700-754e1c38b6a6"
/>


2. If the two prompts are different

A summary of the number of modified, added, and removed lines is
displayed.

<img width="598" alt="b"
src="https://github.com/user-attachments/assets/c3269ee8-25e7-4ba9-957d-4e377d523795"
/>

When hovering over the summary, a quick overview of the changes appears.
When only a single word or character is modified, it was previously hard
to identify the line that was changed. Now, the overview improves
clarity, making it easier to understand the changes.

<img width="595" alt="e"
src="https://github.com/user-attachments/assets/1b55a3bc-70d2-43fa-ab4c-754e6fd4a85d"
/>

On mobile devices (tested on iOS 16.7), tapping on the 'Differences
detected. Please review the changes.' section will display the changes.

---

As a future improvement, it might be useful to display line numbers or
allow users to click and navigate to the specific parts of the
differences.

I hope these changes make it easier to use, but feel free to reject this
PR if you find it unnecessary or if the code feels too messy. I
completely understand and appreciate your feedback.

Thank you for your time!
2025-01-12 23:59:13 +09:00
Bo26fhmC5M
ab7a2aa499 feat: add resummarize button to HypaV3 Data modal 2025-01-12 23:32:20 +09:00
Bo26fhmC5M
be1713df4b feat: add trash button to HypaV3 Data modal 2025-01-12 19:12:04 +09:00
Bo26fhmC5M
50361d7aa2 feat: Implement HypaV3 ratio-based memory 2025-01-12 11:05:18 +09:00
poroyo
2ee72ca86f feat: add tooltip for differences overview 2025-01-11 18:30:45 +09:00
poroyo
d9f4951c1c feat: add prompt comparison alert for identical prompts 2025-01-11 14:33:06 +09:00
Kwaroran
9fc8978d1d Add GeminiBlockOff 2025-01-07 00:05:20 +09:00
Kwaroran
2ec13a4550 Modify some parts of PR 2025-01-06 00:30:33 +09:00
Kwaroran
c0e1311568 Add branches 2025-01-06 00:24:03 +09:00
kwaroran
7d1e9dc9bd feat: add prompt comparison feature (#704)
# 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 a **prompt comparison feature** to the prompt preset
interface. Now, users can compare two different prompts to identify
differences.

## How to Use
1. Open the prompt preset window.
2. Click the diff button (next to the copy button) for the first prompt
to use as the baseline. The button will turn green, indicating
selection.
<img width="487" alt="c"
src="https://github.com/user-attachments/assets/c2dcf5fa-c4ee-4b3f-8e52-3f0866b12bc4"
/>

3. Click the diff button for the second prompt to compare against the
baseline. A diff view will appear.
4. Clicking the same diff button twice will clear the selection.

## Diff Display Details
- Line-level comparison
- Modified lines: blue vertical line.
- Deleted content: red text on red background with red vertical line.
- Added content: green text on light green background with green
vertical line.

<img width="597" alt="b"
src="https://github.com/user-attachments/assets/0d026e9e-a7a0-4a17-9b80-a2b57c74d7f9"
/>


- If the prompt content is identical, the following message will be
displayed at the top

<img width="600" alt="a"
src="https://github.com/user-attachments/assets/dd5f36f2-9e96-4279-9f9f-79a17f9e4c89"
/>


## Implementation Details
1. `handleDiffMode` manages prompt selection and clearing.
2. `checkDiff` compares prompts and uses `highlightChanges` to mark
differences.
3. Special characters are escaped with `escapeHtml` to ensure the text
is displayed as-is.
4. `resultHtml` is rendered via `alertMd`.

## Notes
- This feature uses the `jsdiff` library to compare prompts efficiently.
- The comparison includes the role, type1, and type2 fields (e.g., ##
system; plain; main). Even if the prompts' text is identical,
differences in these fields will be treated as a mismatch.
- The rendering process in `alertMd` appears to sanitize potentially
dangerous content. However, additional escaping is applied to ensure
that the text is displayed as-is.
- `botpreset.svelte` grew significantly due to this feature;
modularization was considered but not implemented.
- The reason for using the "Prompt Preset" window instead of the "Prompt
Preview" feature is that "Prompt Preview" displays the final form with
CBS processing applied. Even if the content in "Prompt Preview" appears
identical, the actual prompts can differ significantly.

If this feature, its implementation, or any other issue doesn't fit the
project's vision, feel free to reject this PR! Thank you for reviewing!
2025-01-06 00:10:51 +09:00
Bo26fhmC5M
bb93e04961 fix: replace unsupported Hrkt unicode property to Hira and Kana 2025-01-05 19:32:31 +09:00
poroyo
495163c9cf style: improve readability for added and removed lines with border-left 2025-01-05 16:11:00 +09:00
poroyo
8ba4417065 feat: add prompt comparison feature 2025-01-05 14:20:20 +09:00
Kwaroran
821ba1812f Merge branch 'main' of https://github.com/kwaroran/RisuAI 2025-01-02 03:03:03 +09:00
Kwaroran
866996ba1e chore: update version to 145.3.0 2025-01-02 03:02:54 +09:00
poroyo
2730e40b3b Refactor char folder image upload process to use direct upload method 2024-12-30 07:31:40 +09:00
poroyo
b83cb444b9 Add functionality to update char folder images 2024-12-29 07:28:04 +09:00
Kwaroran
cd092a5a01 feat: add translation feature and ban character set functionality 2024-12-29 04:03:21 +09:00
Kwaroran
191be6d5c1 feat: add image translation feature and enhance regex list functionality 2024-12-27 15:51:29 +09:00
Kwaroran
c5f5786af7 fix: update image source reference in bot presets to use preset.image 2024-12-26 07:44:18 +09:00
kwaroran
b874ed42ed HypaV2 context deletion safety (#680)
# PR Checklist
- [x] Did you check if it works normally in all models? *ignore this
when it dosen't uses models*
- [] Did you check if it works normally in all of web, local and node
hosted versions? if it dosen't, did you blocked it in those versions? <<
Checked on browser only, works fine
- [x] Did you added a type def?

# Description
HypaV2 data's large type definition update.
```ts
    mainChunks: { // summary itself
        id: number;
        text: string;
        chatMemos: Set<string>; // UUIDs of summarized chats
        lastChatMemo: string;
    }[];
    chunks: { // split mainChunks for retrieval or something. Although quite uncomfortable logic, so maybe I will delete it soon.
        mainChunkID: number;
        text:string;
    }[];
```
With this, ensure that mainChunks is relevant on chat context change by
deletion

If there is no UUID in the chat context, but it exists on chatMemos on
certain mainChunk, removes it.

Changed index.svelte.ts to update args on each call to ensure hypav2 to
stay adaptive on this change without refreshing the page

Also changed mainChunks to be pushed instead of unshifted
2024-12-26 05:02:33 +09:00
Kwaroran
2672195d92 Add preset related features 2024-12-26 04:29:14 +09:00
Kwaroran
c6cc258a50 Refactor preset handling and improve database snapshot logic 2024-12-26 03:18:00 +09:00
Kwaroran
28d8bfdd22 Fix nativeFetch and comfy 2024-12-25 21:06:52 +09:00
Kwaroran
027a591424 Remove V1 Plugin 2024-12-24 23:14:49 +09:00
Kwaroran
8f667d6394 Add Saving Icon 2024-12-23 17:07:19 +09:00
HyperBlaze
ea2fc1ad26 Merge branch 'kwaroran:main' into main 2024-12-20 23:36:41 -08:00
Kwaroran
e5e01d0688 Fix error handling in gemini and add dataItem hotkey 2024-12-20 18:11:11 +09:00
Kwaroran
b07a9b9d15 Update version to 143.7.1 and add menu sidebar options 2024-12-19 05:34:09 +09:00
Kwaroran
7c7bf16712 Merge branch 'main' of https://github.com/kwaroran/RisuAI 2024-12-18 03:26:30 +09:00
Kwaroran
5df9e68bae Add o1 and fix some mistakes 2024-12-18 03:26:02 +09:00