Skip to content

Feature/chat history - #4

Merged
BYLinMou merged 2 commits into
mainfrom
feature/ChatHistory
Oct 17, 2025
Merged

BYLinMou merged 2 commits into
mainfrom
feature/ChatHistory

Conversation

@BYLinMou

Copy link
Copy Markdown
Owner

This pull request introduces improvements to both the roleplay and story game experiences by adding chat history management, limiting context sent to the backend, and enhancing the user interface for story exploration. It also updates language files and configuration to support these changes. The main themes are chat history context, UI enhancements for story games, and internationalization.

Chat history context and backend integration:

  • Added maxHistory configuration to both roleplay.json and story.json, allowing the backend to specify how many message pairs are kept in context for AI responses. The frontend now receives this value and uses it to limit the message history sent with each request. (server/config/games/roleplay.json [1] server/config/games/story.json [2] server/src/routes/api.js [3] [4]
  • Both roleplay and story game frontends now maintain structured conversation history arrays, ensuring only the most recent X pairs (user + assistant) are sent to the backend for context. (frontend/public/game/roleplay-game.html [1] [2] [3] [4] [5] [6]; frontend/public/game/story-game.html [7] [8] [9]

UI enhancements for story game:

  • Redesigned the story game layout to have a fixed header and action buttons, with a scrollable chat history container that visually separates chapters and user choices. (frontend/public/game/story-game.html [1] [2] [3] [4] [5] [6] [7]
  • Added a function to append chat items to the history display, distinguishing between system-generated chapters and user choices for better readability. (frontend/public/game/story-game.html frontend/public/game/story-game.htmlR241-R283)

Internationalization improvements:

  • Added the "yourChoice" translation key to all supported language files to improve labeling of user choices in the UI. (frontend/public/assets/locales/en.json [1] frontend/public/assets/locales/ja.json [2] frontend/public/assets/locales/ko.json [3] frontend/public/assets/locales/zh-Hans.json [4] frontend/public/assets/locales/zh.json [5]

Other updates:

  • Updated the app version and publish date in package.json for release tracking. (package.json package.jsonL3-R5)

Implements a configurable maxHistory limit for chat and story context in both frontend and backend. Frontend now sends only the last X(5) pairs of user/assistant messages, and backend enforces the limit per game config. Config files updated to include maxHistory, and API responses now return this value for frontend use.
Introduces a scrollable chat history for chapters and user choices in story-game.html, improving user experience and context retention. Adds 'yourChoice' translation key to all supported locales for proper labeling of user actions in the chat history.
@BYLinMou
BYLinMou merged commit f936ef0 into main Oct 17, 2025
1 check passed
@BYLinMou
BYLinMou deleted the feature/ChatHistory branch October 17, 2025 11:39
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.

1 participant