Build applications that make decisions (chatbots, agents, simulations, etc...). Monitor, trace, persist, and execute on your own infrastructure.
Python aiburrchatbot-frameworkdagsgenerative-aigraphshacktoberfestllmopsllmsmlopspersistent-data-structurestate-machinestate-managementvisibility
Adds updates for s3 server on frontend
elijahbenizzy8e42ef2106a8
diff --git a/telemetry/ui/src/App.tsx b/telemetry/ui/src/App.tsxindex 32d5ae00..3f08361e 100644--- a/telemetry/ui/src/App.tsx+++ b/telemetry/ui/src/App.tsx@@ -9,6 +9,7 @@ import { ChatbotWithTelemetry } from './examples/Chatbot';import { Counter } from './examples/Counter';import { EmailAssistantWithTelemetry } from './examples/EmailAssistant';import { StreamingChatbotWithTelemetry } from './examples/StreamingChatbot';+import { AdminView } from './components/routes/AdminView';/*** Basic application. We have an AppContainer -- this has a breadcrumb and a sidebar.@@ -39,6 +40,7 @@ const App = () => {<Route path="/demos/chatbot" element={<ChatbotWithTelemetry />} /><Route path="/demos/streaming-chatbot" element={<StreamingChatbotWithTelemetry />} /><Route path="/demos/email-assistant" element={<EmailAssistantWithTelemetry />} />+ <Route path="/admin" element={<AdminView />} /><Route path="*" element={<Navigate to="/projects" />} /></Routes></AppContainer>diff --git a/telemetry/ui/src/api/index.ts b/telemetry/ui/src/api/index.tsindex 4969521a..b0c0638e 100644--- a/telemetry/ui/src/api/index.ts+++ b/telemetry/ui/src/api/index.ts@@ -11,6 +11,7 @@ export type { ActionModel } from './models/ActionModel';export type { ApplicationLogs } from './models/ApplicationLogs';export type { ApplicationModel } from './models/ApplicationModel';export type { ApplicationSummary } from './models/ApplicationSummary';+export type { BackendSpec } from './models/BackendSpec';export type { BeginEntryModel } from './models/BeginEntryModel';export type { BeginSpanModel } from './models/BeginSpanModel';export { ChatItem } from './models/ChatItem';@@ -21,8 +22,10 @@ export type { EndEntryModel } from './models/EndEntryModel';export type { EndSpanModel } from './models/EndSpanModel';export type { Feedback } from './models/Feedback';export type { HTTPValidationError } from './models/HTTPValidationError';+export type { IndexingJob } from './models/IndexingJob';export type { PointerModel } from './models/PointerModel';export type { Project } from './models/Project';+export type { PromptInput } from './models/PromptInput';export type { QuestionAnswers } from './models/QuestionAnswers';export type { Span } from './models/Span';export type { Step } from './models/Step';diff --git a/telemetry/ui/src/api/models/BackendSpec.ts b/telemetry/ui/src/api/models/BackendSpec.tsnew file mode 100644index 00000000..ff240c5d--- /dev/null+++ b/telemetry/ui/src/api/models/BackendSpec.ts@@ -0,0 +1,10 @@+/* generated using openapi-typescript-codegen -- do no edit */+/* istanbul ignore file */+/* tslint:disable */+/* eslint-disable */+/**+ * Generic link for indexing job -- can be exposed in 'admin mode' in the UI+ */+export type BackendSpec = {+ indexing: boolean;+};diff --git a/telemetry/ui/src/api/models/IndexingJob.ts b/telemetry/ui/src/api/models/IndexingJob.tsnew file mode 100644index 00000000..e7e17734--- /dev/null+++ b/telemetry/ui/src/api/models/IndexingJob.ts@@ -0,0 +1,15 @@+/* generated using openapi-typescript-codegen -- do no edit */+/* istanbul ignore file */+/* tslint:disable */+/* eslint-disable */+/**+ * Generic link for indexing job -- can be exposed in 'admin mode' in the UI+ */+export type IndexingJob = {+ id: number;+ start_time: string;+ end_time: string | null;+ status: string;+ records_processed: number;+ metadata: Record<string, any>;+};diff --git a/telemetry/ui/src/api/models/Project.ts b/telemetry/ui/src/api/models/Project.tsindex 11cf7773..a9a5908c 100644--- a/telemetry/ui/src/api/models/Project.ts+++ b/telemetry/ui/src/api/models/Project.ts@@ -3,11 +3,10 @@/* tslint:disable *//* eslint-disable */export type Project = {- name: string;- id: string;- uri: string;- last_written: string;- created: string;- num_apps: number;+ name: string;+ id: string;+ last_written: string;+ created: string;+ num_apps: number;+ uri: string;};-diff --git a/telemetry/ui/src/api/models/PromptInput.ts b/telemetry/ui/src/api/models/PromptInput.tsnew file mode 100644index 00000000..dc867a38--- /dev/null+++ b/telemetry/ui/src/api/models/PromptInput.ts@@ -0,0 +1,7 @@+/* generated using openapi-typescript-codegen -- do no edit */+/* istanbul ignore file */+/* tslint:disable */+/* eslint-disable */+export type PromptInput = {+ prompt: string;+};diff --git a/telemetry/ui/src/api/services/DefaultService.ts b/telemetry/ui/src/api/services/DefaultService.tsindex 4c58539f..26dd2507 100644--- a/telemetry/ui/src/api/services/DefaultService.ts+++ b/telemetry/ui/src/api/services/DefaultService.ts@@ -4,11 +4,14 @@/* eslint-disable */import type { ApplicationLogs } from '../models/ApplicationLogs';import type { ApplicationSummary } from '../models/ApplicationSummary';+import type { BackendSpec } from '../models/BackendSpec';import type { ChatItem } from '../models/ChatItem';import type { DraftInit } from '../models/DraftInit';import type { EmailAssistantState } from '../models/EmailAssistantState';import type { Feedback } from '../models/Feedback';+import type { IndexingJob } from '../models/IndexingJob';import type { Project } from '../models/Project';+import type { PromptInput } from '../models/PromptInput';import type { QuestionAnswers } from '../models/QuestionAnswers';import type { CancelablePromise } from '../core/CancelablePromise';import { OpenAPI } from '../core/OpenAPI';@@ -96,6 +99,43 @@ export class DefaultService {url: '/api/v0/ready'});}+ /**+ * Get App Spec+ * @returns BackendSpec Successful Response+ * @throws ApiError+ */+ public static getAppSpecApiV0MetadataAppSpecGet(): CancelablePromise<BackendSpec> {+ return __request(OpenAPI, {+ method: 'GET',+ url: '/api/v0/metadata/app_spec'+ });+ }+ /**+ * Get Indexing Jobs+ * @param offset+ * @param limit+ * @param filterEmpty+ * @returns IndexingJob Successful Response+ * @throws ApiError+ */+ public static getIndexingJobsApiV0IndexingJobsGet(+ offset?: number,+ limit: number = 100,+ filterEmpty: boolean = true+ ): CancelablePromise<Array<IndexingJob>> {+ return __request(OpenAPI, {+ method: 'GET',+ url: '/api/v0/indexing_jobs',+ query: {+ offset: offset,+ limit: limit,+ filter_empty: filterEmpty+ },+ errors: {+ 422: `Validation Error`+ }+ });+ }/*** Version* Returns the burr version@@ -373,14 +413,14 @@ export class DefaultService {* :return:* @param projectId* @param appId- * @param prompt+ * @param requestBody* @returns any Successful Response* @throws ApiError*/public static chatResponseApiV0StreamingChatbotResponseProjectIdAppIdPost(projectId: string,appId: string,- prompt: string+ requestBody: PromptInput): CancelablePromise<any> {return __request(OpenAPI, {method: 'POST',@@ -389,9 +429,8 @@ export class DefaultService {project_id: projectId,app_id: appId},- query: {- prompt: prompt- },+ body: requestBody,+ mediaType: 'application/json',errors: {422: `Validation Error`}diff --git a/telemetry/ui/src/components/nav/appcontainer.tsx b/telemetry/ui/src/components/nav/appcontainer.tsxindex 70a4c817..1555fe8c 100644--- a/telemetry/ui/src/components/nav/appcontainer.tsx+++ b/telemetry/ui/src/components/nav/appcontainer.tsx@@ -16,6 +16,8 @@ import { BreadCrumb } from './breadcrumb';import { Link } from 'react-router-dom';import { classNames } from '../../utils/tailwind';import React from 'react';+import { DefaultService } from '../../api';+import { useQuery } from 'react-query';// Define your GitHub logo SVG as a React componentconst GithubLogo = () => (@@ -64,6 +66,11 @@ const ToggleOpenButton = (props: { open: boolean; toggleSidebar: () => void }) =export const AppContainer = (props: { children: React.ReactNode }) => {const [sidebarOpen, setSidebarOpen] = useState(true);const [smallSidebarOpen, setSmallSidebarOpen] = useState(false);+ const { data: backendSpec } = useQuery(['backendSpec'], () =>+ DefaultService.getAppSpecApiV0MetadataAppSpecGet().then((response) => {+ return response;+ })+ );const toggleSidebar = () => {setSidebarOpen(!sidebarOpen);};@@ -129,6 +136,15 @@ export const AppContainer = (props: { children: React.ReactNode }) => {}];+ if (backendSpec?.indexing) {+ navigation.push({+ name: 'Admin',+ href: '/admin',+ icon: ListBulletIcon,+ linkType: 'internal'+ });+ }+const isCurrent = (href: string, linkType: string) => {if (linkType === 'external') {return false;diff --git a/telemetry/ui/src/components/routes/AdminView.tsx b/telemetry/ui/src/components/routes/AdminView.tsxnew file mode 100644index 00000000..61232c98--- /dev/null+++ b/telemetry/ui/src/components/routes/AdminView.tsx@@ -0,0 +1,94 @@+import { useQuery } from 'react-query';+import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '../common/table';+import { DefaultService } from '../../api';+import { Loading } from '../common/loading';+import { DateTimeDisplay, DurationDisplay } from '../common/dates';+import JsonView from '@uiw/react-json-view';+import { useState } from 'react';+import { FunnelIcon } from '@heroicons/react/24/outline';++const RecordsHeader = (props: {+ displayZeroCount: boolean;+ setDisplayZeroCount: (displayZeroCount: boolean) => void;+}) => {+ const fillColor = props.displayZeroCount ? 'fill-gray-300' : 'fill-gray-700';+ const borderColor = props.displayZeroCount ? 'text-gray-300' : 'text-gray-700';+ return (+ <div className="flex flex-row items-center gap-1">+ <FunnelIcon+ className={`h-5 w-5 hover:scale-125 cursor-pointer ${fillColor} ${borderColor}`}+ onClick={() => {+ props.setDisplayZeroCount(!props.displayZeroCount);+ }}+ />+ <span>Seq ID</span>+ </div>+ );+};++/**+ * Currently just shows indexing jobs, but we'll likely+ * want to add more depending on whether the backend supports it.+ * @returns A rendered admin view object+ */+export const AdminView = () => {+ const [displayZeroCount, setDisplayZeroCount] = useState(false);++ const { data, isLoading } = useQuery(['indexingJobs', displayZeroCount], () =>+ DefaultService.getIndexingJobsApiV0IndexingJobsGet(+ 0, // TODO -- add pagination+ 100,+ !displayZeroCount+ )+ );+ if (isLoading) {+ return <Loading />;+ }++ return (+ <Table dense={1}>+ <TableHead>+ <TableRow>+ <TableHeader>ID</TableHeader>+ <TableHeader>Start Time</TableHeader>+ <TableHeader>Duration</TableHeader>+ <TableHeader>Status</TableHeader>+ <TableHeader>+ <RecordsHeader+ displayZeroCount={displayZeroCount}+ setDisplayZeroCount={setDisplayZeroCount}+ />+ </TableHeader>+ <TableHeader>Metadata</TableHeader>+ </TableRow>+ </TableHead>+ <TableBody>+ {data?.map((job) => {+ return (+ <TableRow key={job.id} className="hover:bg-gray-50">+ <TableCell>{job.id}</TableCell>+ <TableCell>+ {<DateTimeDisplay date={job.start_time} mode={'short'}></DateTimeDisplay>}+ </TableCell>+ <TableCell>+ {job.end_time ? (+ <DurationDisplay+ startDate={job.start_time}+ endDate={job.end_time}+ ></DurationDisplay>+ ) : (+ <></>+ )}+ </TableCell>+ <TableCell>{job.status.toLowerCase()}</TableCell>+ <TableCell>{job.records_processed}</TableCell>+ <TableCell>+ <JsonView value={job.metadata} displayDataTypes enableClipboard={false}></JsonView>+ </TableCell>+ </TableRow>+ );+ })}+ </TableBody>+ </Table>+ );+};diff --git a/telemetry/ui/src/components/routes/AppList.tsx b/telemetry/ui/src/components/routes/AppList.tsxindex 9aa042bc..a87e522a 100644--- a/telemetry/ui/src/components/routes/AppList.tsx+++ b/telemetry/ui/src/components/routes/AppList.tsx@@ -29,6 +29,10 @@ const StepCountHeader = (props: {);};+const isNullPartitionKey = (partitionKey: string | null) => {+ return partitionKey === null || partitionKey === '__none__';+};+const getForkID = (app: ApplicationSummary) => {if (app.parent_pointer) {return app.parent_pointer.app_id;@@ -77,7 +81,9 @@ const AppSubList = (props: {}}>{props.displayPartitionKey && (- <TableCell className="text-gray-600 font-sans">{app.partition_key}</TableCell>+ <TableCell className="text-gray-600 font-sans">+ {isNullPartitionKey(app.partition_key) ? '' : app.partition_key}+ </TableCell>)}<TableCell className="font-semibold text-gray-700"><div className="flex flex-row gap-1 items-center md:min-w-[21rem] md:max-w-none max-w-24">@@ -174,7 +180,9 @@ export const AppListTable = (props: { apps: ApplicationSummary[]; projectId: str// Display the parents no matter whatconst rootAppsToDisplay = appsToDisplay.filter((app) => app.spawning_parent_pointer === null);- const anyHavePartitionKey = rootAppsToDisplay.some((app) => app.partition_key !== null);+ const anyHavePartitionKey = rootAppsToDisplay.some(+ (app) => !isNullPartitionKey(app.partition_key)+ );return (<Table dense={1}>