Feature/zhanghonghao02#32
Open
zhh293 wants to merge 8 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a “plan mode” workflow (planning → awaiting approval → execution) and adds a folder-level Knowledge Base (RAG) feature, along with session persistence refactors and frontend status UI updates to support the new runtime/task states.
Changes:
- Add plan-mode state machine with UI/runtime status propagation and structured session memory persistence.
- Add Knowledge Base REST APIs with local FAISS-backed indexing/search and folder/file management.
- Refactor chat/session storage from a single JSON file to per-session files (meta.json + messages.jsonl + index).
Reviewed changes
Copilot reviewed 22 out of 24 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| uv.lock | Locks new dependencies (faiss-cpu, numpy, orjson, python-multipart, packaging). |
| pyproject.toml | Adds dependencies required for FAISS RAG + multipart uploads + orjson. |
| tool_registry.py | Adds stop_loop to support plan-mode “pause after submit”. |
| task_manager.py | Extends persistent task statuses for planning/approval. |
| RAG_KNOWLEDGE_DEV_PLAN.md | Adds detailed RAG implementation plan/design doc. |
| platforms/web.py | Adds plan approval detection, runtime status packets, meta/session-memory wiring. |
| memory/session_memory.py | New structured session memory model + serialization helpers. |
| memory/init.py | Exposes SessionMemory. |
| main.py | Adds Knowledge Base APIs; refactors session storage to per-session directory + JSONL. |
| knowledge_service.py | Implements knowledge folder/file CRUD, selection state, and indexing orchestration. |
| knowledge_indexer.py | Implements local deterministic embedding + FAISS index snapshot + folder-scoped search. |
| frontend/src/locales/zh.json | Adds i18n strings for agent/task planning + approval states. |
| frontend/src/locales/en.json | Adds i18n strings for agent/task planning + approval states. |
| frontend/src/composables/useTasks.ts | Extends task model/sorting and summary fields for new statuses. |
| frontend/src/components/TaskSidebar.vue | Displays planning/awaiting approval states with icons/labels. |
| frontend/src/App.vue | Displays runtime agent status (planning/awaiting approval/running) in header. |
| agent.py | Adds plan-mode tools + tool restrictions, session memory updates, and knowledge_search tool. |
| agent_task_manager.py | Adds new runtime statuses and status-setting helper. |
| .gitignore | Ignores new sessions/ storage and legacy backup file. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+171
to
+175
| new_vectors = np.zeros((len(chunks), self.dim), dtype=np.float32) | ||
| for idx, item in enumerate(chunks): | ||
| text = str(item.get("text", "")).strip() | ||
| if not text: | ||
| continue |
|
|
||
| def _folder_path(self, folder_id: str) -> Path: | ||
| path = (self.knowledge_root / folder_id).resolve() | ||
| if not str(path).startswith(str(self.knowledge_root)): |
Comment on lines
321
to
326
| @app.get("/chats") | ||
| def list_chats(): | ||
| """Return all sessions sorted by created_at descending.""" | ||
| result = [_session_preview(s) for s in sessions.values()] | ||
| result = [_session_preview({"id": sid, **info}) for sid, info in _session_index.items()] | ||
| result.sort(key=lambda x: x["created_at"], reverse=True) | ||
| return result |
| if self._append_message_fn: | ||
| self._append_message_fn(self._session_id, msg) | ||
| if role == "user" and self._update_session_fn: | ||
| pass |
Comment on lines
+63
to
+67
| def _classify_plan_response(text: str) -> str: | ||
| normalized = (text or "").strip().lower() | ||
| if any(phrase in normalized for phrase in _PLAN_APPROVAL_PHRASES): | ||
| return "approved" | ||
| return "revise" |
Comment on lines
62
to
+66
| def has_running_task(self, session_id: str) -> bool: | ||
| if session_id not in self._tasks: | ||
| return False | ||
| task = self._tasks[session_id] | ||
| return task.status == TaskStatus.RUNNING and not task.task.done() | ||
| return task.status in (TaskStatus.RUNNING, TaskStatus.PLANNING) and not task.task.done() |
| api_key=os.getenv("ANTHROPIC_API_KEY"), base_url=os.getenv("ANTHROPIC_BASE_URL") | ||
| ) | ||
| model_name = os.getenv("MODEL_NAME", "claude-3-7-sonnet-20250219") | ||
| model_name = os.getenv("MODEL_NAME", "MiniMax-M2.7") |
Comment on lines
+442
to
+445
| parsed_files: list[tuple[str, bytes, str]] = [] | ||
| for upload in files: | ||
| content = await upload.read() | ||
| parsed_files.append( |
Owner
|
👍 |
Owner
|
This branch has conflicts that must be resolved |
Collaborator
Author
|
收到🫡
…---Original---
From: ***@***.***>
Date: Sat, May 9, 2026 20:58 PM
To: ***@***.***>;
Cc: ***@***.******@***.***>;
Subject: Re: [LangQi99/NeoFish] Feature/zhanghonghao02 (PR #32)
LangQi99 left a comment (LangQi99/NeoFish#32)
This branch has conflicts that must be resolved
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
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.
plan模式