-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmemory_test.html
More file actions
59 lines (51 loc) · 2 KB
/
memory_test.html
File metadata and controls
59 lines (51 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Memory Test</title>
</head>
<body>
<h1>Memory Test</h1>
<div id="test-results"></div>
<script>
async function testMemory() {
const resultsDiv = document.getElementById('test-results');
// Test conversation history
const conversationHistory = [
{ role: 'user', content: 'My name is John and I like pizza' },
{ role: 'assistant', content: 'Nice to meet you John!' }
];
try {
const response = await fetch('http://localhost:8002/chat', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
prompt: 'What was my previous question?',
conversationHistory: conversationHistory
})
});
const data = await response.json();
resultsDiv.innerHTML = `
<h2>Test Results:</h2>
<p><strong>Request sent:</strong></p>
<pre>${JSON.stringify({
prompt: 'What was my previous question?',
conversationHistory: conversationHistory
}, null, 2)}</pre>
<p><strong>Response:</strong></p>
<pre>${JSON.stringify(data, null, 2)}</pre>
`;
console.log('Response:', data);
} catch (error) {
resultsDiv.innerHTML = `<p>Error: ${error.message}</p>`;
console.error('Error:', error);
}
}
// Run test when page loads
testMemory();
</script>
</body>
</html>