Skip to content

Commit 016a3c9

Browse files
authored
Merge pull request #20 from wupz1027/main
doc
2 parents 4dc8178 + 2ec9f77 commit 016a3c9

1 file changed

Lines changed: 130 additions & 75 deletions

File tree

docs/docs.html

Lines changed: 130 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -17,48 +17,42 @@
1717
max-width: 1200px;
1818
margin: 0 auto;
1919
min-height: 100vh;
20+
padding-left: 250px;
2021
}
2122
.sidebar {
22-
min-width: 250px;
23-
max-width: 250px;
24-
width: 250px;
25-
height: 100vh;
26-
overflow-y: auto;
27-
background: linear-gradient(160deg, #f8f9fa 60%, #e6f0fa 100%);
28-
border-right: 1px solid #e0e7ef;
29-
padding: 32px 0 32px 0;
30-
display: flex;
31-
flex-direction: column;
32-
position: fixed;
33-
top: 0;
34-
left: 0;
35-
box-shadow: 2px 0 12px 0 rgba(0,0,0,0.04);
36-
z-index: 100;
37-
}
38-
.container {
39-
display: flex;
40-
max-width: 1200px;
41-
margin: 0 auto;
42-
min-height: 100vh;
43-
padding-left: 250px;
44-
}
45-
@media (max-width: 900px) {
46-
.sidebar {
47-
position: static;
48-
width: 100%;
49-
min-width: unset;
50-
max-width: unset;
51-
height: auto;
52-
box-shadow: none;
53-
border-right: none;
54-
border-bottom: 1px solid #eee;
55-
flex-direction: row;
56-
padding: 0;
57-
}
58-
.container {
59-
padding-left: 0;
60-
}
61-
}
23+
min-width: 250px;
24+
max-width: 250px;
25+
width: 250px;
26+
height: 100vh;
27+
overflow-y: auto;
28+
background: linear-gradient(160deg, #f8f9fa 60%, #e6f0fa 100%);
29+
border-right: 1px solid #e0e7ef;
30+
padding: 32px 0 32px 0;
31+
display: flex;
32+
flex-direction: column;
33+
position: fixed;
34+
top: 0;
35+
left: 0;
36+
box-shadow: 2px 0 12px 0 rgba(0,0,0,0.04);
37+
z-index: 100;
38+
}
39+
@media (max-width: 900px) {
40+
.sidebar {
41+
position: static;
42+
width: 100%;
43+
min-width: unset;
44+
max-width: unset;
45+
height: auto;
46+
box-shadow: none;
47+
border-right: none;
48+
border-bottom: 1px solid #eee;
49+
flex-direction: row;
50+
padding: 0;
51+
}
52+
.container {
53+
padding-left: 0;
54+
}
55+
}
6256
.sidebar .nav-title {
6357
font-size: 1.15rem;
6458
font-weight: 700;
@@ -337,7 +331,7 @@
337331
<li><a class="nav-link" href="#" data-section="getstarted">Get started</a></li>
338332
<li><a class="nav-link" href="#" data-section="configure">Configure Instruction</a></li>
339333
<li><a class="nav-link" href="#" data-section="howitworks">How It Works</a></li>
340-
<li><a class="nav-link" href="#" data-section="platform">MemoryOS Platform</a></li>
334+
<li><a class="nav-link" href="#" data-section="platform">MemoryOS Playground</a></li>
341335
</ul>
342336
</nav>
343337
<main class="main-content">
@@ -366,54 +360,115 @@ <h2>Welcome to MemoryOS</h2>
366360
</ul>
367361
</section>
368362
<section class="section" id="getstarted">
369-
<h2>Get started</h2>
363+
<h2>Get Started</h2>
370364
<ul class="features">
371-
<li><b>Prerequisites</b>: Python &gt;= 3.10</li>
372-
<li><b>Installation</b>:
373-
<br><code>conda create -n MemoryOS python=3.10</code>
374-
<br><code>conda activate MemoryOS</code>
375-
<br><code>git clone https://github.com/BAI-LAB/MemoryOS.git</code>
376-
<br><code>cd MemoryOS/memoryos-pypi</code>
377-
<br><code>pip install -r requirements.txt</code>
378-
</li>
379-
<li><b>Basic Usage</b>:
380-
<pre><code>import os
365+
<li><b>MemoryOS_PYPI Getting Started</b></li>
366+
<ul>
367+
<li><b>Prerequisites</b>
368+
<ul>
369+
<li>Python >= 3.10</li>
370+
</ul>
371+
</li>
372+
<li><b>Installation</b>
373+
<pre><code>conda create -n MemoryOS python=3.10
374+
conda activate MemoryOS
375+
git clone https://github.com/BAI-LAB/MemoryOS.git
376+
cd MemoryOS/memoryos-pypi
377+
pip install -r requirements.txt</code></pre>
378+
</li>
379+
<li><b>Basic Usage</b>
380+
<pre><code>import os
381381
from memoryos import Memoryos
382382

383+
# --- Basic Configuration ---
383384
USER_ID = "demo_user"
384385
ASSISTANT_ID = "demo_assistant"
385-
API_KEY = "YOUR_OPENAI_API_KEY"
386-
BASE_URL = ""
386+
API_KEY = "YOUR_OPENAI_API_KEY" # Replace with your key
387+
BASE_URL = "" # Optional: if using a custom OpenAI endpoint
387388
DATA_STORAGE_PATH = "./simple_demo_data"
388389
LLM_MODEL = "gpt-4o-mini"
389390

390391
def simple_demo():
391-
memo = Memoryos(
392-
user_id=USER_ID,
393-
openai_api_key=API_KEY,
394-
openai_base_url=BASE_URL,
395-
data_storage_path=DATA_STORAGE_PATH,
396-
llm_model=LLM_MODEL,
397-
assistant_id=ASSISTANT_ID,
398-
short_term_capacity=7,
399-
mid_term_heat_threshold=5,
400-
retrieval_queue_capacity=7,
401-
long_term_knowledge_capacity=100
402-
)
392+
print("MemoryOS Simple Demo")
393+
394+
# 1. Initialize MemoryOS
395+
print("Initializing MemoryOS...")
396+
try:
397+
memo = Memoryos(
398+
user_id=USER_ID,
399+
openai_api_key=API_KEY,
400+
openai_base_url=BASE_URL,
401+
data_storage_path=DATA_STORAGE_PATH,
402+
llm_model=LLM_MODEL,
403+
assistant_id=ASSISTANT_ID,
404+
short_term_capacity=7,
405+
mid_term_heat_threshold=5,
406+
retrieval_queue_capacity=7,
407+
long_term_knowledge_capacity=100
408+
)
409+
print("MemoryOS initialized successfully!\n")
410+
except Exception as e:
411+
print(f"Error: {e}")
412+
return
413+
414+
# 2. Add some basic memories
415+
print("Adding some memories...")
416+
403417
memo.add_memory(
404418
user_input="Hi! I'm Tom, I work as a data scientist in San Francisco.",
405419
agent_response="Hello Tom! Nice to meet you. Data science is such an exciting field. What kind of data do you work with?"
406420
)
407-
response = memo.get_response(query="What do you remember about my job?")
421+
422+
test_query = "What do you remember about my job?"
423+
print(f"User: {test_query}")
424+
425+
response = memo.get_response(
426+
query=test_query,
427+
)
428+
408429
print(f"Assistant: {response}")
409430

410431
if __name__ == "__main__":
411432
simple_demo()</code></pre>
412-
</li>
433+
</li>
434+
</ul>
435+
<li><b>MemoryOS-MCP Getting Started</b></li>
436+
<ul>
437+
<li><b>🔧 Core Tools</b>
438+
<ol>
439+
<li><code>add_memory</code><br>Saves the content of the conversation between the user and the AI assistant into the memory system, for the purpose of building a persistent dialogue history and contextual record.</li>
440+
<li><code>retrieve_memory</code><br>Retrieves related historical dialogues, user preferences, and knowledge information from the memory system based on a query, helping the AI assistant understand the user’s needs and background.</li>
441+
<li><code>get_user_profile</code><br>Obtains a user profile generated from the analysis of historical dialogues, including the user’s personality traits, interest preferences, and relevant knowledge background.</li>
442+
</ol>
443+
</li>
444+
<li><b>1. Install dependencies</b>
445+
<pre><code>cd memoryos-mcp
446+
pip install -r requirements.txt</code></pre>
447+
</li>
448+
<li><b>2. Configuration</b><br>Edit <code>config.json</code>:
449+
<pre><code>{
450+
"user_id": "user ID",
451+
"openai_api_key": "OpenAI API key",
452+
"openai_base_url": "https://api.openai.com/v1",
453+
"data_storage_path": "./memoryos_data",
454+
"assistant_id": "assistant_id",
455+
"llm_model": "gpt-4o-mini"
456+
}</code></pre>
457+
</li>
458+
<li><b>3. Start the server</b>
459+
<pre><code>python server_new.py --config config.json</code></pre>
460+
</li>
461+
<li><b>4. Test</b>
462+
<pre><code>python test_comprehensive.py</code></pre>
463+
</li>
464+
<li><b>5. Configure it on Cline and other clients</b><br>Copy the <code>mcp.json</code> file over, and make sure the file path is correct.<br>
465+
<pre><code>"command": "/root/miniconda3/envs/memos/bin/python"</code></pre>
466+
# This should be changed to the Python interpreter of your virtual environment.
467+
</li>
468+
</ul>
413469
</ul>
414470
</section>
415471
<section class="section" id="configure">
416-
417472
<h3>📋 <strong>Complete List of 12 Parameters</strong></h3>
418473
<table>
419474
<thead>
@@ -458,13 +513,13 @@ <h3>📋 <strong>Complete List of 12 Parameters</strong></h3>
458513
<td>5</td>
459514
<td><code>assistant_id</code></td>
460515
<td>str</td>
461-
<td><code>\"default_assistant_profile\"</code></td>
516+
<td><code>"default_assistant_profile"</code></td>
462517
<td>Assistant ID</td>
463518
</tr>
464519
<tr>
465520
<td>6</td>
466521
<td><code>short_term_capacity</code></td>
467-
<td>int</td>
522+
mụn
468523
<td><code>10</code></td>
469524
<td>Short-term memory capacity</td>
470525
</tr>
@@ -507,7 +562,7 @@ <h3>📋 <strong>Complete List of 12 Parameters</strong></h3>
507562
<td>12</td>
508563
<td><code>llm_model</code></td>
509564
<td>str</td>
510-
<td><code>\"gpt-4o-mini\"</code></td>
565+
<td><code>"gpt-4o-mini"</code></td>
511566
<td>LLM model name</td>
512567
</tr>
513568
</tbody>
@@ -535,11 +590,11 @@ <h2>How It Works</h2>
535590
</ul>
536591
</section>
537592
<section class="section" id="platform">
538-
<h2>MemoryOS Platform</h2>
539-
<a class="memory-platform-btn" href="https://baijia.online/memoryos/" target="_blank" rel="noopener">Go to MemoryOS Platform</a>
593+
<h2>MemoryOS Playground</h2>
594+
<a class="memory-platform-btn" href="https://baijia.online/memoryos/" target="_blank" rel="noopener">Go to MemoryOS Playground</a>
540595
<p style="margin-top:18px;">Web-based memory analytics and management platform for MemoryOS. Coming soon!</p>
541596
</section>
542597
</main>
543598
</div>
544599
</body>
545-
</html>
600+
</html>

0 commit comments

Comments
 (0)