Skip to content

Commit 1682182

Browse files
committed
Merge upstream/main into feature/websocket-ui-integration
2 parents 7e7922e + 7885d15 commit 1682182

File tree

13 files changed

+918
-17
lines changed

13 files changed

+918
-17
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ curl -X POST http://127.0.0.1:8000/api/chatbot/sessions
5151

5252
See [docs/README.md](docs/README.md) for detailed explanations.
5353

54+
## 🎥 Setup Video Tutorial
55+
56+
[![Local Setup Video Tutorial](https://img.youtube.com/vi/1DnMNA4aLyE/0.jpg)](https://youtu.be/1DnMNA4aLyE)
57+
58+
The tutorial shows how to fork the repo, set up the backend, download the LLM model, run the frontend, and verify the chatbot works.
59+
60+
61+
5462
## Troubleshooting
5563

5664
**llama-cpp-python installation fails**: Ensure build tools are installed and use Python 3.11+

chatbot-core/api/services/chat_service.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
RETRIEVER_AGENT_PROMPT,
1717
SPLIT_QUERY_PROMPT,
1818
)
19-
from api.services.memory import get_session
19+
20+
from api.services.memory import get_session, get_session_async
2021
from api.services.file_service import format_file_context
2122
from api.tools.tools import TOOL_REGISTRY
2223
from api.tools.utils import (
@@ -462,7 +463,8 @@ async def get_chatbot_reply_stream(
462463
logger.info("Streaming message from session '%s'", session_id)
463464
logger.info("Handling user query: %s", user_input)
464465

465-
memory = get_session(session_id)
466+
memory = await get_session_async(session_id)
467+
466468
if memory is None:
467469
raise RuntimeError(
468470
f"Session '{session_id}' not found in memory store.")

chatbot-core/api/services/memory.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Handles in-memory chat session state (conversation memory).
33
Provides utility functions for session lifecycle.
44
"""
5-
5+
import asyncio
66
import uuid
77
from datetime import datetime, timedelta
88
from threading import Lock
@@ -77,6 +77,12 @@ def get_session(session_id: str) -> ConversationBufferMemory | None:
7777

7878
return memory
7979

80+
async def get_session_async(session_id: str) -> ConversationBufferMemory | None:
81+
"""
82+
Async wrapper for get_session to prevent event loop blocking.
83+
"""
84+
return await asyncio.to_thread(get_session, session_id)
85+
8086

8187
def persist_session(session_id: str)-> None:
8288
"""

chatbot-core/rag/embedding/bm25_indexer.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,5 +104,6 @@ def get(self, index_name: str):
104104
logger= LoggerFactory.instance().get_logger("bm25indexer")
105105
)
106106

107-
if not CONFIG["is_test_mode"]:
108-
indexer.build()
107+
if __name__ == "__main__":
108+
if not CONFIG["is_test_mode"]:
109+
indexer.build()

docs/images/data_pipeline.png

60.7 KB
Loading

docs/images/preview-1.png

43.2 KB
Loading

docs/images/preview-2.png

155 KB
Loading

0 commit comments

Comments
 (0)