Skip to content

fix(web): load most recent session instead of creating new chat#1464

Closed
darrenzeng2025 wants to merge 1 commit intosipeed:mainfrom
darrenzeng2025:fix/web-chat-load-recent-session
Closed

fix(web): load most recent session instead of creating new chat#1464
darrenzeng2025 wants to merge 1 commit intosipeed:mainfrom
darrenzeng2025:fix/web-chat-load-recent-session

Conversation

@darrenzeng2025
Copy link
Copy Markdown
Contributor

Description

When clicking on the chat page, now loads the most recent conversation instead of always creating a new empty chat. This improves UX by showing users their last conversation context.

Changes

  • Modified usePicoChat hook to load recent session on initial mount
  • Added isLoadingSession state to show loading indicator while fetching
  • Added 'loading' translation key for both English and Chinese

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves existing functionality)

AI Code Generation

🤖 Fully AI-generated - AI wrote the code; contributor reviewed and validated it

Related Issue

Fixes #1373

Technical Context

The issue was that activeSessionId was initialized with generateSessionId() which always created a new session. Now it:

  1. Fetches the most recent session from /api/sessions
  2. If a session exists, loads its history
  3. If no sessions exist or on error, falls back to creating a new session

Test Environment

  • OS: Linux
  • Frontend: React + TypeScript

Checklist

  • I have read and understood the contribution guidelines
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have added translations for new UI strings
  • My changes generate no new warnings

@darrenzeng2025 darrenzeng2025 force-pushed the fix/web-chat-load-recent-session branch from 077f122 to 12db696 Compare March 13, 2026 01:38
@sipeed-bot sipeed-bot bot added the type: bug Something isn't working label Mar 13, 2026
When clicking on the chat page, now loads the most recent conversation
instead of always creating a new empty chat. This improves UX by showing
users their last conversation context.

Changes:
- Modified usePicoChat hook to load recent session on mount
- Added isLoadingSession state to show loading indicator
- Added 'loading' translation key for both en and zh

Fixes sipeed#1373
@darrenzeng2025 darrenzeng2025 force-pushed the fix/web-chat-load-recent-session branch from 12db696 to 01b3c5b Compare March 13, 2026 01:43
@wj-xiao wj-xiao added the duplicate This issue or pull request already exists label Mar 13, 2026
@wj-xiao
Copy link
Copy Markdown
Collaborator

wj-xiao commented Mar 13, 2026

Thank you for your contribution.
But there is already an identical PR 1385, and I am sorry to close this PR.

@wj-xiao wj-xiao closed this Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

duplicate This issue or pull request already exists type: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]在web对话页面,每次点击对话项目都是默认显示新的对话。希望修改为默认显示上次的对话内容。

2 participants