@199-bio/engram 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/graph/index.d.ts.map +1 -1
- package/dist/graph/knowledge-graph.d.ts.map +1 -1
- package/dist/index.js +54 -14
- package/dist/retrieval/hybrid.d.ts.map +1 -1
- package/dist/storage/database.d.ts.map +1 -1
- package/dist/web/chat-handler.d.ts.map +1 -0
- package/dist/web/server.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/graph/index.ts +0 -1
- package/src/graph/knowledge-graph.ts +0 -50
- package/src/index.ts +62 -14
- package/src/retrieval/hybrid.ts +8 -5
- package/src/storage/database.ts +12 -0
- package/src/web/chat-handler.ts +472 -0
- package/src/web/server.ts +40 -3
- package/src/web/static/app.js +137 -0
- package/src/web/static/index.html +28 -0
- package/src/web/static/style.css +202 -0
- package/src/graph/extractor.ts +0 -489
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
<button class="nav-btn" data-view="graph">Graph</button>
|
|
16
16
|
</nav>
|
|
17
17
|
<div class="stats" id="stats"></div>
|
|
18
|
+
<button id="chat-toggle" class="chat-toggle" title="Open Chat Assistant">Chat</button>
|
|
18
19
|
</header>
|
|
19
20
|
|
|
20
21
|
<main>
|
|
@@ -90,6 +91,33 @@
|
|
|
90
91
|
</div>
|
|
91
92
|
</div>
|
|
92
93
|
|
|
94
|
+
<!-- Chat Panel -->
|
|
95
|
+
<aside id="chat-panel" class="chat-panel hidden">
|
|
96
|
+
<div class="chat-header">
|
|
97
|
+
<h3>Chat Assistant</h3>
|
|
98
|
+
<div class="chat-actions">
|
|
99
|
+
<button id="chat-clear" title="Clear history">Clear</button>
|
|
100
|
+
<button id="chat-close" title="Close">×</button>
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
<div id="chat-messages" class="chat-messages">
|
|
104
|
+
<div class="chat-message assistant">
|
|
105
|
+
<p>Hi! I can help you manage your memories and entities. Try:</p>
|
|
106
|
+
<ul>
|
|
107
|
+
<li>"Show me all entities"</li>
|
|
108
|
+
<li>"Find duplicates"</li>
|
|
109
|
+
<li>"Merge Boris into Boris Djordjevic"</li>
|
|
110
|
+
<li>"Delete the entity 'crashed'"</li>
|
|
111
|
+
</ul>
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
114
|
+
<div id="chat-status" class="chat-status"></div>
|
|
115
|
+
<form id="chat-form" class="chat-input-form">
|
|
116
|
+
<input type="text" id="chat-input" placeholder="Ask me to manage entities..." autocomplete="off">
|
|
117
|
+
<button type="submit">Send</button>
|
|
118
|
+
</form>
|
|
119
|
+
</aside>
|
|
120
|
+
|
|
93
121
|
<script src="app.js"></script>
|
|
94
122
|
</body>
|
|
95
123
|
</html>
|
package/src/web/static/style.css
CHANGED
|
@@ -428,6 +428,208 @@ button:disabled {
|
|
|
428
428
|
font-variant-numeric: tabular-nums;
|
|
429
429
|
}
|
|
430
430
|
|
|
431
|
+
/* Chat toggle button */
|
|
432
|
+
.chat-toggle {
|
|
433
|
+
margin-left: 1rem;
|
|
434
|
+
background: var(--accent);
|
|
435
|
+
font-size: 0.8125rem;
|
|
436
|
+
padding: 0.5rem 1rem;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
.chat-toggle:hover {
|
|
440
|
+
background: var(--accent-hover);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
.chat-toggle.active {
|
|
444
|
+
background: var(--text-primary);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/* Chat panel */
|
|
448
|
+
.chat-panel {
|
|
449
|
+
position: fixed;
|
|
450
|
+
top: 0;
|
|
451
|
+
right: 0;
|
|
452
|
+
width: 400px;
|
|
453
|
+
height: 100vh;
|
|
454
|
+
background: var(--bg-primary);
|
|
455
|
+
border-left: 1px solid var(--border);
|
|
456
|
+
display: flex;
|
|
457
|
+
flex-direction: column;
|
|
458
|
+
box-shadow: -4px 0 20px var(--shadow);
|
|
459
|
+
z-index: 100;
|
|
460
|
+
transform: translateX(0);
|
|
461
|
+
transition: transform 0.2s ease;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
.chat-panel.hidden {
|
|
465
|
+
transform: translateX(100%);
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
.chat-header {
|
|
469
|
+
display: flex;
|
|
470
|
+
align-items: center;
|
|
471
|
+
justify-content: space-between;
|
|
472
|
+
padding: 1rem 1.25rem;
|
|
473
|
+
background: var(--bg-secondary);
|
|
474
|
+
border-bottom: 1px solid var(--border);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
.chat-header h3 {
|
|
478
|
+
font-size: 1rem;
|
|
479
|
+
font-weight: 500;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
.chat-actions {
|
|
483
|
+
display: flex;
|
|
484
|
+
gap: 0.5rem;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
.chat-actions button {
|
|
488
|
+
font-size: 0.75rem;
|
|
489
|
+
padding: 0.375rem 0.625rem;
|
|
490
|
+
background: var(--bg-tertiary);
|
|
491
|
+
color: var(--text-secondary);
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
.chat-actions button:hover {
|
|
495
|
+
background: var(--border);
|
|
496
|
+
color: var(--text-primary);
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
#chat-close {
|
|
500
|
+
font-size: 1.25rem;
|
|
501
|
+
padding: 0.25rem 0.5rem;
|
|
502
|
+
line-height: 1;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
.chat-messages {
|
|
506
|
+
flex: 1;
|
|
507
|
+
overflow-y: auto;
|
|
508
|
+
padding: 1rem;
|
|
509
|
+
display: flex;
|
|
510
|
+
flex-direction: column;
|
|
511
|
+
gap: 1rem;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
.chat-message {
|
|
515
|
+
padding: 0.875rem 1rem;
|
|
516
|
+
font-size: 0.9375rem;
|
|
517
|
+
line-height: 1.6;
|
|
518
|
+
max-width: 90%;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
.chat-message.user {
|
|
522
|
+
background: var(--accent);
|
|
523
|
+
color: white;
|
|
524
|
+
align-self: flex-end;
|
|
525
|
+
border-radius: 2px;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
.chat-message.assistant {
|
|
529
|
+
background: var(--bg-secondary);
|
|
530
|
+
border: 1px solid var(--border);
|
|
531
|
+
align-self: flex-start;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
.chat-message p {
|
|
535
|
+
margin: 0 0 0.5rem;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
.chat-message p:last-child {
|
|
539
|
+
margin-bottom: 0;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
.chat-message ul {
|
|
543
|
+
margin: 0.5rem 0 0;
|
|
544
|
+
padding-left: 1.25rem;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
.chat-message li {
|
|
548
|
+
margin: 0.25rem 0;
|
|
549
|
+
font-size: 0.875rem;
|
|
550
|
+
color: var(--text-secondary);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
.chat-message.user li {
|
|
554
|
+
color: rgba(255, 255, 255, 0.85);
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
.chat-message pre {
|
|
558
|
+
background: var(--bg-tertiary);
|
|
559
|
+
padding: 0.5rem 0.75rem;
|
|
560
|
+
margin: 0.5rem 0;
|
|
561
|
+
overflow-x: auto;
|
|
562
|
+
font-family: "SF Mono", Monaco, monospace;
|
|
563
|
+
font-size: 0.8125rem;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
.chat-message.thinking {
|
|
567
|
+
background: transparent;
|
|
568
|
+
border: 1px dashed var(--border);
|
|
569
|
+
color: var(--text-muted);
|
|
570
|
+
font-style: italic;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
.chat-status {
|
|
574
|
+
padding: 0.5rem 1rem;
|
|
575
|
+
font-size: 0.75rem;
|
|
576
|
+
color: var(--text-muted);
|
|
577
|
+
text-align: center;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
.chat-status.error {
|
|
581
|
+
color: var(--danger);
|
|
582
|
+
background: rgba(220, 38, 38, 0.1);
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
.chat-status:empty {
|
|
586
|
+
display: none;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
.chat-input-form {
|
|
590
|
+
display: flex;
|
|
591
|
+
gap: 0.5rem;
|
|
592
|
+
padding: 1rem;
|
|
593
|
+
background: var(--bg-secondary);
|
|
594
|
+
border-top: 1px solid var(--border);
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
.chat-input-form input {
|
|
598
|
+
flex: 1;
|
|
599
|
+
font-family: inherit;
|
|
600
|
+
font-size: 0.9375rem;
|
|
601
|
+
padding: 0.625rem 0.875rem;
|
|
602
|
+
border: 1px solid var(--border);
|
|
603
|
+
background: var(--bg-primary);
|
|
604
|
+
color: var(--text-primary);
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
.chat-input-form input:focus {
|
|
608
|
+
outline: none;
|
|
609
|
+
border-color: var(--accent);
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
.chat-input-form input::placeholder {
|
|
613
|
+
color: var(--text-muted);
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
.chat-input-form button {
|
|
617
|
+
background: var(--accent);
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
.chat-input-form button:hover {
|
|
621
|
+
background: var(--accent-hover);
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
.chat-input-form button:disabled {
|
|
625
|
+
background: var(--text-muted);
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
/* Adjust main content when chat is open */
|
|
629
|
+
body.chat-open main {
|
|
630
|
+
margin-right: 400px;
|
|
631
|
+
}
|
|
632
|
+
|
|
431
633
|
/* Responsive */
|
|
432
634
|
@media (max-width: 640px) {
|
|
433
635
|
header {
|