import React, { useState, useEffect, useMemo } from "react"; // import { generateCalendarData } from "../utils/calendar"; // import { // OpenSourceHeatmapProps, // ProviderInfo, // ModelData, // CalendarData, // } from "../types/heatmap"; // import Heatmap from "../components/Heatmap"; // import { fetchAllProvidersData, fetchAllAuthorsData } from "../utils/authors"; // import UserSearchDialog from "../components/UserSearchDialog"; import AIPoliciesTable from "../components/AIPoliciesTable"; import fs from 'fs'; import path from 'path'; import matter from 'gray-matter'; import { PolicyData, PolicyDataSchema } from "../types"; import z from 'zod'; // const PROVIDERS: ProviderInfo[] = [ // { color: "#ff7000", authors: ["mistralai"] }, // { color: "#1877F2", authors: ["meta-llama", "facebook", ] }, // { color: "#10A37F", authors: ["openai"] }, // { color: "#cc785c", authors: ["Anthropic"] }, // { color: "#DB4437", authors: ["google"] }, // { color: "#5E35B1", authors: ["allenai"] }, // { color: "#0088cc", authors: ["apple"] }, // { color: "#FEB800", authors: ["microsoft"] }, // { color: "#76B900", authors: ["nvidia"] }, // { color: "#0088cc", authors: ["deepseek-ai"] }, // { color: "#0088cc", authors: ["Qwen"] }, // { color: "#4C6EE6", authors: ["CohereForAI"] }, // { color: "#4C6EE6", authors: ["ibm-granite"] }, // { color: "#A020F0", authors: ["stabilityai"] }, // ]; export async function getStaticProps() { try { // Read policy data from policies.json const policiesFilePath = path.join(process.cwd(), 'content', 'policies.json'); const policiesContent = fs.readFileSync(policiesFilePath, 'utf-8'); const policyData = JSON.parse(policiesContent); // Validate policyData against the schema const validatedPolicyData = PolicyDataSchema.array().parse(policyData); // Sort policyData based on releaseDate in descending order validatedPolicyData.sort((a: PolicyData, b: PolicyData) => { const dateA = new Date(a.releaseDate).getTime(); const dateB = new Date(b.releaseDate).getTime(); return dateB - dateA; }); return { props: { policyData: validatedPolicyData, }, revalidate: 3600, }; } catch (error) { if (error instanceof z.ZodError) { const errorMessage = error.issues .map((issue) => { const path = issue.path.join('.'); const message = issue.message; return `Invalid policy data at "${path}": ${message}`; }) .join('\n'); console.error('Error validating policy data:', errorMessage); throw new Error(`Failed to validate policy data:\n${errorMessage}`); } else { console.error('Error fetching data:', error); if (error instanceof Error) { throw new Error(`Failed to fetch policy data: ${error.message}`); } else { throw new Error('Failed to fetch policy data: An unknown error occurred.'); } } } } // const ProviderHeatmap = React.memo(({ provider, calendarData }: { provider: ProviderInfo, calendarData: CalendarData }) => { // const providerName = provider.fullName || provider.authors[0]; // return ( //
// //
// ); // }); const OpenSourceHeatmap: React.FC<{ policyData: PolicyData[] }> = ({ policyData, }) => { return (

China AI policy research 🤗

{/* Add citation section */}

Citation

If you use this resource in your research, please cite it as follows:

            {`@misc{china_ai_policy_${new Date().getFullYear()},
  title={China AI Policy Research},
  author={Tiezhen Wang, Adina Yakefu, Lu Cheng},
  year={2024},
}`}
          
{/*

Models, Datasets, and Spaces from the top AI labs.

{isLoading ? (

Loading...

) : (
{sortedProviders.map((provider) => ( ))}
)} */}
); }; export default React.memo(OpenSourceHeatmap);