Skip to content

Commit

Permalink
Merge pull request #64 from SciPhi-AI/Nolan/AddUsers
Browse files Browse the repository at this point in the history
Support User/Admin Views
  • Loading branch information
NolanTrem authored Jul 25, 2024
2 parents b3aa6ad + 0876e25 commit 7088054
Show file tree
Hide file tree
Showing 13 changed files with 488 additions and 249 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@
"fs": "0.0.1-security",
"lucide-react": "^0.395.0",
"neo4j-driver": "^5.22.0",
"next": "14.2.4",
"next": "14.2.5",
"next-themes": "^0.3.0",
"nextra": "^2.13.4",
"nextra-theme-docs": "^2.13.4",
"pnpm": "^9.5.0",
"postcss": "^8.4.39",
"posthog-js": "^1.148.0",
"r2r-js": "^1.2.9",
"r2r-js": "^1.2.11",
"radix-ui": "^1.0.1",
"react": "18.3.1",
"react-chartjs-2": "^5.2.0",
Expand Down
126 changes: 63 additions & 63 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 4 additions & 13 deletions src/components/ChatDemo/PipelineStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ const RETRY_DELAY = 2000;

async function checkPipelineStatus(
deploymentUrl: string | undefined,
getClient: () => Promise<r2rClient | null>
getClient: () => r2rClient | null
): Promise<'Connected' | 'No Connection'> {
if (!deploymentUrl) {
return 'No Connection';
}

for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
try {
const client = await getClient();
const client = getClient();
if (!client) {
return 'No Connection';
}
Expand All @@ -39,7 +39,7 @@ export function useConnectionStatus(
deploymentUrl?: string,
onStatusChange?: (isConnected: boolean) => void
) {
const { getClient, refreshAuth } = useUserContext();
const { getClient } = useUserContext();
const [isConnected, setIsConnected] = useState(false);

const checkStatus = useCallback(async () => {
Expand All @@ -48,20 +48,11 @@ export function useConnectionStatus(
const newConnectionStatus = status === 'Connected';
setIsConnected(newConnectionStatus);
onStatusChange?.(newConnectionStatus);

if (!newConnectionStatus) {
// Attempt to refresh authentication if connection is lost
try {
await refreshAuth();
} catch (error) {
console.error('Failed to refresh authentication:', error);
}
}
} else {
setIsConnected(false);
onStatusChange?.(false);
}
}, [deploymentUrl, getClient, onStatusChange, refreshAuth]);
}, [deploymentUrl, getClient, onStatusChange]);

useEffect(() => {
checkStatus();
Expand Down
Loading

0 comments on commit 7088054

Please sign in to comment.