Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
components/SimulationGraph.tsx
CHANGED
|
@@ -28,8 +28,8 @@ const SimulationGraph: React.FC<SimulationGraphProps> = ({ isBuilding, societyTy
|
|
| 28 |
let edges: any[] = [];
|
| 29 |
|
| 30 |
try {
|
| 31 |
-
// Attempt to fetch real network data
|
| 32 |
-
const networkData = await GradioService.getNetworkGraph(societyType);
|
| 33 |
if (networkData && networkData.nodes) {
|
| 34 |
nodes = networkData.nodes.map((n: any) => ({
|
| 35 |
...n,
|
|
|
|
| 28 |
let edges: any[] = [];
|
| 29 |
|
| 30 |
try {
|
| 31 |
+
// Attempt to fetch real network data if societyType is provided
|
| 32 |
+
const networkData = societyType ? await GradioService.getNetworkGraph(societyType) : null;
|
| 33 |
if (networkData && networkData.nodes) {
|
| 34 |
nodes = networkData.nodes.map((n: any) => ({
|
| 35 |
...n,
|
components/SimulationPage.tsx
CHANGED
|
@@ -115,8 +115,12 @@ const SimulationPage: React.FC<SimulationPageProps> = ({
|
|
| 115 |
const uniqueNames = Array.from(new Set(names));
|
| 116 |
setSocieties(uniqueNames);
|
| 117 |
|
| 118 |
-
if (uniqueNames.length > 0
|
|
|
|
| 119 |
setSociety(uniqueNames[0]);
|
|
|
|
|
|
|
|
|
|
| 120 |
}
|
| 121 |
} catch (e) {
|
| 122 |
console.error("Failed to fetch focus groups", e);
|
|
|
|
| 115 |
const uniqueNames = Array.from(new Set(names));
|
| 116 |
setSocieties(uniqueNames);
|
| 117 |
|
| 118 |
+
if (uniqueNames.length > 0) {
|
| 119 |
+
if (!society || !uniqueNames.includes(society)) {
|
| 120 |
setSociety(uniqueNames[0]);
|
| 121 |
+
}
|
| 122 |
+
} else {
|
| 123 |
+
setSociety('Standard Example');
|
| 124 |
}
|
| 125 |
} catch (e) {
|
| 126 |
console.error("Failed to fetch focus groups", e);
|