Spaces:
Running
Running
Commit ·
963fa66
1
Parent(s): 0d0fa3f
my local frontend changes
Browse files
RAG_FULL_APPLICATION_FRONTEND/src/App.jsx
CHANGED
|
@@ -24,7 +24,8 @@ function App() {
|
|
| 24 |
sources, setSources,
|
| 25 |
steps, addStep, clearSteps,
|
| 26 |
setQuerying, isQuerying,
|
| 27 |
-
activeJob, setActiveJob
|
|
|
|
| 28 |
} = usePipelineStore();
|
| 29 |
|
| 30 |
const ws = useRef(null);
|
|
@@ -103,6 +104,15 @@ function App() {
|
|
| 103 |
setAnswer(data.answer);
|
| 104 |
setSources(data.sources);
|
| 105 |
setActiveJob(data.job_id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
} catch (error) {
|
| 107 |
console.error('Search failed', error);
|
| 108 |
addStep({ step: 'ERROR', detail: error?.response?.data?.detail || 'Search failed. Please try again.', color: '#EF4444' });
|
|
@@ -267,8 +277,34 @@ function App() {
|
|
| 267 |
</div>
|
| 268 |
|
| 269 |
{showHistory && (
|
| 270 |
-
<motion.div initial={{ opacity: 0, height: 0 }} animate={{ opacity: 1, height: 'auto' }} className="bg-surface-900 rounded-xl p-4 border border-surface-700
|
| 271 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 272 |
</motion.div>
|
| 273 |
)}
|
| 274 |
|
|
|
|
| 24 |
sources, setSources,
|
| 25 |
steps, addStep, clearSteps,
|
| 26 |
setQuerying, isQuerying,
|
| 27 |
+
activeJob, setActiveJob,
|
| 28 |
+
history, addHistory, clearHistory
|
| 29 |
} = usePipelineStore();
|
| 30 |
|
| 31 |
const ws = useRef(null);
|
|
|
|
| 104 |
setAnswer(data.answer);
|
| 105 |
setSources(data.sources);
|
| 106 |
setActiveJob(data.job_id);
|
| 107 |
+
|
| 108 |
+
addHistory({
|
| 109 |
+
id: Date.now(),
|
| 110 |
+
query: query,
|
| 111 |
+
answer: data.answer,
|
| 112 |
+
technique: technique,
|
| 113 |
+
document: selectedDoc.filename,
|
| 114 |
+
timestamp: new Date().toLocaleTimeString()
|
| 115 |
+
});
|
| 116 |
} catch (error) {
|
| 117 |
console.error('Search failed', error);
|
| 118 |
addStep({ step: 'ERROR', detail: error?.response?.data?.detail || 'Search failed. Please try again.', color: '#EF4444' });
|
|
|
|
| 277 |
</div>
|
| 278 |
|
| 279 |
{showHistory && (
|
| 280 |
+
<motion.div initial={{ opacity: 0, height: 0 }} animate={{ opacity: 1, height: 'auto' }} className="bg-surface-900 rounded-xl p-4 border border-surface-700 space-y-4">
|
| 281 |
+
<div className="flex justify-between items-center border-b border-surface-800 pb-2">
|
| 282 |
+
<h3 className="text-xs font-bold text-gray-400 uppercase tracking-widest">Session History</h3>
|
| 283 |
+
<button onClick={clearHistory} className="text-xs text-red-500 hover:text-red-400 flex items-center gap-1 font-bold">
|
| 284 |
+
<Trash2 className="w-3 h-3" /> Clear
|
| 285 |
+
</button>
|
| 286 |
+
</div>
|
| 287 |
+
{history.length === 0 ? (
|
| 288 |
+
<div className="text-sm text-gray-500 text-center font-mono py-4">
|
| 289 |
+
[ EMPTY HISTORY ] No previous queries found this session.
|
| 290 |
+
</div>
|
| 291 |
+
) : (
|
| 292 |
+
<div className="space-y-3 max-h-[300px] overflow-y-auto custom-scrollbar pr-2">
|
| 293 |
+
{history.map((item) => (
|
| 294 |
+
<div key={item.id} className="bg-surface-800 rounded-lg p-3 border border-surface-700 text-left">
|
| 295 |
+
<div className="flex justify-between items-start mb-2">
|
| 296 |
+
<span className="text-sm font-bold text-primary-400 line-clamp-1">{item.query}</span>
|
| 297 |
+
<span className="text-[10px] text-gray-500 font-mono shrink-0 ml-2">{item.timestamp}</span>
|
| 298 |
+
</div>
|
| 299 |
+
<div className="text-xs text-gray-300 line-clamp-2">{item.answer}</div>
|
| 300 |
+
<div className="flex gap-2 mt-3">
|
| 301 |
+
<span className="text-[9px] font-bold font-mono opacity-70 bg-surface-700 px-1.5 py-0.5 rounded uppercase text-accent-400">{item.technique}</span>
|
| 302 |
+
<span className="text-[9px] font-bold font-mono opacity-70 bg-surface-700 px-1.5 py-0.5 rounded truncate max-w-[150px]">{item.document}</span>
|
| 303 |
+
</div>
|
| 304 |
+
</div>
|
| 305 |
+
))}
|
| 306 |
+
</div>
|
| 307 |
+
)}
|
| 308 |
</motion.div>
|
| 309 |
)}
|
| 310 |
|
RAG_FULL_APPLICATION_FRONTEND/src/store/pipelineStore.js
CHANGED
|
@@ -9,6 +9,7 @@ export const usePipelineStore = create((set) => ({
|
|
| 9 |
isQuerying: false,
|
| 10 |
isIngesting: false,
|
| 11 |
activeJob: null,
|
|
|
|
| 12 |
|
| 13 |
setDocuments: (documents) => set({ documents }),
|
| 14 |
setSelectedDoc: (selectedDoc) => set({ selectedDoc }),
|
|
@@ -19,4 +20,6 @@ export const usePipelineStore = create((set) => ({
|
|
| 19 |
setQuerying: (isQuerying) => set({ isQuerying }),
|
| 20 |
setIngesting: (isIngesting) => set({ isIngesting }),
|
| 21 |
setActiveJob: (activeJob) => set({ activeJob }),
|
|
|
|
|
|
|
| 22 |
}));
|
|
|
|
| 9 |
isQuerying: false,
|
| 10 |
isIngesting: false,
|
| 11 |
activeJob: null,
|
| 12 |
+
history: [],
|
| 13 |
|
| 14 |
setDocuments: (documents) => set({ documents }),
|
| 15 |
setSelectedDoc: (selectedDoc) => set({ selectedDoc }),
|
|
|
|
| 20 |
setQuerying: (isQuerying) => set({ isQuerying }),
|
| 21 |
setIngesting: (isIngesting) => set({ isIngesting }),
|
| 22 |
setActiveJob: (activeJob) => set({ activeJob }),
|
| 23 |
+
addHistory: (item) => set((state) => ({ history: [item, ...state.history] })),
|
| 24 |
+
clearHistory: () => set({ history: [] }),
|
| 25 |
}));
|
RAG_Pipeline_Full_Documentation.docx
ADDED
|
Binary file (42.7 kB). View file
|
|
|