ai-memory-rag-dashboard 0.0.0-stage → 1.0.0
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/README.md +160 -2
- package/dist/index.css +1 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +3 -0
- package/dist/index.mjs +3 -0
- package/package.json +50 -4
package/README.md
CHANGED
|
@@ -1,3 +1,161 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ai-memory-rag-dashboard
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> A sleek, dark-mode React dashboard and context inspector component for local multi-tenant RAG and memory systems.
|
|
4
|
+
|
|
5
|
+
## ✨ Features
|
|
6
|
+
|
|
7
|
+
- **Real-time SSE Chat:** Reads `/chat/stream` chunks with auto-scrolling and a typing indicator cursor.
|
|
8
|
+
- **Live Inspector Pane:** Shows rewritten contextual queries, retrieved user memories, and background task statuses side-by-side.
|
|
9
|
+
- **Memory Management:** Dedicated tabs for manual memory creation, Qdrant vector lookups, and conflict/relationship testing.
|
|
10
|
+
- **Knowledge Base Ingestion:** Drag-and-drop document uploader supporting custom chunk sizes and overlap controls.
|
|
11
|
+
- **Configurable Environment:** Edit API Base URL, User ID, and Session ID directly in the header controls at runtime.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## ⚡ Prerequisites
|
|
16
|
+
|
|
17
|
+
To use this React component in your project, ensure you have:
|
|
18
|
+
|
|
19
|
+
- **Node.js**: `v18.0.0` or higher.
|
|
20
|
+
- **React**: `^18.0.0` or `^19.0.0`.
|
|
21
|
+
- **Tailwind CSS**: `^3.0.0` configured in your build system (Next.js, Vite, CRA, etc.).
|
|
22
|
+
- **Backend**: A running instance of the AI Memory + RAG FastAPI backend service (`http://localhost:8000`).
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 🚀 Quickstart
|
|
27
|
+
|
|
28
|
+
### Step 1: Install the Package
|
|
29
|
+
|
|
30
|
+
Run one of the following commands in your React project root:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Using npm
|
|
34
|
+
npm install ai-memory-rag-dashboard lucide-react
|
|
35
|
+
|
|
36
|
+
# Using yarn
|
|
37
|
+
yarn add ai-memory-rag-dashboard lucide-react
|
|
38
|
+
|
|
39
|
+
# Using pnpm
|
|
40
|
+
pnpm add ai-memory-rag-dashboard lucide-react
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Step 2: Ensure Tailwind CSS Configuration
|
|
44
|
+
|
|
45
|
+
Make sure Tailwind CSS scans your `node_modules` directory for styling. Update `tailwind.config.js`:
|
|
46
|
+
|
|
47
|
+
```javascript
|
|
48
|
+
module.exports = {
|
|
49
|
+
content: [
|
|
50
|
+
'./src/**/*.{js,jsx,ts,tsx}',
|
|
51
|
+
'./node_modules/ai-memory-rag-dashboard/dist/**/*.{js,mjs}',
|
|
52
|
+
],
|
|
53
|
+
theme: {
|
|
54
|
+
extend: {},
|
|
55
|
+
},
|
|
56
|
+
plugins: [],
|
|
57
|
+
};
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## 💻 Usage
|
|
63
|
+
|
|
64
|
+
Embed the `AIMemoryDashboard` component in your React / Next.js application:
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
import React from 'react';
|
|
68
|
+
import { AIMemoryDashboard } from 'ai-memory-rag-dashboard';
|
|
69
|
+
|
|
70
|
+
export default function DashboardPage() {
|
|
71
|
+
return (
|
|
72
|
+
<div className="h-screen w-full bg-slate-950">
|
|
73
|
+
<AIMemoryDashboard />
|
|
74
|
+
</div>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## ⚙️ Default Endpoint Map & Contracts
|
|
82
|
+
|
|
83
|
+
The component connects directly to your FastAPI backend using the following request/response schemas:
|
|
84
|
+
|
|
85
|
+
### 1. SSE Chat (`POST /chat/stream`)
|
|
86
|
+
|
|
87
|
+
**Payload:**
|
|
88
|
+
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"query": "How do I setup state management?",
|
|
92
|
+
"history": [],
|
|
93
|
+
"top_k": 2,
|
|
94
|
+
"score_threshold": 0.55,
|
|
95
|
+
"user_id": "alice",
|
|
96
|
+
"session_id": "session_001"
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Stream:** Returns raw text chunks as Server-Sent Events (`data: chunk`).
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
### 2. Manual Memory Store (`POST /store`)
|
|
105
|
+
|
|
106
|
+
**Payload:**
|
|
107
|
+
|
|
108
|
+
```json
|
|
109
|
+
{
|
|
110
|
+
"text": "User prefers Tailwind CSS for frontend projects.",
|
|
111
|
+
"user_id": "alice",
|
|
112
|
+
"session_id": "session_001",
|
|
113
|
+
"memory_type": "fact",
|
|
114
|
+
"importance": 0.8
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**Response:**
|
|
119
|
+
|
|
120
|
+
```json
|
|
121
|
+
{
|
|
122
|
+
"status": "success",
|
|
123
|
+
"memory_id": "c7a21390-1e89-4d2b-9eef-4122bc1d8a3f"
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
### 3. Memory Search (`POST /search_memory`)
|
|
130
|
+
|
|
131
|
+
**Payload:**
|
|
132
|
+
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
"query": "styling tools",
|
|
136
|
+
"limit": 5,
|
|
137
|
+
"score_threshold": 0.3,
|
|
138
|
+
"use_importance_weight": true,
|
|
139
|
+
"user_id": "alice"
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
**Response:**
|
|
144
|
+
|
|
145
|
+
```json
|
|
146
|
+
{
|
|
147
|
+
"results": [
|
|
148
|
+
{
|
|
149
|
+
"id": "c7a21390-1e89-4d2b-9eef-4122bc1d8a3f",
|
|
150
|
+
"text": "User prefers Tailwind CSS for frontend projects.",
|
|
151
|
+
"score": 0.88
|
|
152
|
+
}
|
|
153
|
+
]
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## 📄 License
|
|
160
|
+
|
|
161
|
+
MIT License
|
package/dist/index.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer theme,base,components,utilities;@layer theme{@theme default{ --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; --font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif; --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; --color-red-50: oklch(97.1% .013 17.38); --color-red-100: oklch(93.6% .032 17.717); --color-red-200: oklch(88.5% .062 18.334); --color-red-300: oklch(80.8% .114 19.571); --color-red-400: oklch(70.4% .191 22.216); --color-red-500: oklch(63.7% .237 25.331); --color-red-600: oklch(57.7% .245 27.325); --color-red-700: oklch(50.5% .213 27.518); --color-red-800: oklch(44.4% .177 26.899); --color-red-900: oklch(39.6% .141 25.723); --color-red-950: oklch(25.8% .092 26.042); --color-orange-50: oklch(98% .016 73.684); --color-orange-100: oklch(95.4% .038 75.164); --color-orange-200: oklch(90.1% .076 70.697); --color-orange-300: oklch(83.7% .128 66.29); --color-orange-400: oklch(75% .183 55.934); --color-orange-500: oklch(70.5% .213 47.604); --color-orange-600: oklch(64.6% .222 41.116); --color-orange-700: oklch(55.3% .195 38.402); --color-orange-800: oklch(47% .157 37.304); --color-orange-900: oklch(40.8% .123 38.172); --color-orange-950: oklch(26.6% .079 36.259); --color-amber-50: oklch(98.7% .022 95.277); --color-amber-100: oklch(96.2% .059 95.617); --color-amber-200: oklch(92.4% .12 95.746); --color-amber-300: oklch(87.9% .169 91.605); --color-amber-400: oklch(82.8% .189 84.429); --color-amber-500: oklch(76.9% .188 70.08); --color-amber-600: oklch(66.6% .179 58.318); --color-amber-700: oklch(55.5% .163 48.998); --color-amber-800: oklch(47.3% .137 46.201); --color-amber-900: oklch(41.4% .112 45.904); --color-amber-950: oklch(27.9% .077 45.635); --color-yellow-50: oklch(98.7% .026 102.212); --color-yellow-100: oklch(97.3% .071 103.193); --color-yellow-200: oklch(94.5% .129 101.54); --color-yellow-300: oklch(90.5% .182 98.111); --color-yellow-400: oklch(85.2% .199 91.936); --color-yellow-500: oklch(79.5% .184 86.047); --color-yellow-600: oklch(68.1% .162 75.834); --color-yellow-700: oklch(55.4% .135 66.442); --color-yellow-800: oklch(47.6% .114 61.907); --color-yellow-900: oklch(42.1% .095 57.708); --color-yellow-950: oklch(28.6% .066 53.813); --color-lime-50: oklch(98.6% .031 120.757); --color-lime-100: oklch(96.7% .067 122.328); --color-lime-200: oklch(93.8% .127 124.321); --color-lime-300: oklch(89.7% .196 126.665); --color-lime-400: oklch(84.1% .238 128.85); --color-lime-500: oklch(76.8% .233 130.85); --color-lime-600: oklch(64.8% .2 131.684); --color-lime-700: oklch(53.2% .157 131.589); --color-lime-800: oklch(45.3% .124 130.933); --color-lime-900: oklch(40.5% .101 131.063); --color-lime-950: oklch(27.4% .072 132.109); --color-green-50: oklch(98.2% .018 155.826); --color-green-100: oklch(96.2% .044 156.743); --color-green-200: oklch(92.5% .084 155.995); --color-green-300: oklch(87.1% .15 154.449); --color-green-400: oklch(79.2% .209 151.711); --color-green-500: oklch(72.3% .219 149.579); --color-green-600: oklch(62.7% .194 149.214); --color-green-700: oklch(52.7% .154 150.069); --color-green-800: oklch(44.8% .119 151.328); --color-green-900: oklch(39.3% .095 152.535); --color-green-950: oklch(26.6% .065 152.934); --color-emerald-50: oklch(97.9% .021 166.113); --color-emerald-100: oklch(95% .052 163.051); --color-emerald-200: oklch(90.5% .093 164.15); --color-emerald-300: oklch(84.5% .143 164.978); --color-emerald-400: oklch(76.5% .177 163.223); --color-emerald-500: oklch(69.6% .17 162.48); --color-emerald-600: oklch(59.6% .145 163.225); --color-emerald-700: oklch(50.8% .118 165.612); --color-emerald-800: oklch(43.2% .095 166.913); --color-emerald-900: oklch(37.8% .077 168.94); --color-emerald-950: oklch(26.2% .051 172.552); --color-teal-50: oklch(98.4% .014 180.72); --color-teal-100: oklch(95.3% .051 180.801); --color-teal-200: oklch(91% .096 180.426); --color-teal-300: oklch(85.5% .138 181.071); --color-teal-400: oklch(77.7% .152 181.912); --color-teal-500: oklch(70.4% .14 182.503); --color-teal-600: oklch(60% .118 184.704); --color-teal-700: oklch(51.1% .096 186.391); --color-teal-800: oklch(43.7% .078 188.216); --color-teal-900: oklch(38.6% .063 188.416); --color-teal-950: oklch(27.7% .046 192.524); --color-cyan-50: oklch(98.4% .019 200.873); --color-cyan-100: oklch(95.6% .045 203.388); --color-cyan-200: oklch(91.7% .08 205.041); --color-cyan-300: oklch(86.5% .127 207.078); --color-cyan-400: oklch(78.9% .154 211.53); --color-cyan-500: oklch(71.5% .143 215.221); --color-cyan-600: oklch(60.9% .126 221.723); --color-cyan-700: oklch(52% .105 223.128); --color-cyan-800: oklch(45% .085 224.283); --color-cyan-900: oklch(39.8% .07 227.392); --color-cyan-950: oklch(30.2% .056 229.695); --color-sky-50: oklch(97.7% .013 236.62); --color-sky-100: oklch(95.1% .026 236.824); --color-sky-200: oklch(90.1% .058 230.902); --color-sky-300: oklch(82.8% .111 230.318); --color-sky-400: oklch(74.6% .16 232.661); --color-sky-500: oklch(68.5% .169 237.323); --color-sky-600: oklch(58.8% .158 241.966); --color-sky-700: oklch(50% .134 242.749); --color-sky-800: oklch(44.3% .11 240.79); --color-sky-900: oklch(39.1% .09 240.876); --color-sky-950: oklch(29.3% .066 243.157); --color-blue-50: oklch(97% .014 254.604); --color-blue-100: oklch(93.2% .032 255.585); --color-blue-200: oklch(88.2% .059 254.128); --color-blue-300: oklch(80.9% .105 251.813); --color-blue-400: oklch(70.7% .165 254.624); --color-blue-500: oklch(62.3% .214 259.815); --color-blue-600: oklch(54.6% .245 262.881); --color-blue-700: oklch(48.8% .243 264.376); --color-blue-800: oklch(42.4% .199 265.638); --color-blue-900: oklch(37.9% .146 265.522); --color-blue-950: oklch(28.2% .091 267.935); --color-indigo-50: oklch(96.2% .018 272.314); --color-indigo-100: oklch(93% .034 272.788); --color-indigo-200: oklch(87% .065 274.039); --color-indigo-300: oklch(78.5% .115 274.713); --color-indigo-400: oklch(67.3% .182 276.935); --color-indigo-500: oklch(58.5% .233 277.117); --color-indigo-600: oklch(51.1% .262 276.966); --color-indigo-700: oklch(45.7% .24 277.023); --color-indigo-800: oklch(39.8% .195 277.366); --color-indigo-900: oklch(35.9% .144 278.697); --color-indigo-950: oklch(25.7% .09 281.288); --color-violet-50: oklch(96.9% .016 293.756); --color-violet-100: oklch(94.3% .029 294.588); --color-violet-200: oklch(89.4% .057 293.283); --color-violet-300: oklch(81.1% .111 293.571); --color-violet-400: oklch(70.2% .183 293.541); --color-violet-500: oklch(60.6% .25 292.717); --color-violet-600: oklch(54.1% .281 293.009); --color-violet-700: oklch(49.1% .27 292.581); --color-violet-800: oklch(43.2% .232 292.759); --color-violet-900: oklch(38% .189 293.745); --color-violet-950: oklch(28.3% .141 291.089); --color-purple-50: oklch(97.7% .014 308.299); --color-purple-100: oklch(94.6% .033 307.174); --color-purple-200: oklch(90.2% .063 306.703); --color-purple-300: oklch(82.7% .119 306.383); --color-purple-400: oklch(71.4% .203 305.504); --color-purple-500: oklch(62.7% .265 303.9); --color-purple-600: oklch(55.8% .288 302.321); --color-purple-700: oklch(49.6% .265 301.924); --color-purple-800: oklch(43.8% .218 303.724); --color-purple-900: oklch(38.1% .176 304.987); --color-purple-950: oklch(29.1% .149 302.717); --color-fuchsia-50: oklch(97.7% .017 320.058); --color-fuchsia-100: oklch(95.2% .037 318.852); --color-fuchsia-200: oklch(90.3% .076 319.62); --color-fuchsia-300: oklch(83.3% .145 321.434); --color-fuchsia-400: oklch(74% .238 322.16); --color-fuchsia-500: oklch(66.7% .295 322.15); --color-fuchsia-600: oklch(59.1% .293 322.896); --color-fuchsia-700: oklch(51.8% .253 323.949); --color-fuchsia-800: oklch(45.2% .211 324.591); --color-fuchsia-900: oklch(40.1% .17 325.612); --color-fuchsia-950: oklch(29.3% .136 325.661); --color-pink-50: oklch(97.1% .014 343.198); --color-pink-100: oklch(94.8% .028 342.258); --color-pink-200: oklch(89.9% .061 343.231); --color-pink-300: oklch(82.3% .12 346.018); --color-pink-400: oklch(71.8% .202 349.761); --color-pink-500: oklch(65.6% .241 354.308); --color-pink-600: oklch(59.2% .249 .584); --color-pink-700: oklch(52.5% .223 3.958); --color-pink-800: oklch(45.9% .187 3.815); --color-pink-900: oklch(40.8% .153 2.432); --color-pink-950: oklch(28.4% .109 3.907); --color-rose-50: oklch(96.9% .015 12.422); --color-rose-100: oklch(94.1% .03 12.58); --color-rose-200: oklch(89.2% .058 10.001); --color-rose-300: oklch(81% .117 11.638); --color-rose-400: oklch(71.2% .194 13.428); --color-rose-500: oklch(64.5% .246 16.439); --color-rose-600: oklch(58.6% .253 17.585); --color-rose-700: oklch(51.4% .222 16.935); --color-rose-800: oklch(45.5% .188 13.697); --color-rose-900: oklch(41% .159 10.272); --color-rose-950: oklch(27.1% .105 12.094); --color-slate-50: oklch(98.4% .003 247.858); --color-slate-100: oklch(96.8% .007 247.896); --color-slate-200: oklch(92.9% .013 255.508); --color-slate-300: oklch(86.9% .022 252.894); --color-slate-400: oklch(70.4% .04 256.788); --color-slate-500: oklch(55.4% .046 257.417); --color-slate-600: oklch(44.6% .043 257.281); --color-slate-700: oklch(37.2% .044 257.287); --color-slate-800: oklch(27.9% .041 260.031); --color-slate-900: oklch(20.8% .042 265.755); --color-slate-950: oklch(12.9% .042 264.695); --color-gray-50: oklch(98.5% .002 247.839); --color-gray-100: oklch(96.7% .003 264.542); --color-gray-200: oklch(92.8% .006 264.531); --color-gray-300: oklch(87.2% .01 258.338); --color-gray-400: oklch(70.7% .022 261.325); --color-gray-500: oklch(55.1% .027 264.364); --color-gray-600: oklch(44.6% .03 256.802); --color-gray-700: oklch(37.3% .034 259.733); --color-gray-800: oklch(27.8% .033 256.848); --color-gray-900: oklch(21% .034 264.665); --color-gray-950: oklch(13% .028 261.692); --color-zinc-50: oklch(98.5% 0 none); --color-zinc-100: oklch(96.7% .001 286.375); --color-zinc-200: oklch(92% .004 286.32); --color-zinc-300: oklch(87.1% .006 286.286); --color-zinc-400: oklch(70.5% .015 286.067); --color-zinc-500: oklch(55.2% .016 285.938); --color-zinc-600: oklch(44.2% .017 285.786); --color-zinc-700: oklch(37% .013 285.805); --color-zinc-800: oklch(27.4% .006 286.033); --color-zinc-900: oklch(21% .006 285.885); --color-zinc-950: oklch(14.1% .005 285.823); --color-neutral-50: oklch(98.5% 0 none); --color-neutral-100: oklch(97% 0 none); --color-neutral-200: oklch(92.2% 0 none); --color-neutral-300: oklch(87% 0 none); --color-neutral-400: oklch(70.8% 0 none); --color-neutral-500: oklch(55.6% 0 none); --color-neutral-600: oklch(43.9% 0 none); --color-neutral-700: oklch(37.1% 0 none); --color-neutral-800: oklch(26.9% 0 none); --color-neutral-900: oklch(20.5% 0 none); --color-neutral-950: oklch(14.5% 0 none); --color-stone-50: oklch(98.5% .001 106.423); --color-stone-100: oklch(97% .001 106.424); --color-stone-200: oklch(92.3% .003 48.717); --color-stone-300: oklch(86.9% .005 56.366); --color-stone-400: oklch(70.9% .01 56.259); --color-stone-500: oklch(55.3% .013 58.071); --color-stone-600: oklch(44.4% .011 73.639); --color-stone-700: oklch(37.4% .01 67.558); --color-stone-800: oklch(26.8% .007 34.298); --color-stone-900: oklch(21.6% .006 56.043); --color-stone-950: oklch(14.7% .004 49.25); --color-mauve-50: oklch(98.5% 0 none); --color-mauve-100: oklch(96% .003 325.6); --color-mauve-200: oklch(92.2% .005 325.62); --color-mauve-300: oklch(86.5% .012 325.68); --color-mauve-400: oklch(71.1% .019 323.02); --color-mauve-500: oklch(54.2% .034 322.5); --color-mauve-600: oklch(43.5% .029 321.78); --color-mauve-700: oklch(36.4% .029 323.89); --color-mauve-800: oklch(26.3% .024 320.12); --color-mauve-900: oklch(21.2% .019 322.12); --color-mauve-950: oklch(14.5% .008 326); --color-olive-50: oklch(98.8% .003 106.5); --color-olive-100: oklch(96.6% .005 106.5); --color-olive-200: oklch(93% .007 106.5); --color-olive-300: oklch(88% .011 106.6); --color-olive-400: oklch(73.7% .021 106.9); --color-olive-500: oklch(58% .031 107.3); --color-olive-600: oklch(46.6% .025 107.3); --color-olive-700: oklch(39.4% .023 107.4); --color-olive-800: oklch(28.6% .016 107.4); --color-olive-900: oklch(22.8% .013 107.4); --color-olive-950: oklch(15.3% .006 107.1); --color-mist-50: oklch(98.7% .002 197.1); --color-mist-100: oklch(96.3% .002 197.1); --color-mist-200: oklch(92.5% .005 214.3); --color-mist-300: oklch(87.2% .007 219.6); --color-mist-400: oklch(72.3% .014 214.4); --color-mist-500: oklch(56% .021 213.5); --color-mist-600: oklch(45% .017 213.2); --color-mist-700: oklch(37.8% .015 216); --color-mist-800: oklch(27.5% .011 216.9); --color-mist-900: oklch(21.8% .008 223.9); --color-mist-950: oklch(14.8% .004 228.8); --color-taupe-50: oklch(98.6% .002 67.8); --color-taupe-100: oklch(96% .002 17.2); --color-taupe-200: oklch(92.2% .005 34.3); --color-taupe-300: oklch(86.8% .007 39.5); --color-taupe-400: oklch(71.4% .014 41.2); --color-taupe-500: oklch(54.7% .021 43.1); --color-taupe-600: oklch(43.8% .017 39.3); --color-taupe-700: oklch(36.7% .016 35.7); --color-taupe-800: oklch(26.8% .011 36.5); --color-taupe-900: oklch(21.4% .009 43.1); --color-taupe-950: oklch(14.7% .004 49.3); --color-black: #000; --color-white: #fff; --spacing: .25rem; --breakpoint-sm: 40rem; --breakpoint-md: 48rem; --breakpoint-lg: 64rem; --breakpoint-xl: 80rem; --breakpoint-2xl: 96rem; --container-3xs: 16rem; --container-2xs: 18rem; --container-xs: 20rem; --container-sm: 24rem; --container-md: 28rem; --container-lg: 32rem; --container-xl: 36rem; --container-2xl: 42rem; --container-3xl: 48rem; --container-4xl: 56rem; --container-5xl: 64rem; --container-6xl: 72rem; --container-7xl: 80rem; --text-xs: .75rem; --text-xs--line-height: calc(1 / .75); --text-sm: .875rem; --text-sm--line-height: calc(1.25 / .875); --text-base: 1rem; --text-base--line-height: 1.5 ; --text-lg: 1.125rem; --text-lg--line-height: calc(1.75 / 1.125); --text-xl: 1.25rem; --text-xl--line-height: calc(1.75 / 1.25); --text-2xl: 1.5rem; --text-2xl--line-height: calc(2 / 1.5); --text-3xl: 1.875rem; --text-3xl--line-height: 1.2 ; --text-4xl: 2.25rem; --text-4xl--line-height: calc(2.5 / 2.25); --text-5xl: 3rem; --text-5xl--line-height: 1; --text-6xl: 3.75rem; --text-6xl--line-height: 1; --text-7xl: 4.5rem; --text-7xl--line-height: 1; --text-8xl: 6rem; --text-8xl--line-height: 1; --text-9xl: 8rem; --text-9xl--line-height: 1; --font-weight-thin: 100; --font-weight-extralight: 200; --font-weight-light: 300; --font-weight-normal: 400; --font-weight-medium: 500; --font-weight-semibold: 600; --font-weight-bold: 700; --font-weight-extrabold: 800; --font-weight-black: 900; --tracking-tighter: -.05em; --tracking-tight: -.025em; --tracking-normal: 0em; --tracking-wide: .025em; --tracking-wider: .05em; --tracking-widest: .1em; --leading-tight: 1.25; --leading-snug: 1.375; --leading-normal: 1.5; --leading-relaxed: 1.625; --leading-loose: 2; --radius-xs: .125rem; --radius-sm: .25rem; --radius-md: .375rem; --radius-lg: .5rem; --radius-xl: .75rem; --radius-2xl: 1rem; --radius-3xl: 1.5rem; --radius-4xl: 2rem; --shadow-2xs: 0 1px rgb(0 0 0 / .05); --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / .05); --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1); --shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1); --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1); --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1); --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / .25); --inset-shadow-2xs: inset 0 1px rgb(0 0 0 / .05); --inset-shadow-xs: inset 0 1px 1px rgb(0 0 0 / .05); --inset-shadow-sm: inset 0 2px 4px rgb(0 0 0 / .05); --drop-shadow-xs: 0 1px 1px rgb(0 0 0 / .05); --drop-shadow-sm: 0 1px 2px rgb(0 0 0 / .15); --drop-shadow-md: 0 3px 3px rgb(0 0 0 / .12); --drop-shadow-lg: 0 4px 4px rgb(0 0 0 / .15); --drop-shadow-xl: 0 9px 7px rgb(0 0 0 / .1); --drop-shadow-2xl: 0 25px 25px rgb(0 0 0 / .15); --text-shadow-2xs: 0px 1px 0px rgb(0 0 0 / .15); --text-shadow-xs: 0px 1px 1px rgb(0 0 0 / .2); --text-shadow-sm: 0px 1px 0px rgb(0 0 0 / .075), 0px 1px 1px rgb(0 0 0 / .075), 0px 2px 2px rgb(0 0 0 / .075); --text-shadow-md: 0px 1px 1px rgb(0 0 0 / .1), 0px 1px 2px rgb(0 0 0 / .1), 0px 2px 4px rgb(0 0 0 / .1); --text-shadow-lg: 0px 1px 2px rgb(0 0 0 / .1), 0px 3px 2px rgb(0 0 0 / .1), 0px 4px 8px rgb(0 0 0 / .1); --ease-in: cubic-bezier(.4, 0, 1, 1); --ease-out: cubic-bezier(0, 0, .2, 1); --ease-in-out: cubic-bezier(.4, 0, .2, 1); --animate-spin: spin 1s linear infinite; --animate-ping: ping 1s cubic-bezier(0, 0, .2, 1) infinite; --animate-pulse: pulse 2s cubic-bezier(.4, 0, .6, 1) infinite; --animate-bounce: bounce 1s infinite; @keyframes spin { to { transform: rotate(360deg); } } @keyframes ping { 75%, 100% { transform: scale(2); opacity: 0; } } @keyframes pulse { 50% { opacity: .5; } } @keyframes bounce { 0%, 100% { transform: translateY(-25%); animation-timing-function: cubic-bezier(.8, 0, 1, 1); } 50% { transform: none; animation-timing-function: cubic-bezier(0, 0, .2, 1); } } --blur-xs: 4px; --blur-sm: 8px; --blur-md: 12px; --blur-lg: 16px; --blur-xl: 24px; --blur-2xl: 40px; --blur-3xl: 64px; --perspective-dramatic: 100px; --perspective-near: 300px; --perspective-normal: 500px; --perspective-midrange: 800px; --perspective-distant: 1200px; --aspect-video: 16 / 9; --default-transition-duration: .15s; --default-transition-timing-function: cubic-bezier(.4, 0, .2, 1); --default-font-family: --theme(--font-sans, initial); --default-font-feature-settings: --theme( --font-sans--font-feature-settings, initial ); --default-font-variation-settings: --theme( --font-sans--font-variation-settings, initial ); --default-mono-font-family: --theme(--font-mono, initial); --default-mono-font-feature-settings: --theme( --font-mono--font-feature-settings, initial ); --default-mono-font-variation-settings: --theme( --font-mono--font-variation-settings, initial ); }@theme default inline reference{ --blur: 8px; --shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1); --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / .05); --drop-shadow: 0 1px 2px rgb(0 0 0 / .1), 0 1px 1px rgb(0 0 0 / .06); --radius: .25rem; --max-width-prose: 65ch; }}@layer base{*,:after,:before,::backdrop,::file-selector-button{box-sizing:border-box;margin:0;padding:0;border:0 solid}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;tab-size:4;font-family:--theme(--default-font-family,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue","Noto Sans",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:--theme(--default-font-feature-settings,normal);font-variation-settings:--theme(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:--theme(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:--theme(--default-mono-font-feature-settings,normal);font-variation-settings:--theme(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea,::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;border-radius:0;background-color:transparent;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit,::-webkit-datetime-edit-year-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]),::file-selector-button{appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer utilities{@tailwind utilities;}
|
package/dist/index.d.mts
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";var C=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var ue=Object.getOwnPropertyNames;var xe=Object.prototype.hasOwnProperty;var ge=(l,i)=>{for(var n in i)C(l,n,{get:i[n],enumerable:!0})},he=(l,i,n,h)=>{if(i&&typeof i=="object"||typeof i=="function")for(let c of ue(i))!xe.call(l,c)&&c!==n&&C(l,c,{get:()=>i[c],enumerable:!(h=pe(i,c))||h.enumerable});return l};var fe=l=>he(C({},"__esModule",{value:!0}),l);var be={};ge(be,{AIMemoryDashboard:()=>F});module.exports=fe(be);var s=require("react"),a=require("lucide-react"),e=require("react/jsx-runtime"),F=()=>{let[l,i]=(0,s.useState)("http://localhost:8000"),[n,h]=(0,s.useState)("alice"),[c,P]=(0,s.useState)("session_001"),[f,b]=(0,s.useState)("offline"),[y,U]=(0,s.useState)("chat"),[p,x]=(0,s.useState)([]),[k,I]=(0,s.useState)(""),[g,T]=(0,s.useState)(!1),_=(0,s.useRef)(null),[z,ye]=(0,s.useState)("-- None --"),[ve,we]=(0,s.useState)(0),[Ne,Se]=(0,s.useState)(0),[J,q]=(0,s.useState)("Awaiting conversation input..."),[v,M]=(0,s.useState)(""),[K,Ce]=(0,s.useState)("fact"),[Q,ke]=(0,s.useState)(.5),[R,B]=(0,s.useState)(""),[O,H]=(0,s.useState)(""),[G,w]=(0,s.useState)("Results will display here..."),[W,Ie]=(0,s.useState)(""),[L,Te]=(0,s.useState)(.3),[V,_e]=(0,s.useState)(!0),[Me,X]=(0,s.useState)([]),[Y,Re]=(0,s.useState)(1e3),[Z,Oe]=(0,s.useState)(200),[j,je]=(0,s.useState)(null),[$e,$]=(0,s.useState)(!1),[ee,Ae]=(0,s.useState)(""),[De,te]=(0,s.useState)([]),[se,Ee]=(0,s.useState)(JSON.stringify([{role:"user",content:"I am working on a new backend service."},{role:"assistant",content:"Great! Which programming language do you plan to use?"}],null,2)),[ae,Fe]=(0,s.useState)("I prefer Python for it."),[Pe,N]=(0,s.useState)("-- Click run to test --"),m=t=>`${l.replace(/\/+$/,"")}${t}`;(0,s.useEffect)(()=>{_.current?.scrollIntoView({behavior:"smooth"})},[p,g]),(0,s.useEffect)(()=>{A()},[l]);let A=async()=>{b("checking");try{(await fetch(m("/contextualize_query"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:"ping",history:[]})})).ok?b("connected"):b("offline")}catch{b("offline")}},oe=async t=>{t.preventDefault();let o=k.trim();if(!o||g)return;let r=[...p,{role:"user",content:o}];x(r),I(""),T(!0),x(d=>[...d,{role:"assistant",content:""}]);try{let d={query:o,history:p,top_k:2,score_threshold:.55,user_id:n,session_id:c},u=await fetch(m("/chat/stream"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)});if(!u.ok)throw new Error("Network response failed");let D=u.body?.getReader(),le=new TextDecoder("utf-8"),E="";if(D)for(;;){let{done:ie,value:ce}=await D.read();if(ie)break;let de=le.decode(ce,{stream:!0});E+=de,x(me=>{let S=[...me];return S[S.length-1]={role:"assistant",content:E},S})}q(`Turn executed for ${n}. Auto-extraction ran asynchronously.`)}catch(d){x(u=>[...u.slice(0,-1),{role:"system",content:`Error: ${d.message||"Failed to fetch response"}`}])}finally{T(!1)}},re=async t=>{if(t.preventDefault(),!!v.trim())try{let r=await(await fetch(m("/store"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:v.trim(),user_id:n,session_id:c,memory_type:K,importance:Q})})).json();alert(`Memory Stored Successfully!
|
|
2
|
+
ID: ${r.memory_id||"OK"}`),M("")}catch(o){alert(`Store failed: ${o.message}`)}},Ue=async t=>{t.preventDefault();try{let r=await(await fetch(m("/search_memory"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:W.trim(),limit:5,score_threshold:L,use_importance_weight:V,user_id:n})})).json();X(r.results||[])}catch(o){alert(`Search error: ${o.message}`)}},ne=async()=>{w("Analyzing conflict...");try{let o=await(await fetch(m("/detect_memory_conflict"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({existing_memory:R,new_memory:O})})).json();w(JSON.stringify(o,null,2))}catch(t){w(`Error: ${t.message}`)}},ze=async t=>{if(t.preventDefault(),!j)return;$(!0);let o=new FormData;o.append("file",j);try{let r=`${m("/add_memory_file_upload")}?chunk_size=${Y}&chunk_overlap=${Z}&user_id=${n}`,u=await(await fetch(r,{method:"POST",body:o})).json();alert(`Document Processing Complete!
|
|
3
|
+
Chunks Stored: ${u.chunks_stored}`)}catch(r){alert(`Upload error: ${r.message}`)}finally{$(!1)}},Je=async t=>{t.preventDefault();try{let r=await(await fetch(m("/search_knowledge"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:ee.trim(),limit:5,user_id:n})})).json();te(r.results||[])}catch(o){alert(`Knowledge Search Error: ${o.message}`)}},qe=async t=>{t.preventDefault(),N("Processing LLM rewrite...");try{let o=JSON.parse(se),d=await(await fetch(m("/contextualize_query"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:ae,history:o})})).json();N(d.contextualized_query||d.original_query)}catch(o){N(`Error: ${o.message}`)}};return(0,e.jsxs)("div",{className:"h-screen flex flex-col font-sans bg-slate-950 text-slate-100 selection:bg-indigo-500 selection:text-white",children:[(0,e.jsx)("header",{className:"bg-slate-900 border-b border-slate-800 px-4 py-3 shrink-0 shadow-md",children:(0,e.jsxs)("div",{className:"max-w-7xl mx-auto flex flex-wrap items-center justify-between gap-4",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsx)("div",{className:"p-2 bg-indigo-600/20 text-indigo-400 rounded-lg border border-indigo-500/30",children:(0,e.jsx)(a.BrainCircuit,{className:"w-6 h-6"})}),(0,e.jsxs)("div",{children:[(0,e.jsxs)("h1",{className:"text-base font-bold text-white tracking-wide flex items-center gap-2",children:["AI Memory + RAG Dashboard",(0,e.jsx)("span",{className:"text-xs font-normal px-2 py-0.5 rounded-full bg-emerald-500/10 text-emerald-400 border border-emerald-500/20",children:"React Native UI"})]}),(0,e.jsx)("p",{className:"text-xs text-slate-400",children:"Interactive System Testbench & Context Inspector"})]})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-3 text-xs",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 bg-slate-950 px-3 py-1.5 rounded-lg border border-slate-800",children:[(0,e.jsx)(a.Server,{className:"w-3.5 h-3.5 text-slate-400"}),(0,e.jsx)("span",{className:"text-slate-400",children:"API:"}),(0,e.jsx)("input",{type:"text",value:l,onChange:t=>i(t.target.value),className:"bg-transparent border-none text-slate-200 focus:outline-none w-44 font-mono text-xs"})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2 bg-slate-950 px-3 py-1.5 rounded-lg border border-slate-800",children:[(0,e.jsx)(a.User,{className:"w-3.5 h-3.5 text-slate-400"}),(0,e.jsx)("span",{className:"text-slate-400",children:"User:"}),(0,e.jsx)("input",{type:"text",value:n,onChange:t=>h(t.target.value),className:"bg-transparent border-none text-slate-200 focus:outline-none w-20 font-mono text-xs"})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2 bg-slate-950 px-3 py-1.5 rounded-lg border border-slate-800",children:[(0,e.jsx)(a.Hash,{className:"w-3.5 h-3.5 text-slate-400"}),(0,e.jsx)("span",{className:"text-slate-400",children:"Session:"}),(0,e.jsx)("input",{type:"text",value:c,onChange:t=>P(t.target.value),className:"bg-transparent border-none text-slate-200 focus:outline-none w-24 font-mono text-xs"})]}),(0,e.jsxs)("button",{onClick:A,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-200 transition-colors border border-slate-700",children:[(0,e.jsx)("span",{className:`w-2 h-2 rounded-full ${f==="connected"?"bg-emerald-500":f==="checking"?"bg-amber-400 animate-pulse":"bg-rose-500"}`}),(0,e.jsx)("span",{children:f==="connected"?"Connected":f==="checking"?"Checking...":"Offline"})]})]})]})}),(0,e.jsx)("nav",{className:"bg-slate-900/60 border-b border-slate-800 px-4 shrink-0",children:(0,e.jsx)("div",{className:"max-w-7xl mx-auto flex space-x-2 overflow-x-auto text-sm",children:[{id:"chat",label:"Chat & RAG Assistant",icon:a.MessageSquare},{id:"memory",label:"Memory Management",icon:a.Database},{id:"knowledge",label:"Knowledge Base",icon:a.FileText},{id:"contextualize",label:"Query Contextualizer",icon:a.Wand2}].map(t=>{let o=t.icon,r=y===t.id;return(0,e.jsxs)("button",{onClick:()=>U(t.id),className:`flex items-center gap-2 py-3 px-4 font-medium border-b-2 transition-colors ${r?"border-indigo-500 text-indigo-400":"border-transparent text-slate-400 hover:text-slate-200"}`,children:[(0,e.jsx)(o,{className:"w-4 h-4"}),t.label]},t.id)})})}),(0,e.jsxs)("main",{className:"flex-1 overflow-hidden relative max-w-7xl w-full mx-auto p-4",children:[y==="chat"&&(0,e.jsxs)("div",{className:"h-full flex flex-col md:flex-row gap-4",children:[(0,e.jsxs)("div",{className:"flex-1 bg-slate-900 border border-slate-800 rounded-xl flex flex-col overflow-hidden shadow-lg",children:[(0,e.jsxs)("div",{className:"p-3 bg-slate-900/80 border-b border-slate-800 flex items-center justify-between",children:[(0,e.jsxs)("span",{className:"text-xs font-semibold text-slate-300 flex items-center gap-2",children:[(0,e.jsx)(a.Bot,{className:"w-4 h-4 text-indigo-400"})," Active SSE Stream"]}),(0,e.jsxs)("button",{onClick:()=>x([]),className:"text-xs text-slate-400 hover:text-rose-400 flex items-center gap-1 transition-colors",children:[(0,e.jsx)(a.Trash2,{className:"w-3.5 h-3.5"})," Clear Stream"]})]}),(0,e.jsxs)("div",{className:"flex-1 p-4 overflow-y-auto space-y-4 text-sm",children:[p.length===0?(0,e.jsx)("div",{className:"text-center text-slate-500 text-xs py-8",children:"Start chatting to test real-time SSE streaming and background memory consolidation!"}):p.map((t,o)=>(0,e.jsxs)("div",{className:`flex ${t.role==="user"?"justify-end":t.role==="assistant"?"justify-start gap-2.5":"justify-center"}`,children:[t.role==="assistant"&&(0,e.jsx)("div",{className:"w-6 h-6 rounded-lg bg-indigo-500/20 border border-indigo-500/30 flex items-center justify-center text-indigo-400 shrink-0 mt-0.5",children:(0,e.jsx)(a.Bot,{className:"w-3.5 h-3.5"})}),(0,e.jsxs)("div",{className:`max-w-[80%] px-3.5 py-2 rounded-xl text-xs font-sans whitespace-pre-wrap break-words ${t.role==="user"?"bg-indigo-600 text-white rounded-tr-none":t.role==="assistant"?"bg-slate-800 border border-slate-700/60 text-slate-100 rounded-tl-none":"bg-rose-500/10 border border-rose-500/20 text-rose-400 font-mono"}`,children:[t.content.trim(),g&&o===p.length-1&&t.role==="assistant"&&(0,e.jsx)("span",{className:"inline-block w-1.5 h-3.5 bg-indigo-400 ml-1 animate-pulse align-middle"})]})]},o)),(0,e.jsx)("div",{ref:_})]}),(0,e.jsxs)("form",{onSubmit:oe,className:"p-3 bg-slate-950 border-t border-slate-800 flex items-center gap-2",children:[(0,e.jsx)("input",{type:"text",value:k,onChange:t=>I(t.target.value),placeholder:"Type a message...",disabled:g,className:"flex-1 bg-slate-900 border border-slate-800 rounded-lg px-3 py-2 text-xs text-slate-100 placeholder-slate-500 focus:outline-none focus:border-indigo-500"}),(0,e.jsxs)("button",{type:"submit",disabled:g,className:"bg-indigo-600 hover:bg-indigo-500 disabled:bg-slate-800 text-white px-4 py-2 rounded-lg text-xs font-medium flex items-center gap-1 transition-colors",children:[(0,e.jsx)("span",{children:"Send"}),(0,e.jsx)(a.Send,{className:"w-3.5 h-3.5"})]})]})]}),(0,e.jsxs)("div",{className:"w-full md:w-96 bg-slate-900 border border-slate-800 rounded-xl flex flex-col overflow-hidden shadow-lg shrink-0",children:[(0,e.jsx)("div",{className:"p-3 bg-slate-900/80 border-b border-slate-800 flex items-center justify-between",children:(0,e.jsxs)("span",{className:"text-xs font-semibold text-slate-300 flex items-center gap-1.5",children:[(0,e.jsx)(a.Eye,{className:"w-4 h-4 text-amber-400"})," Context Inspector"]})}),(0,e.jsxs)("div",{className:"p-3 space-y-3 text-xs overflow-y-auto",children:[(0,e.jsxs)("div",{className:"bg-slate-950 p-2.5 rounded-lg border border-slate-800",children:[(0,e.jsx)("span",{className:"text-[10px] uppercase font-bold text-slate-400 block mb-1",children:"Contextualized Query"}),(0,e.jsx)("p",{className:"font-mono text-indigo-300",children:z})]}),(0,e.jsxs)("div",{className:"bg-slate-950 p-2.5 rounded-lg border border-slate-800",children:[(0,e.jsx)("span",{className:"text-[10px] uppercase font-bold text-slate-400 block mb-1",children:"Background Memory Task"}),(0,e.jsx)("p",{className:"font-mono text-slate-400 text-[11px]",children:J})]})]})]})]}),y==="memory"&&(0,e.jsx)("div",{className:"h-full overflow-y-auto space-y-4 pr-1",children:(0,e.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,e.jsxs)("div",{className:"bg-slate-900 p-4 rounded-xl border border-slate-800",children:[(0,e.jsxs)("h2",{className:"text-xs font-bold uppercase tracking-wider text-slate-300 mb-3 flex items-center gap-2",children:[(0,e.jsx)(a.PlusCircle,{className:"w-4 h-4 text-indigo-400"})," Store Memory"]}),(0,e.jsxs)("form",{onSubmit:re,className:"space-y-3",children:[(0,e.jsx)("textarea",{value:v,onChange:t=>M(t.target.value),placeholder:"e.g., I prefer using FastAPI over Flask.",required:!0,rows:2,className:"w-full bg-slate-950 border border-slate-800 rounded-lg p-2 text-xs text-slate-200 focus:outline-none focus:border-indigo-500 font-mono"}),(0,e.jsxs)("button",{type:"submit",className:"w-full bg-indigo-600 hover:bg-indigo-500 text-white py-2 rounded-lg text-xs font-medium transition-colors flex items-center justify-center gap-1",children:[(0,e.jsx)(a.Save,{className:"w-3.5 h-3.5"})," Store Memory"]})]})]}),(0,e.jsxs)("div",{className:"bg-slate-900 p-4 rounded-xl border border-slate-800",children:[(0,e.jsxs)("h2",{className:"text-xs font-bold uppercase tracking-wider text-slate-300 mb-3 flex items-center gap-2",children:[(0,e.jsx)(a.GitCompare,{className:"w-4 h-4 text-amber-400"})," Conflict Detection"]}),(0,e.jsxs)("div",{className:"space-y-2 text-xs",children:[(0,e.jsx)("input",{type:"text",value:R,onChange:t=>B(t.target.value),placeholder:"Existing memory",className:"w-full bg-slate-950 border border-slate-800 rounded-lg p-2 text-xs text-slate-200 font-mono"}),(0,e.jsx)("input",{type:"text",value:O,onChange:t=>H(t.target.value),placeholder:"New candidate memory",className:"w-full bg-slate-950 border border-slate-800 rounded-lg p-2 text-xs text-slate-200 font-mono"}),(0,e.jsx)("button",{onClick:ne,className:"w-full bg-slate-800 hover:bg-slate-700 text-slate-200 py-1.5 rounded-lg border border-slate-700 text-xs",children:"Test Conflict"}),(0,e.jsx)("pre",{className:"p-2 rounded bg-slate-950 border border-slate-800 text-[11px] text-slate-400 font-mono overflow-x-auto",children:G})]})]})]})})]})]})};0&&(module.exports={AIMemoryDashboard});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{useState as a,useEffect as A,useRef as pe}from"react";import{BrainCircuit as ue,Server as xe,User as ge,Hash as he,MessageSquare as fe,Database as be,FileText as ye,Wand2 as ve,Bot as D,Trash2 as we,Send as Ne,Eye as Se,PlusCircle as Ce,Save as ke,GitCompare as Ie}from"lucide-react";import{jsx as t,jsxs as s}from"react/jsx-runtime";var Te=()=>{let[g,E]=a("http://localhost:8000"),[i,F]=a("alice"),[h,P]=a("session_001"),[u,x]=a("offline"),[f,U]=a("chat"),[c,m]=a([]),[N,S]=a(""),[p,C]=a(!1),k=pe(null),[z,_e]=a("-- None --"),[Me,Re]=a(0),[Oe,je]=a(0),[J,q]=a("Awaiting conversation input..."),[b,I]=a(""),[K,$e]=a("fact"),[Q,Ae]=a(.5),[T,B]=a(""),[_,H]=a(""),[G,y]=a("Results will display here..."),[W,De]=a(""),[L,Ee]=a(.3),[V,Fe]=a(!0),[Pe,X]=a([]),[Y,Ue]=a(1e3),[Z,ze]=a(200),[M,Je]=a(null),[qe,R]=a(!1),[ee,Ke]=a(""),[Qe,te]=a([]),[se,Be]=a(JSON.stringify([{role:"user",content:"I am working on a new backend service."},{role:"assistant",content:"Great! Which programming language do you plan to use?"}],null,2)),[ae,He]=a("I prefer Python for it."),[Ge,v]=a("-- Click run to test --"),l=e=>`${g.replace(/\/+$/,"")}${e}`;A(()=>{k.current?.scrollIntoView({behavior:"smooth"})},[c,p]),A(()=>{O()},[g]);let O=async()=>{x("checking");try{(await fetch(l("/contextualize_query"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:"ping",history:[]})})).ok?x("connected"):x("offline")}catch{x("offline")}},oe=async e=>{e.preventDefault();let o=N.trim();if(!o||p)return;let r=[...c,{role:"user",content:o}];m(r),S(""),C(!0),m(n=>[...n,{role:"assistant",content:""}]);try{let n={query:o,history:c,top_k:2,score_threshold:.55,user_id:i,session_id:h},d=await fetch(l("/chat/stream"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!d.ok)throw new Error("Network response failed");let j=d.body?.getReader(),le=new TextDecoder("utf-8"),$="";if(j)for(;;){let{done:ie,value:ce}=await j.read();if(ie)break;let de=le.decode(ce,{stream:!0});$+=de,m(me=>{let w=[...me];return w[w.length-1]={role:"assistant",content:$},w})}q(`Turn executed for ${i}. Auto-extraction ran asynchronously.`)}catch(n){m(d=>[...d.slice(0,-1),{role:"system",content:`Error: ${n.message||"Failed to fetch response"}`}])}finally{C(!1)}},re=async e=>{if(e.preventDefault(),!!b.trim())try{let r=await(await fetch(l("/store"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:b.trim(),user_id:i,session_id:h,memory_type:K,importance:Q})})).json();alert(`Memory Stored Successfully!
|
|
2
|
+
ID: ${r.memory_id||"OK"}`),I("")}catch(o){alert(`Store failed: ${o.message}`)}},We=async e=>{e.preventDefault();try{let r=await(await fetch(l("/search_memory"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:W.trim(),limit:5,score_threshold:L,use_importance_weight:V,user_id:i})})).json();X(r.results||[])}catch(o){alert(`Search error: ${o.message}`)}},ne=async()=>{y("Analyzing conflict...");try{let o=await(await fetch(l("/detect_memory_conflict"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({existing_memory:T,new_memory:_})})).json();y(JSON.stringify(o,null,2))}catch(e){y(`Error: ${e.message}`)}},Le=async e=>{if(e.preventDefault(),!M)return;R(!0);let o=new FormData;o.append("file",M);try{let r=`${l("/add_memory_file_upload")}?chunk_size=${Y}&chunk_overlap=${Z}&user_id=${i}`,d=await(await fetch(r,{method:"POST",body:o})).json();alert(`Document Processing Complete!
|
|
3
|
+
Chunks Stored: ${d.chunks_stored}`)}catch(r){alert(`Upload error: ${r.message}`)}finally{R(!1)}},Ve=async e=>{e.preventDefault();try{let r=await(await fetch(l("/search_knowledge"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:ee.trim(),limit:5,user_id:i})})).json();te(r.results||[])}catch(o){alert(`Knowledge Search Error: ${o.message}`)}},Xe=async e=>{e.preventDefault(),v("Processing LLM rewrite...");try{let o=JSON.parse(se),n=await(await fetch(l("/contextualize_query"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:ae,history:o})})).json();v(n.contextualized_query||n.original_query)}catch(o){v(`Error: ${o.message}`)}};return s("div",{className:"h-screen flex flex-col font-sans bg-slate-950 text-slate-100 selection:bg-indigo-500 selection:text-white",children:[t("header",{className:"bg-slate-900 border-b border-slate-800 px-4 py-3 shrink-0 shadow-md",children:s("div",{className:"max-w-7xl mx-auto flex flex-wrap items-center justify-between gap-4",children:[s("div",{className:"flex items-center gap-3",children:[t("div",{className:"p-2 bg-indigo-600/20 text-indigo-400 rounded-lg border border-indigo-500/30",children:t(ue,{className:"w-6 h-6"})}),s("div",{children:[s("h1",{className:"text-base font-bold text-white tracking-wide flex items-center gap-2",children:["AI Memory + RAG Dashboard",t("span",{className:"text-xs font-normal px-2 py-0.5 rounded-full bg-emerald-500/10 text-emerald-400 border border-emerald-500/20",children:"React Native UI"})]}),t("p",{className:"text-xs text-slate-400",children:"Interactive System Testbench & Context Inspector"})]})]}),s("div",{className:"flex flex-wrap items-center gap-3 text-xs",children:[s("div",{className:"flex items-center gap-2 bg-slate-950 px-3 py-1.5 rounded-lg border border-slate-800",children:[t(xe,{className:"w-3.5 h-3.5 text-slate-400"}),t("span",{className:"text-slate-400",children:"API:"}),t("input",{type:"text",value:g,onChange:e=>E(e.target.value),className:"bg-transparent border-none text-slate-200 focus:outline-none w-44 font-mono text-xs"})]}),s("div",{className:"flex items-center gap-2 bg-slate-950 px-3 py-1.5 rounded-lg border border-slate-800",children:[t(ge,{className:"w-3.5 h-3.5 text-slate-400"}),t("span",{className:"text-slate-400",children:"User:"}),t("input",{type:"text",value:i,onChange:e=>F(e.target.value),className:"bg-transparent border-none text-slate-200 focus:outline-none w-20 font-mono text-xs"})]}),s("div",{className:"flex items-center gap-2 bg-slate-950 px-3 py-1.5 rounded-lg border border-slate-800",children:[t(he,{className:"w-3.5 h-3.5 text-slate-400"}),t("span",{className:"text-slate-400",children:"Session:"}),t("input",{type:"text",value:h,onChange:e=>P(e.target.value),className:"bg-transparent border-none text-slate-200 focus:outline-none w-24 font-mono text-xs"})]}),s("button",{onClick:O,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-200 transition-colors border border-slate-700",children:[t("span",{className:`w-2 h-2 rounded-full ${u==="connected"?"bg-emerald-500":u==="checking"?"bg-amber-400 animate-pulse":"bg-rose-500"}`}),t("span",{children:u==="connected"?"Connected":u==="checking"?"Checking...":"Offline"})]})]})]})}),t("nav",{className:"bg-slate-900/60 border-b border-slate-800 px-4 shrink-0",children:t("div",{className:"max-w-7xl mx-auto flex space-x-2 overflow-x-auto text-sm",children:[{id:"chat",label:"Chat & RAG Assistant",icon:fe},{id:"memory",label:"Memory Management",icon:be},{id:"knowledge",label:"Knowledge Base",icon:ye},{id:"contextualize",label:"Query Contextualizer",icon:ve}].map(e=>{let o=e.icon,r=f===e.id;return s("button",{onClick:()=>U(e.id),className:`flex items-center gap-2 py-3 px-4 font-medium border-b-2 transition-colors ${r?"border-indigo-500 text-indigo-400":"border-transparent text-slate-400 hover:text-slate-200"}`,children:[t(o,{className:"w-4 h-4"}),e.label]},e.id)})})}),s("main",{className:"flex-1 overflow-hidden relative max-w-7xl w-full mx-auto p-4",children:[f==="chat"&&s("div",{className:"h-full flex flex-col md:flex-row gap-4",children:[s("div",{className:"flex-1 bg-slate-900 border border-slate-800 rounded-xl flex flex-col overflow-hidden shadow-lg",children:[s("div",{className:"p-3 bg-slate-900/80 border-b border-slate-800 flex items-center justify-between",children:[s("span",{className:"text-xs font-semibold text-slate-300 flex items-center gap-2",children:[t(D,{className:"w-4 h-4 text-indigo-400"})," Active SSE Stream"]}),s("button",{onClick:()=>m([]),className:"text-xs text-slate-400 hover:text-rose-400 flex items-center gap-1 transition-colors",children:[t(we,{className:"w-3.5 h-3.5"})," Clear Stream"]})]}),s("div",{className:"flex-1 p-4 overflow-y-auto space-y-4 text-sm",children:[c.length===0?t("div",{className:"text-center text-slate-500 text-xs py-8",children:"Start chatting to test real-time SSE streaming and background memory consolidation!"}):c.map((e,o)=>s("div",{className:`flex ${e.role==="user"?"justify-end":e.role==="assistant"?"justify-start gap-2.5":"justify-center"}`,children:[e.role==="assistant"&&t("div",{className:"w-6 h-6 rounded-lg bg-indigo-500/20 border border-indigo-500/30 flex items-center justify-center text-indigo-400 shrink-0 mt-0.5",children:t(D,{className:"w-3.5 h-3.5"})}),s("div",{className:`max-w-[80%] px-3.5 py-2 rounded-xl text-xs font-sans whitespace-pre-wrap break-words ${e.role==="user"?"bg-indigo-600 text-white rounded-tr-none":e.role==="assistant"?"bg-slate-800 border border-slate-700/60 text-slate-100 rounded-tl-none":"bg-rose-500/10 border border-rose-500/20 text-rose-400 font-mono"}`,children:[e.content.trim(),p&&o===c.length-1&&e.role==="assistant"&&t("span",{className:"inline-block w-1.5 h-3.5 bg-indigo-400 ml-1 animate-pulse align-middle"})]})]},o)),t("div",{ref:k})]}),s("form",{onSubmit:oe,className:"p-3 bg-slate-950 border-t border-slate-800 flex items-center gap-2",children:[t("input",{type:"text",value:N,onChange:e=>S(e.target.value),placeholder:"Type a message...",disabled:p,className:"flex-1 bg-slate-900 border border-slate-800 rounded-lg px-3 py-2 text-xs text-slate-100 placeholder-slate-500 focus:outline-none focus:border-indigo-500"}),s("button",{type:"submit",disabled:p,className:"bg-indigo-600 hover:bg-indigo-500 disabled:bg-slate-800 text-white px-4 py-2 rounded-lg text-xs font-medium flex items-center gap-1 transition-colors",children:[t("span",{children:"Send"}),t(Ne,{className:"w-3.5 h-3.5"})]})]})]}),s("div",{className:"w-full md:w-96 bg-slate-900 border border-slate-800 rounded-xl flex flex-col overflow-hidden shadow-lg shrink-0",children:[t("div",{className:"p-3 bg-slate-900/80 border-b border-slate-800 flex items-center justify-between",children:s("span",{className:"text-xs font-semibold text-slate-300 flex items-center gap-1.5",children:[t(Se,{className:"w-4 h-4 text-amber-400"})," Context Inspector"]})}),s("div",{className:"p-3 space-y-3 text-xs overflow-y-auto",children:[s("div",{className:"bg-slate-950 p-2.5 rounded-lg border border-slate-800",children:[t("span",{className:"text-[10px] uppercase font-bold text-slate-400 block mb-1",children:"Contextualized Query"}),t("p",{className:"font-mono text-indigo-300",children:z})]}),s("div",{className:"bg-slate-950 p-2.5 rounded-lg border border-slate-800",children:[t("span",{className:"text-[10px] uppercase font-bold text-slate-400 block mb-1",children:"Background Memory Task"}),t("p",{className:"font-mono text-slate-400 text-[11px]",children:J})]})]})]})]}),f==="memory"&&t("div",{className:"h-full overflow-y-auto space-y-4 pr-1",children:s("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s("div",{className:"bg-slate-900 p-4 rounded-xl border border-slate-800",children:[s("h2",{className:"text-xs font-bold uppercase tracking-wider text-slate-300 mb-3 flex items-center gap-2",children:[t(Ce,{className:"w-4 h-4 text-indigo-400"})," Store Memory"]}),s("form",{onSubmit:re,className:"space-y-3",children:[t("textarea",{value:b,onChange:e=>I(e.target.value),placeholder:"e.g., I prefer using FastAPI over Flask.",required:!0,rows:2,className:"w-full bg-slate-950 border border-slate-800 rounded-lg p-2 text-xs text-slate-200 focus:outline-none focus:border-indigo-500 font-mono"}),s("button",{type:"submit",className:"w-full bg-indigo-600 hover:bg-indigo-500 text-white py-2 rounded-lg text-xs font-medium transition-colors flex items-center justify-center gap-1",children:[t(ke,{className:"w-3.5 h-3.5"})," Store Memory"]})]})]}),s("div",{className:"bg-slate-900 p-4 rounded-xl border border-slate-800",children:[s("h2",{className:"text-xs font-bold uppercase tracking-wider text-slate-300 mb-3 flex items-center gap-2",children:[t(Ie,{className:"w-4 h-4 text-amber-400"})," Conflict Detection"]}),s("div",{className:"space-y-2 text-xs",children:[t("input",{type:"text",value:T,onChange:e=>B(e.target.value),placeholder:"Existing memory",className:"w-full bg-slate-950 border border-slate-800 rounded-lg p-2 text-xs text-slate-200 font-mono"}),t("input",{type:"text",value:_,onChange:e=>H(e.target.value),placeholder:"New candidate memory",className:"w-full bg-slate-950 border border-slate-800 rounded-lg p-2 text-xs text-slate-200 font-mono"}),t("button",{onClick:ne,className:"w-full bg-slate-800 hover:bg-slate-700 text-slate-200 py-1.5 rounded-lg border border-slate-700 text-xs",children:"Test Conflict"}),t("pre",{className:"p-2 rounded bg-slate-950 border border-slate-800 text-[11px] text-slate-400 font-mono overflow-x-auto",children:G})]})]})]})})]})]})};export{Te as AIMemoryDashboard};
|
package/package.json
CHANGED
|
@@ -1,6 +1,52 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-memory-rag-dashboard",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Interactive Dashboard and Testbench component for Local Multi-Tenant RAG & Memory systems",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.mjs",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
12
|
+
"require": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsup",
|
|
20
|
+
"prepublishOnly": "npm run build"
|
|
21
|
+
},
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
24
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@esbuild/win32-x64": "^0.28.2",
|
|
28
|
+
"@tailwindcss/postcss": "^4.3.3",
|
|
29
|
+
"@types/react": "^18.0.0",
|
|
30
|
+
"@types/react-dom": "^18.0.0",
|
|
31
|
+
"autoprefixer": "^10.6.1",
|
|
32
|
+
"esbuild-postcss": "^0.0.4",
|
|
33
|
+
"postcss": "^8.5.31",
|
|
34
|
+
"tailwindcss": "^4.0.0",
|
|
35
|
+
"tsup": "^8.0.0",
|
|
36
|
+
"typescript": "^5.0.0"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"lucide-react": "^0.400.0"
|
|
40
|
+
},
|
|
41
|
+
"keywords": [
|
|
42
|
+
"react",
|
|
43
|
+
"rag",
|
|
44
|
+
"ai-memory",
|
|
45
|
+
"fastapi",
|
|
46
|
+
"qdrant",
|
|
47
|
+
"ollama",
|
|
48
|
+
"dashboard"
|
|
49
|
+
],
|
|
50
|
+
"author": "",
|
|
51
|
+
"license": "MIT"
|
|
52
|
+
}
|