From d206d537a00f914374660ecbf9ef10cab9fc1cbc Mon Sep 17 00:00:00 2001 From: William Guss Date: Fri, 9 Aug 2024 13:55:29 -0700 Subject: [PATCH] fake search interface --- ell-studio/src/pages/Invocations.js | 80 +++++++++++++++++++++-------- 1 file changed, 59 insertions(+), 21 deletions(-) diff --git a/ell-studio/src/pages/Invocations.js b/ell-studio/src/pages/Invocations.js index 95370362..54fba45c 100644 --- a/ell-studio/src/pages/Invocations.js +++ b/ell-studio/src/pages/Invocations.js @@ -1,5 +1,5 @@ import React, { useState, useEffect, useMemo } from 'react'; -import { FiCopy, FiZap, FiEdit2, FiFilter, FiClock, FiColumns, FiPause, FiPlay } from 'react-icons/fi'; +import { FiCopy, FiZap, FiEdit2, FiFilter, FiClock, FiColumns, FiPause, FiPlay, FiSearch } from 'react-icons/fi'; import InvocationsTable from '../components/invocations/InvocationsTable'; import InvocationsLayout from '../components/invocations/InvocationsLayout'; import MetricChart from '../components/MetricChart'; @@ -19,6 +19,9 @@ const Traces = () => { const { data: invocations , isLoading } = useInvocationsFromLMP(null, null, currentPage, pageSize); const { data: lmpHistory, isLoading: isLMPHistoryLoading } = useLMPHistory(365); // Fetch 1 year of data + const [searchTerm, setSearchTerm] = useState(''); + const [selectedFilter, setSelectedFilter] = useState('All Runs'); + useEffect(() => { const searchParams = new URLSearchParams(location.search); const invocationId = searchParams.get('i'); @@ -39,6 +42,16 @@ const Traces = () => { navigate(`?i=${trace.id}`); }; + const filteredInvocations = useMemo(() => { + if (!invocations) return []; + return invocations.filter(inv => + inv.id.toLowerCase().includes(searchTerm.toLowerCase()) && + (selectedFilter === 'All Runs' || + (selectedFilter === 'Root Runs' && inv.is_root_run) || + (selectedFilter === 'LLM Calls' && inv.is_llm_call)) + ); + }, [invocations, searchTerm, selectedFilter]); + const chartData = useMemo(() => { if (!invocations || invocations.length === 0) return []; @@ -80,13 +93,56 @@ const Traces = () => { + m + + {/* New search and filter interface */} +
+
+
+ setSearchTerm(e.target.value)} + /> + +
+ +
+
+ {['All Runs', 'Root Runs', 'LLM Calls'].map((filter) => ( + + ))} + + +
+
+
{
- - - - - -