Skip to content

feat(chat): add terminal-style message history navigation with arrow keys on chat page#2466

Open
bowenliang123 wants to merge 4 commits intoagentscope-ai:mainfrom
bowenliang123:feat-history-arrow
Open

feat(chat): add terminal-style message history navigation with arrow keys on chat page#2466
bowenliang123 wants to merge 4 commits intoagentscope-ai:mainfrom
bowenliang123:feat-history-arrow

Conversation

@bowenliang123
Copy link
Copy Markdown
Contributor

@bowenliang123 bowenliang123 commented Mar 28, 2026

Description

[Describe what this PR does and why]

  • Add keyboard navigation to recall previously sent messages in the chat input using Up/Down arrow keys, similar to terminal shells.

  • Press Up to recall older messages

  • Press Down to recall newer messages or restore draft

  • Multi-line support: cursor must be at first/last line to trigger history

  • hints in placeholder for inputbox:

image - backfilling sent messages: image

Related Issue: Fixes #(issue_number) or Relates to #(issue_number)

Security Considerations: [If applicable, e.g. channel auth, env/config handling]

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Refactoring

Component(s) Affected

  • Core / Backend (app, agents, config, providers, utils, local_models)
  • Console (frontend web UI)
  • Channels (DingTalk, Feishu, QQ, Discord, iMessage, etc.)
  • Skills
  • CLI
  • Documentation (website)
  • Tests
  • CI/CD
  • Scripts / Deploy

Checklist

  • I ran pre-commit run --all-files locally and it passes
  • If pre-commit auto-fixed files, I committed those changes and reran checks
  • I ran tests locally (pytest or as relevant) and they pass
  • Documentation updated (if needed)
  • Ready for review

Testing

[How to test these changes]

Local Verification Evidence

pre-commit run --all-files
# paste summary result

pytest
# paste summary result

Additional Notes

[Optional: any other context]

Copilot AI review requested due to automatic review settings March 28, 2026 18:29
@github-actions
Copy link
Copy Markdown

Welcome to CoPaw! 🐾

Hi @bowenliang123, this is your 6th Pull Request.

🙌 Join Developer Community

Thanks so much for your contribution! We'd love to invite you to join the official CoPaw developer group! You can find the Discord and DingTalk group links under the "Developer Community" section on our docs page:
https://copaw.agentscope.io/docs/community

We truly appreciate your enthusiasm—and look forward to your future contributions! 😊

We'll review your PR soon.

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 introduces a message history navigation feature to the chat interface, enabling users to navigate through their previous messages using the ArrowUp and ArrowDown keys. The implementation includes a new useMessageHistoryNavigation hook and utility functions for text extraction and textarea manipulation. Review feedback suggests refining the focus event handler to avoid resetting history when non-chat elements are focused, improving the readability of the message retrieval logic, and simplifying the text extraction utility using optional chaining.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds terminal-style Up/Down arrow navigation for recalling previously sent user messages in the console Chat page input (with basic multi-line gating).

Changes:

  • Added a useMessageHistoryNavigation hook that listens for ArrowUp/ArrowDown on the chat sender textarea and swaps the textarea value to prior user messages.
  • Added utilities to extract text from card-based user messages and to programmatically set textarea value while triggering an input event.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
console/src/pages/Chat/utils.ts Adds helpers for extracting text from card-structured messages and for setting textarea value + dispatching an input event.
console/src/pages/Chat/index.tsx Introduces a new hook that wires global key handling to navigate chat input history via chatRef message history.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@zhijianma
Copy link
Copy Markdown
Member

@bowenliang123

Very funny~ Could you add the arrow usage hint to the chat input placeholder to inform users?

Copilot AI review requested due to automatic review settings March 29, 2026 08:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bowenliang123
Copy link
Copy Markdown
Contributor Author

bowenliang123 commented Mar 29, 2026

Sure, the inputbox's placeholder is now updated to be shorter and consise as "↑↓" for message navigation · "/" for quick commands ("/approve" or "/deny" during approvals)" . @zhijianma

Copilot AI review requested due to automatic review settings March 29, 2026 08:26
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bowenliang123 bowenliang123 force-pushed the feat-history-arrow branch 2 times, most recently from 26c86d8 to e92fae6 Compare March 29, 2026 08:41
Copilot AI review requested due to automatic review settings March 29, 2026 08:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…e element’s prototype chain) to bypass React’s tracker, then dispatch the input event.
@bowenliang123
Copy link
Copy Markdown
Contributor Author

@zhijianma It's now ready for review, please check.

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.

3 participants