Skip to content

Feature/zhanghonghao02#32

Open
zhh293 wants to merge 8 commits into
mainfrom
feature/zhanghonghao02
Open

Feature/zhanghonghao02#32
zhh293 wants to merge 8 commits into
mainfrom
feature/zhanghonghao02

Conversation

@zhh293
Copy link
Copy Markdown
Collaborator

@zhh293 zhh293 commented May 9, 2026

plan模式

Copy link
Copy Markdown

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

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 thread knowledge_indexer.py
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
Comment thread knowledge_service.py

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 thread main.py
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
Comment thread platforms/web.py
if self._append_message_fn:
self._append_message_fn(self._session_id, msg)
if role == "user" and self._update_session_fn:
pass
Comment thread platforms/web.py
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 thread agent_task_manager.py
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()
Comment thread agent.py
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 thread main.py
Comment on lines +442 to +445
parsed_files: list[tuple[str, bytes, str]] = []
for upload in files:
content = await upload.read()
parsed_files.append(
@LangQi99
Copy link
Copy Markdown
Owner

LangQi99 commented May 9, 2026

👍

@LangQi99
Copy link
Copy Markdown
Owner

LangQi99 commented May 9, 2026

This branch has conflicts that must be resolved

@zhh293
Copy link
Copy Markdown
Collaborator Author

zhh293 commented May 9, 2026 via email

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