Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the dummy visualization #6

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 71 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,81 @@ Open Sourced Decentralized AI Frontend Demo
# how to run

1. create a .env file with the following contents
REACT_APP_AUTH0_DOMAIN=
REACT_APP_AUTH0_CLIENT_ID=

```
REACT_APP_AUTH0_DOMAIN=<secret>
REACT_APP_AUTH0_CLIENT_ID=<secret>
REACT_APP_BACKEND_DOMAIN=<secret>
REACT_APP_AUTH0_LOGOUT_REDIRECT_URI=<secret>
```

2. `npm ci` then `npm start`

# tech stack

material UI
TypeScript
React

# visualization

We will use [reactflow](https://reactflow.dev/) for visualiztion.

functional requirements:

- Show stats such as total number of nodes, models trained so far etc.
- Display the network logs about who is interacting with who

The network data will roughly be in this format

```
interface CommunicationGraphSingleRound {
nodes: Array<{ id: string }>;
links: Array<{ source: string, target: string }>;
}

interface CommunicationGraphMultipleRounds {
[key: string]: CommunicationGraphSingleRound;
}
```

If we translate it to the JSON format that is consumable by the frontend, it looks like this.

Example 1: Single Round Communication Graph `CommunicationGraphSingleRound`

```js
const SingleRound1 = {
nodes: [{ id: "user1" }, { id: "user2" }, { id: "user3" }],
links: [
{ source: "user1", target: "user2" },
{ source: "user2", target: "user3" },
],
};
```

Example 2: Multiple Rounds Communication Graph `CommunicationGraphMultipleRounds`

```js
const MultipleRounds = {
round1: SingleRound1,
round2: SingleRound2,
};
```

i.e. it looks like this

```js
const MultipleRounds = {
round1: {
nodes: [{ id: "userA" }, { id: "userB" }, { id: "userC" }],
links: [
{ source: "userA", target: "userB" },
{ source: "userB", target: "userC" },
],
},
round2: {
nodes: [{ id: "userD" }, { id: "userE" }],
links: [{ source: "userD", target: "userE" }],
},
};
```
189 changes: 189 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@types/node": "^16.18.98",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@xyflow/react": "^12.2.1",
"axios": "^1.7.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down
7 changes: 6 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import LoginButton from "./LoginButton";
import LogoutButton from "./LogoutButton";
import { useAuth0 } from "@auth0/auth0-react";
import Alert from "@mui/material/Alert";
import CustomNodes from "./CustomNodes";

// Define the type for the input data
interface DataPoint {
Expand Down Expand Up @@ -55,6 +56,8 @@ const Container = styled.div`
flex-direction: column;
margin: 0 auto;
max-width: 960px;
height: 100vh;
margin-bottom: 100px;
`;

const Logo = styled.img`
Expand Down Expand Up @@ -451,8 +454,10 @@ const App = () => {
collaborative, distributed way via gradient descent in the data space.
</i>
</SubTitle>

{renderControlAndResult()}

<h2>WIP: Visualization with Dummy Data</h2>
<CustomNodes />
</Container>
);
};
Expand Down
Loading