Skip to main content
Glama

Notion MCP Server V2

by ankitmalik84
3-basic_chatbot_v1.mdโ€ข1.94 kB
# ๐Ÿค– Basic Chatbot This is the simplest form of a memory-aware chatbot. It uses OpenAI's chat models combined with persistent history management to enable short-term context retention across turns. The goal of this chatbot is to create a conversational loop that remembers **recent history**, personalizes replies based on **user info**, and summarizes past interactions, without advanced memory systems. ## โš™๏ธ Core Functionalities ### 1. ๐Ÿงฑ Initialization When the `Chatbot` class is initialized, it sets up: - โœ… **Model Configuration** Loads model names, token limits, and paths from a configuration file. - โœ… **Session ID Generation** Each chat session is assigned a unique ID for tracking. - โœ… **Components Setup** - `SQLManager`: Connects to a local or remote database - `UserManager`: Retrieves or stores user information - `ChatHistoryManager`: Tracks message history and summaries - โœ… **Chat Summary Retrieval** Pulls the most recent conversation summary to preserve continuity in new prompts. --- ### 2. ๐Ÿ’ฌ Conversational Handling When a message is received: - ๐Ÿ“Œ **System Prompt Construction** Dynamically builds a prompt including: - User profile details - A summary of earlier chats - The last few message pairs - ๐Ÿ” **Model Invocation** Sends the prompt and user message to OpenAI's API and receives a reply. - ๐Ÿง  **Chat History Update** - Stores the conversation pair in the database - Updates the summary if needed to stay within context length - โš ๏ธ **Error Handling** Any issues during the API request return a readable error message. --- ## ๐Ÿงพ Visual Overview Here's a high-level schema showing how the basic chatbot works: ![Basic Chatbot Architecture](../images/basic_chatbot.png) --- > ๐Ÿงฉ This chatbot doesn't support tool usage or long-term memory. > But it's a solid foundation for building more advanced, agentic systems.

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ankitmalik84/Agentic_Longterm_Memory'

If you have feedback or need assistance with the MCP directory API, please join our Discord server