feat: improve frontend API, Streamlit UI, FAISS store, and memory storage - #4
Merged
Merged
Conversation
…rage
Frontend API (frontend_api_svc.py):
- Add GET /projects/ endpoint to list all projects (newest-first)
- Add DELETE /projects/{id}/ endpoint with guard against deleting running projects
- Add GET /projects/{id}/metrics/ endpoint exposing prompt/completion token counts
and a rough USD cost estimate per project
- Add WebSocket /projects/{id}/ws endpoint for real-time streaming of status
changes, captured logs, and agent messages to connected clients
- Introduce TokenUsage model and _add_token_usage() helper; accumulate token
usage during both mock and real MetaGPT runs
- Structured JSON-line message logging via _write_message(); messages are
broadcast over WebSocket in real time
- Improve mock-mode simulation: per-agent-step token accounting and async delays
- Health check now includes in-memory project count
Streamlit UI (metagpt_streamlit_ui.py):
- Move all imports to the top of file (Optional/List/Dict were previously at
the bottom, causing NameErrors on first use)
- Replace all st.experimental_rerun() calls with st.rerun() (un-deprecated API)
- Add sidebar project list with status icons and one-click project switching
- Add one-click project deletion from sidebar
- Expose the new /metrics/ endpoint as a Cost & Usage Metrics section
- Expose optional project name input on project creation form
- Add helper functions for list_projects and delete_project
FAISS store (faiss_store.py):
- Fix FIXME: call self.persist() after insert_nodes() so added documents
survive across sessions
- Accept optional metadatas argument and propagate it to TextNode
- Return list of inserted node IDs instead of an empty list
Memory storage (memory_storage.py):
- Replace magic float threshold (0.1) with a configurable similarity_threshold
parameter (default 0.5) and proper docstring explaining score semantics
- Fix search_similar() to keep results whose score >= threshold (higher score =
more relevant in llama_index) and respect the k limit
- Guard against None scores from the retriever
https://claude.ai/code/session_01Vz63pW62BgvXDQXJiyeEXp
Owner
Author
|
@copilot review this |
|
@JMcCumberIO I've opened a new pull request, #5, to work on those changes. Once the pull request is ready, I'll request review from you. |
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.
Frontend API (frontend_api_svc.py):
and a rough USD cost estimate per project
changes, captured logs, and agent messages to connected clients
usage during both mock and real MetaGPT runs
broadcast over WebSocket in real time
Streamlit UI (metagpt_streamlit_ui.py):
the bottom, causing NameErrors on first use)
FAISS store (faiss_store.py):
survive across sessions
Memory storage (memory_storage.py):
parameter (default 0.5) and proper docstring explaining score semantics
more relevant in llama_index) and respect the k limit
https://claude.ai/code/session_01Vz63pW62BgvXDQXJiyeEXp