Skip to content

feat: 增加已读历史记录能力,并支持区分已读文本,允许设置跳过是仅已读文本还是全部文本#930

Open
ChangeSuger wants to merge 5 commits intoOpenWebGAL:devfrom
ChangeSuger:feat/read-history
Open

feat: 增加已读历史记录能力,并支持区分已读文本,允许设置跳过是仅已读文本还是全部文本#930
ChangeSuger wants to merge 5 commits intoOpenWebGAL:devfrom
ChangeSuger:feat/read-history

Conversation

@ChangeSuger
Copy link
Copy Markdown
Contributor

#663 #771

基于目前 WebGal 的 Scene 记录逻辑而设计的已读历史记录功能,基于 sceneName 与 currentSentenceId 进行已读信息记录以及判断。该已读历史记录功能以单个 Scene 的脚本为单元进行已读历史记录,并使用 Uint8Array 来减少存储体积。

在已读历史记录功能及基础上,实现了以下能力:

  • 区分已读文本与未读文本,允许用户自定义已读文本的样式
  • 支持设置快进模式为跳过已读或跳过全部,默认为跳过已读

@ChangeSuger ChangeSuger changed the title 增加已读历史记录能力,并支持区分已读文本,允许设置跳过是仅已读文本还是全部文本 feat: 增加已读历史记录能力,并支持区分已读文本,允许设置跳过是仅已读文本还是全部文本 Apr 15, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements a read history system to track viewed text and introduces a skip mode to toggle between skipping only read content or all content. Key additions include a ReadHistoryManager using bitsets for efficient storage and UI updates to visually distinguish read text. Feedback focuses on addressing potential out-of-bounds errors in bitset management, preventing stack overflow issues when encoding large history data, and adding guard clauses for empty scenario names.

Comment thread packages/webgal/src/Core/Modules/readHistory.ts Outdated
Comment thread packages/webgal/src/Core/Modules/readHistory.ts Outdated
Comment on lines +87 to +88
const scenarioName = this.sceneManager.sceneData.currentScene.sceneName;
const index = this.sceneManager.sceneData.currentSentenceId;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

If scenarioName is an empty string (which can happen during initialization or transition), the manager will attempt to record history for an invalid key. It's better to add a guard clause.

Suggested change
const scenarioName = this.sceneManager.sceneData.currentScene.sceneName;
const index = this.sceneManager.sceneData.currentSentenceId;
const scenarioName = this.sceneManager.sceneData.currentScene.sceneName;
if (!scenarioName) return;
const index = this.sceneManager.sceneData.currentSentenceId;

- 解决构建失败问题
- 兼容脚本变更可能导致的索引溢出问题
@MakinoharaShoko MakinoharaShoko self-assigned this Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants