Repository navigation
Fix #3: persist session history and add session listing - #10
Open
xiaoyao-666-coder wants to merge 2 commits into
Open
xiaoyao-666-coder wants to merge 2 commits into
xiaoyao-666-coder wants to merge 2 commits into
Conversation
- Store per-turn messages in WorkflowState and include them in
the public session state, so refresh/logout no longer loses the
transcript.
- Add GET /api/sessions (owner-scoped, newest first) and include
messages in GET /api/sessions/{id}.
- Frontend: show a real history list, restore the most recent
session on login/refresh, and restore a session on click.
- Add backend/tests/test_session_history.py (7 tests).
Closes zhengdaodeguL#3 (session history lost on refresh/logout).
This was referenced Nov 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3.
刷新或登出重登后会话历史全部丢失。根因:前端消息只在 React 内存里,后端没有列会话的接口,会话状态也不存完整对话记录。
GET /api/sessions(仅本人、按更新时间倒序),GET /api/sessions/{id}返回完整消息。backend/tests/test_session_history.py(7 个测试):多轮存入与恢复、列表倒序且仅本人、跨用户读他人会话 404、过期会话排除、幂等重放不重复。验证:
MEDGUIDE_MODE=test python -m pytest -q backend/tests528 passed(基线 521 + 7 新);前端npm test10/10,npm run build成功。已知限制:Redis 后端没有会话索引,历史列表在 Redis 部署下返回
complete: false(内存后端完整可用);会话默认 24 小时过期、重启丢失的原有存储模型未改。