Skip to content

Commit

Permalink
Merge branch 'main' into fix-graphy-readme
Browse files Browse the repository at this point in the history
longbinlai committed Nov 13, 2024
2 parents 8b34387 + cfe0187 commit 2b0fe47
Showing 65 changed files with 1,128 additions and 405 deletions.
2 changes: 1 addition & 1 deletion docs/interactive/package.json
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"build:site": "next build",
"type-check": "tsc",
"deploy": "gh-pages -d out -t true"
},
3 changes: 3 additions & 0 deletions docs/portal/.gitignore
Original file line number Diff line number Diff line change
@@ -35,3 +35,6 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts


/public/portal.html
34 changes: 34 additions & 0 deletions docs/portal/components/Tools/graphy.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import dynamic from 'next/dynamic';
import { GlobalSpin } from '@graphscope/studio-components';

const Apps = dynamic(
() =>
import('@graphscope/graphy-website').then(module => {
return {
/** 这种写法和 react lazy 就统一了 */
default: () => {
return (
<div
style={{
position: 'absolute',
top: '0px',
left: '0px',
bottom: '0px',
right: '0px',
zIndex: 999,
background: '#fff',
}}
>
<module.default />
</div>
);
},
};
}),
{
loading: () => <GlobalSpin />,
ssr: false,
},
);

export default Apps;
6 changes: 3 additions & 3 deletions docs/portal/components/Tools/index.tsx
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ const tools = [
features: ['Supports importing CSV/JSON data for instant graph visual analysis'],
module: '@graphscope/studio-graph',
link: '/tools/visualizer',
img: '/query/recommand.png',
img: '/tools/visualizer.png',
},
{
name: 'Graphy',
@@ -23,7 +23,7 @@ const tools = [
note: 'Follow the GitHub documentation to start the Graphy server',
module: '@graphscope/graphy',
link: '/tools/graphy',
img: '/query/recommand.png',
img: '/tools/graphy.png',
},
{
name: 'Draw-pattern',
@@ -77,7 +77,7 @@ const Tools: React.FunctionComponent<IToolsProps> = props => {
{tools.map((tool, index) => (
<Col span={8} key={index}>
{/** @ts-ignore */}
<Link href={tool.link}>
<Link href={tool.link} target="_blank">
<Card style={{ padding: '1px' }} hoverable cover={<img alt={tool.name} src={tool.img} />}>
<Meta title={tool.description} description={tool.features[0]} />
</Card>
52 changes: 52 additions & 0 deletions docs/portal/components/Tools/portal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// import dynamic from 'next/dynamic';
// import { GlobalSpin } from '@graphscope/studio-components';

// const Apps = dynamic(
// () =>
// import('@graphscope/studio-site').then(module => {
// return {
// /** 这种写法和 react lazy 就统一了 */
// default: () => {
// return (
// <div
// style={{
// position: 'absolute',
// top: '0px',
// left: '0px',
// bottom: '0px',
// right: '0px',
// zIndex: 999,
// background: '#fff',
// }}
// >
// <module.default />
// </div>
// );
// },
// };
// }),
// {
// loading: () => <GlobalSpin />,
// ssr: false,
// },
// );

// export default Apps;

export default () => {
return (
<iframe
style={{
position: 'absolute',
height: '100%',
width: '100%',
top: '0px',
left: '0px',
bottom: '0px',
right: '0px',
zIndex: 999,
}}
src="/portal.html"
></iframe>
);
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import dynamic from 'next/dynamic';
import { GlobalSpin } from '@graphscope/studio-components';

const Apps = dynamic(
const Visualizer = dynamic(
() =>
import('@graphscope/graph-apps').then(module => {
return {
@@ -17,4 +17,4 @@ const Apps = dynamic(
},
);

export default Apps;
export default Visualizer;
23 changes: 23 additions & 0 deletions docs/portal/next.config.js
Original file line number Diff line number Diff line change
@@ -21,6 +21,27 @@ const nextConfig = {
esmExternals: 'loose',
optimizePackageImports: ['node:os'],
},
async headers() {
return [
{
source: '/(.*)', // 匹配所有路径
headers: [
{
key: 'Access-Control-Allow-Origin',
value: '*',
},
{
key: 'Cross-Origin-Embedder-Policy',
value: 'require-corp',
},
{
key: 'Cross-Origin-Opener-Policy',
value: 'same-origin',
},
],
},
];
},
};

const { webpack: nextraWebpack, ...othersConfig } = withNextra();
@@ -32,7 +53,9 @@ const webpack = (config, options) => {
_config.externals.push({
'node:os': 'os',
fsevents: 'fsevents',
// 'monaco-editor': 'monaco',
});

return _config;
};

5 changes: 4 additions & 1 deletion docs/portal/package.json
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"build:site": "cd ../../packages/studio-website && npm run build:site:single && cd ../../docs/portal && next build",
"type-check": "tsc",
"deploy": "gh-pages -d out -t true"
},
@@ -13,6 +13,9 @@
"@graphscope/studio-components": "workspace:*",
"@graphscope/studio-graph": "workspace:*",
"@graphscope/graph-apps": "workspace:*",
"@graphscope/graphy-website": "workspace:*",
"@graphscope/studio-importor": "workspace:*",
"@graphscope/studio-site": "workspace:*",
"next": "15.0.2",
"next-seo": "^6.6.0",
"nextra": "^2.13.2",
18 changes: 18 additions & 0 deletions docs/portal/pages/tools/_meta.json
Original file line number Diff line number Diff line change
@@ -13,5 +13,23 @@
"footer": false,
"layout": "full"
}
},
"graphy": {
"type": "page",
"title": "Graphy",
"theme": {
"footer": false,
"layout": "full",
"header": false
}
},
"portal": {
"type": "page",
"title": "Portal",
"theme": {
"footer": false,
"layout": "full",
"header": false
}
}
}
5 changes: 5 additions & 0 deletions docs/portal/pages/tools/graphy.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import React from 'react';
import { Bleed } from 'nextra-theme-docs';
import Graphy from '../../components/Tools/graphy';

<Graphy />
5 changes: 5 additions & 0 deletions docs/portal/pages/tools/portal.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import React from 'react';
import { Bleed } from 'nextra-theme-docs';
import Portal from '../../components/Tools/portal';

<Portal />
4 changes: 2 additions & 2 deletions docs/portal/pages/tools/visualizer.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import VisualTools from '../../components/VisualTool';
import Visualizer from '../../components/Tools/visualizer';

<VisualTools></VisualTools>
<Visualizer />
Binary file added docs/portal/public/tools/graphy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/portal/public/tools/visualizer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions examples/graphy/.fatherrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default {
esm: { output: 'es' },
cjs: { output: 'lib' },
};
2 changes: 1 addition & 1 deletion examples/graphy/index.html
Original file line number Diff line number Diff line change
@@ -13,6 +13,6 @@
</head>
<body>
<div id="root" style="height: 100vh"></div>
<script type="module" src="./src/index.tsx"></script>
<script type="module" src="./src/app.tsx"></script>
</body>
</html>
23 changes: 13 additions & 10 deletions examples/graphy/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "graphy-wesite",
"name": "@graphscope/graphy-website",
"version": "0.1.1",
"description": "",
"main": "lib/index.js",
@@ -15,8 +15,10 @@
"dist"
],
"scripts": {
"start": "vite dev",
"build": "vite build"
"start": "father dev",
"build": "father build",
"start:site": "vite dev",
"build:site": "vite build"
},
"pnpm": {
"overrides": {
@@ -28,13 +30,13 @@
"dependencies": {
"@ant-design/icons": "^5.2.6",
"@antv/g2": "^5.2.7",
"@graphscope/graph-apps": "latest",
"@graphscope/studio-components": "latest",
"@graphscope/studio-driver": "latest",
"@graphscope/studio-graph": "latest",
"@graphscope/studio-importor": "latest",
"@graphscope/studio-query": "latest",
"@kuzu/kuzu-wasm": "^1.0.4",
"@graphscope/graph-apps": "workspace:*",
"@graphscope/studio-components": "workspace:*",
"@graphscope/studio-driver": "workspace:*",
"@graphscope/studio-graph": "workspace:*",
"@graphscope/studio-importor": "workspace:*",
"@graphscope/studio-query": "workspace:*",
"@kuzu/kuzu-wasm": "0.6.2-dev",
"antd": "^5.21.0",
"d3-force": "latest",
"html-to-image": "^1.11.11",
@@ -51,6 +53,7 @@
"devDependencies": {
"@vitejs/plugin-react": "^4.2.1",
"jszip": "^3.10.1",
"tslib": "^2.8.1",
"vite": "^5.4.9",
"vite-plugin-top-level-await": "^1.4.4",
"vite-plugin-wasm": "^3.3.0"
6 changes: 6 additions & 0 deletions examples/graphy/src/app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './pages';

const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
root.render(<App />);
8 changes: 2 additions & 6 deletions examples/graphy/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './pages';

const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
root.render(<App />);
import GraphyApp from './pages';
export default GraphyApp;
129 changes: 117 additions & 12 deletions examples/graphy/src/kuzu-driver/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { default as Kuzu } from '@kuzu/kuzu-wasm';
import Kuzu from '@kuzu/kuzu-wasm';
import { Utils } from '@graphscope/studio-components';
import localforage from 'localforage';
console.log('Kuzu', Kuzu);

interface IKuzuResult {
Database: (params: any) => Promise<any>;
@@ -66,7 +67,9 @@ export class KuzuDriver {

async initialize(): Promise<void> {
const result: IKuzuResult = await this.kuzu();

//@ts-ignore

this.db = await result.Database(this.dbname, 0, 10, false, false, 4194304 * 16 * 4);
this.conn = await result.Connection(this.db);
this.FS = result.FS;
@@ -77,6 +80,7 @@ export class KuzuDriver {
// this.FS?.mkdir('export');
}


async installUDF(): Promise<void> {
var res = await this.conn?.execute('CREATE MACRO elementid(x) AS CAST(ID(x),"STRING")');
console.log(res.toString());
@@ -96,10 +100,34 @@ export class KuzuDriver {
}
}

async removeTables() {
const query = `CALL SHOW_TABLES() RETURN name, type;`;
const res = await this.conn?.execute(query);
const table_info = res.toString().split('\n');

const vertex_tables: any[] = [];

for (let i = 1; i < table_info.length; i++) {
if (table_info[i][1] == 'REL') {
const res = await this.conn?.execute(`DROP TABLE ${table_info[i][0]}`);
}
else {
vertex_tables.push(table_info[i][0]);
}
}

for (let i = 0; i < vertex_tables.length; i++) {
const res = await this.conn?.execute(`DROP TABLE ${vertex_tables[i]}`);
}
}

async switchDataset(datasetId: string) {
console.log('switch to ', datasetId);
console.log('switch to ', datasetId, this.curDataset);
if (this.curDataset !== '') {
await this.exportData();
await this.exportData(true);
}
else {
await this.removeTables();
}

const exist = await this.existDataset(datasetId);
@@ -134,6 +162,7 @@ export class KuzuDriver {

const node_scripts = nodes.map(node => {
const { label, properties } = node;

let property_scripts = properties.map(property => {
const { name, type, primaryKey } = property;
return `${name} ${this.typeConvert(type)}`;
@@ -152,6 +181,7 @@ export class KuzuDriver {
});
const edge_scripts = edges.map(edge => {
const { label, source, target, properties } = edge;

const property_scripts = properties.map(property => {
const { name, type } = property;
return `${name} ${this.typeConvert(type)}`;
@@ -240,6 +270,39 @@ export class KuzuDriver {
return true;
}

pathJoin(...segments) {
return segments
.filter(segment => segment)
.join('/')
.replace(/\/+/g, '/');
}

async rmdirs(dir: string) {
let entries = await this.FS.readdir(dir);
console.log(entries);

let results = await Promise.all(entries.map(async entry => {
if (entry !== '.' && entry !== '..') {
let fullPath = this.pathJoin(dir, entry);
console.log(`remove ${fullPath}`)

const { mode, timestamp } = await this.FS.lookupPath(fullPath).node;
if (this.FS.isFile(mode)) {
await this.FS.unlink(fullPath);
}
else if (this.FS.isDir(mode)) {
await this.rmdirs(fullPath);
}
}
}));

try {
await this.FS.rmdir(dir);
} catch {
console.log(`Error when remove ${dir}`);
}
};

async queryData(query: string): Promise<any> {
console.time('Query cost');
const queryResult = await this.conn?.execute(query);
@@ -311,7 +374,7 @@ export class KuzuDriver {
return this.schema;
}

async exportData(): Promise<any> {
async exportData(remove: boolean = false): Promise<any> {
if (this.curDataset === '') return false;

var datasetId = this.curDataset;
@@ -320,14 +383,15 @@ export class KuzuDriver {
const exportPath = 'export/';

try {
this.FS.rmdir(exportPath);
await this.rmdirs(exportPath);
} catch (error) {
console.log(`Directory ${exportPath} not exists`);
}

const query = `EXPORT DATABASE '${exportPath}' (format="csv", HEADER=true, DELIM="|", ESCAPE='"', QUOTE='"');`;
const query = `EXPORT DATABASE '${exportPath}' (HEADER=true, DELIM="|", ESCAPE='\"', QUOTE='\"');`;
var res = await this.conn?.execute(query);

const vertex_tables: any[] = [];
const dirFiles = this.FS.readdir(exportPath);
for (const dir of dirFiles) {
if (dir === '.' || dir === '..') {
@@ -340,6 +404,10 @@ export class KuzuDriver {
files.push(file);
}

if (remove) {
this.removeTables();
}

const dataset = new GraphData(files, this.schema);

await this.indexdb
@@ -355,11 +423,41 @@ export class KuzuDriver {
// console.log(result);
}

async recoverFromFiles(importPath: string): Promise<any> {
const decoder = new TextDecoder('utf-8');
const encoder = new TextEncoder();

const schema_file_path = importPath + 'schema.cypher';
const schema_str = this.FS.readFile(schema_file_path);
const schema_states = decoder.decode(schema_str).split('\n');
console.log(`schema: ${schema_states}`);
for (let i = 0; i < schema_states.length; i += 1) {
const query = `${schema_states[i]}`;
console.log('query: ', query);
var res = await this.conn?.execute(query);
console.log(res.toString());
}

const copy_file_path = importPath + 'copy.cypher';
const copy_str = this.FS.readFile(copy_file_path);
const copy_stats = decoder.decode(copy_str);
console.log(`copy: ${copy_stats}`);
const result = copy_stats.replace(/"([^"]+\.csv)"/g, `"${importPath}\$1"`).split('\n');
console.log(result);

for (let i = 0; i < result.length; i += 1) {
const query = `${result[i]}`;
console.log('query: ', query);
var res = await this.conn?.execute(query);
console.log(res.toString());
}
}

async recoverData(datasetId: string): Promise<any> {
console.log('start recover');
const importPath = 'import/';
try {
this.FS.rmdir(importPath);
this.rmdirs(importPath);
} catch (error) {
console.log(`Directory ${importPath} not exists`);
}
@@ -380,12 +478,19 @@ export class KuzuDriver {
// c += 1;
}

const query = `IMPORT DATABASE '${importPath}';`;
console.log('query: ', query);
var res = await this.conn?.execute(query);

console.log(res.toString());
await this.recoverFromFiles(importPath);
return true;

// var tres = await this.conn?.execute(`CALL SHOW_TABLES() RETURN name`);
// console.log(tres.toString());

// const query = `IMPORT DATABASE '${importPath}';`;
// console.log('query: ', query);
// var res = await this.conn?.execute(query);

// console.log(res);
// console.log(res.toString());
// return true;
}

async getCount() {
148 changes: 0 additions & 148 deletions examples/graphy/src/pages/components/ClusterGraph/index.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions examples/graphy/src/pages/components/index.tsx
Original file line number Diff line number Diff line change
@@ -2,5 +2,3 @@ export { default as CreateHeaderPortal } from './CreateHeaderPortal';
export { default as GraphList } from './GraphList';
export { default as GraphSchema } from './GraphSchema';
export { default as Container } from './Container';
/** app */
export { default as ClusterGraph } from './ClusterGraph';
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react';

import { Typography, Card, Divider, Skeleton } from 'antd';
import { TypingText, Utils } from '@graphscope/studio-components';
import { runSummarize } from '../../pages/dataset/service';
import { runSummarize } from '../../../service';
interface IContentProps {
id: string | null;
combo: any;
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { Select, Button, Typography, Space, notification } from 'antd';
import { useCluster, useContext } from '@graphscope/studio-graph';
import { runCluster } from '../../pages/dataset/service';
import { runCluster } from '../../../service';
import { Utils } from '@graphscope/studio-components';
interface IClusterProps {}

Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ import * as React from 'react';
import { Button, Flex, Table, TableProps, Typography, Progress } from 'antd';
import { useContext, getDataMap, getStyleConfig } from '@graphscope/studio-graph';
import { Utils } from '@graphscope/studio-components';
import { getExtractResultByEntity } from '../../pages/dataset/service';
import { getExtractResultByEntity } from '../../../service';
interface IUploadProps {}

const FetchGraph: React.FunctionComponent<IUploadProps> = props => {
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState } from 'react';
import { Select, Space, Button, Flex, Tooltip } from 'antd';
import { useContext, useCluster } from '@graphscope/studio-graph';
// import { query } from '../FetchGraph/service';

import { Utils } from '@graphscope/studio-components';
import { LikeOutlined } from '@ant-design/icons';
interface IFilterClusterProps {}
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ import * as React from 'react';
import { Button, Flex, List, Typography } from 'antd';
// import { query } from '../FetchGraph/service';
import { useContext, useCluster } from '@graphscope/studio-graph';
import { updateClusterSummarize, runSummarize } from '../../pages/dataset/service';
import { updateClusterSummarize, runSummarize } from '../../../service';
import { Utils } from '@graphscope/studio-components';
interface ISummarizeProps {
onClick?: () => void;
File renamed without changes.
131 changes: 131 additions & 0 deletions examples/graphy/src/pages/dataset/cluster/graph.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
import React, { useRef } from 'react';

import { Button } from 'antd';
import { FilterOutlined } from '@ant-design/icons';

import { Section, useSection, Icons, FullScreen, SegmentedTabs, StudioProvier } from '@graphscope/studio-components';
import {
Toolbar,
SwitchEngine,
PropertiesPanel,
Canvas,
StyleSetting,
ZoomFit,
ClearStatatus,
Loading,
BasicInteraction,
GraphProvider,
locales,
} from '@graphscope/studio-graph';

import { Workflow, ClusterInfo, FetchGraph } from './components';

import { Divider } from 'antd';

interface QueryGraphProps {}

const ToogleButton = () => {
const { toggleLeftSide } = useSection();
return (
<div>
<Button icon={<Icons.Sidebar />} onClick={() => toggleLeftSide()} type="text" />
</div>
);
};

const ClusterGraph: React.FunctionComponent<QueryGraphProps> = props => {
const containerRef = useRef<HTMLDivElement | null>(null);

const workflows = [
{
key: 'Current extraction progress',
label: 'Current extraction progress',
icon: <FilterOutlined color="#000" />,
children: <FetchGraph />,
},
// {
// key: 'Cluster',
// label: 'Cluster entity',
// icon: <Icons.Cluster />,
// children: <FetchCluster />,
// },
// {
// key: 'Filter cluster',
// label: 'Filter cluster',
// icon: <FilterOutlined color="#000" />,
// children: <FilterCluster />,
// },
// {
// key: 'Summarize',
// label: 'LLM Summarize',
// icon: <BookOutlined color="#000" />,
// children: <Summarize />,
// },
];
const items = [
{
key: 'Workflow',
label: 'Workflow',
value: 'Workflow',
children: <Workflow items={workflows} type="timeline" />,
},
{
key: 'Style',
label: 'Style',
value: 'Style',
children: <StyleSetting />,
},
];
return (
<div
style={{
background: '#fff',
borderRadius: '8px',
height: '100%',
position: 'absolute',
top: '0px',
left: '0px',
right: '0px',
bottom: '0px',
}}
ref={containerRef}
>
<StudioProvier locales={locales}>
<GraphProvider id="cluster-graph">
<Section
splitBorder
rightSide={
<PropertiesPanel>
<SegmentedTabs items={items} block />
</PropertiesPanel>
}
autoResize={false}
rightSideStyle={{
width: '350px',
}}
defaultCollapsed={{
leftSide: true,
rightSide: false,
}}
>
<Canvas />
<ClearStatatus />
<ClusterInfo />
<BasicInteraction />
<Loading />
<Toolbar style={{ position: 'absolute', top: '20px', right: '20px', left: 'unset' }}>
<ToogleButton />
<Divider style={{ margin: '0px' }} />
<SwitchEngine />
<ZoomFit />
{/* <RunCluster /> */}
<FullScreen containerRef={containerRef} />
</Toolbar>
</Section>
</GraphProvider>
</StudioProvier>
</div>
);
};

export default ClusterGraph;
3 changes: 2 additions & 1 deletion examples/graphy/src/pages/dataset/cluster/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react';
import ClusterGraph from './graph';

import { Container, ClusterGraph } from '../../components';
import { Container } from '../../components';

interface ICreateProps {}

50 changes: 24 additions & 26 deletions examples/graphy/src/pages/dataset/embed/view.tsx
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ import * as React from 'react';

import ImportorApp, { useContext } from '@graphscope/studio-importor';
import { Button } from 'antd';
import { Toolbar, Utils, MultipleInstance } from '@graphscope/studio-components';
import { Toolbar, Utils } from '@graphscope/studio-components';

import SaveButton from './save';
import { transformDataToSchema } from './transform';
@@ -36,31 +36,29 @@ const Init = ({ data }) => {
const EmbedSchemaView: React.FunctionComponent<IModelingProps> = props => {
const { data } = props;
return (
<MultipleInstance>
<ImportorApp
style={{
height: '300px',
}}
appMode="PURE"
defaultCollapsed={{
leftSide: true,
rightSide: true,
}}
leftSide={<LeftSide />}
rightSide={<RightSide />}
rightSideStyle={{
width: '0px',
padding: '0px 12px',
}}
queryPrimitiveTypes={() => {
return ['DT_DOUBLE', 'DT_STRING', 'DT_SIGNED_INT32', 'DT_SIGNED_INT64'].map(item => {
return { label: item, value: item };
});
}}
>
<Init data={data} />
</ImportorApp>
</MultipleInstance>
<ImportorApp
style={{
height: '300px',
}}
appMode="PURE"
defaultCollapsed={{
leftSide: true,
rightSide: true,
}}
leftSide={<LeftSide />}
rightSide={<RightSide />}
rightSideStyle={{
width: '0px',
padding: '0px 12px',
}}
queryPrimitiveTypes={() => {
return ['DT_DOUBLE', 'DT_STRING', 'DT_SIGNED_INT32', 'DT_SIGNED_INT64'].map(item => {
return { label: item, value: item };
});
}}
>
<Init data={data} />
</ImportorApp>
);
};

51 changes: 51 additions & 0 deletions examples/graphy/src/pages/dataset/list/action.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import React, { useState } from 'react';

import { Space, Button, theme, Tooltip } from 'antd';

import type { IDataset } from '../typing';

import { downloadDataset, runExtract, deleteDataset, useKuzuGraph } from '../service';

import { FileZipOutlined, DeleteOutlined, GlobalOutlined } from '@ant-design/icons';

const Action: React.FunctionComponent<IDataset> = props => {
const { id, refreshList } = props;
const [loading, setLoading] = useState(false);
const handleDelete = async () => {
await deleteDataset(id);
refreshList && refreshList();
};

return (
<Space>
<Tooltip title="Import into GraphScope for graph analysis">
<Button
icon={<GlobalOutlined />}
loading={loading}
onClick={async () => {
// const rest = await runInteractive(id);
setLoading(true);
const rest = await useKuzuGraph(id);
setLoading(false);
window.open(`#/paper-reading?graph_id=${id}`, '_blank');
}}
>
Graph Analysis
</Button>
</Tooltip>
<Tooltip title="Download extracted graph dataset">
<Button
icon={<FileZipOutlined />}
onClick={() => {
downloadDataset(id);
}}
></Button>
</Tooltip>
<Tooltip title="Delete dataset">
<Button onClick={handleDelete} icon={<DeleteOutlined />}></Button>
</Tooltip>
</Space>
);
};

export default Action;
29 changes: 17 additions & 12 deletions examples/graphy/src/pages/dataset/list/index.tsx
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ import { useNavigate } from 'react-router-dom';
import { GraphList, GraphSchema } from '../../components';
import { queryDataset } from '../service';
import ListItem from './item';
import Action from './action';
const { useToken } = theme;
import type { IDataset } from '../typing';

@@ -34,7 +35,6 @@ const List: React.FunctionComponent<IListProps> = props => {
const { lists } = state;
const queryData = async () => {
const data = await queryDataset();

setState(preState => {
return {
...preState,
@@ -54,18 +54,23 @@ const List: React.FunctionComponent<IListProps> = props => {
},
]}
>
<Flex justify="flex-end" align="center">
<Button
onClick={() => {
navigation('/dataset/create');
}}
>
Create Dataset
</Button>
{!isEmpty && (
<Flex justify="flex-start" align="center">
<Button
type="primary"
onClick={() => {
navigation('/dataset/create');
}}
>
Create Dataset
</Button>
</Flex>
)}
<Flex vertical gap={24} style={{ marginTop: '24px' }}>
{lists.map(item => {
return <ListItem key={item.id} {...item} refreshList={queryData} />;
})}
</Flex>
{lists.map(item => {
return <ListItem key={item.id} {...item} refreshList={queryData} />;
})}
{isEmpty && (
<Result
status="404"
62 changes: 42 additions & 20 deletions examples/graphy/src/pages/dataset/list/item.tsx
Original file line number Diff line number Diff line change
@@ -1,58 +1,80 @@
import * as React from 'react';
import { Typography, Flex, Space, Button, theme, Divider, Tooltip } from 'antd';
import { Typography, Flex, Space, Button, theme, Divider, Tooltip, Card } from 'antd';

import { useNavigate } from 'react-router-dom';

import { GraphList, GraphSchema } from '../../components';
import type { IDataset } from '../typing';
import GraphView from '../embed/view';
import { downloadDataset, deleteDataset } from '../service';
import { SettingOutlined, FileZipOutlined, DeploymentUnitOutlined, DeleteOutlined } from '@ant-design/icons';
import {
SettingOutlined,
FileZipOutlined,
DeploymentUnitOutlined,
DeleteOutlined,
DatabaseOutlined,
} from '@ant-design/icons';
import Steps from './steps';
import Action from './action';
// import Steps from './step-custom';

const { useToken } = theme;

export const styles: Record<string, React.CSSProperties> = {
container: {
margin: '24px 0px',
padding: '12px',
background: '#f4f6f8',
margin: '0px',
padding: '1px',
// background: '#f4f6f8',
},
card: {
borderRadius: '4px',
padding: '12px',
background: '#fff',
// border: '1px solid #ddd',
},
};

const List: React.FunctionComponent<IDataset & { refreshList: () => any }> = props => {
const { id, schema, entity, status, refreshList } = props;
const { id, schema, entity } = props;
console.log(props);
let summarized = false;
if (entity.length > 0) {
summarized = entity.every(item => {
return item.summarized === true;
});
}
const navigation = useNavigate();
const handleDelete = () => {
deleteDataset(id);
refreshList();
};

return (
<Flex vertical flex={1} style={styles.container} gap={8}>
<Steps {...props} />
<Flex justify="space-between" gap={8}>
<Flex style={{ ...styles.card, flexBasis: '300px' }}>
<GraphView data={schema} />
</Flex>
<Flex flex={1} style={styles.card}>
<GraphList dataSource={entity} datasetId={id}></GraphList>
<Card
title={
<Typography.Text>
<Button icon={<DatabaseOutlined />} type="text" />
{id}
</Typography.Text>
}
extra={<Action {...props} />}
styles={{
body: { padding: '0px', margin: '0px' },
header: {
padding: '12px',
},
}}
>
<Flex vertical flex={1} style={styles.container}>
<Steps {...props} />
<Divider style={{ margin: 0 }} />

<Flex justify="space-between" gap={8}>
<Flex style={{ ...styles.card, flexBasis: '300px' }}>
<GraphView data={schema} />
</Flex>
<Divider type="vertical" style={{ height: '327px' }} />
<Flex flex={1} style={styles.card}>
<GraphList dataSource={entity} datasetId={id}></GraphList>
</Flex>
</Flex>
</Flex>
</Flex>
</Card>
);
};

33 changes: 0 additions & 33 deletions examples/graphy/src/pages/dataset/list/steps.tsx
Original file line number Diff line number Diff line change
@@ -46,14 +46,6 @@ const DatasetSteps: React.FunctionComponent<IDataset> = props => {
const data = await runExtract(id);
refreshList && refreshList();
};
const handleDownload = async () => {
const data = await runExtract(id);
console.log('data', data);
};
const handleDelete = () => {
deleteDataset(id);
refreshList && refreshList();
};

return (
<Flex justify="space-between" align="center" style={styles.card} gap={100}>
@@ -104,31 +96,6 @@ const DatasetSteps: React.FunctionComponent<IDataset> = props => {
},
]}
/>

<Space>
<Tooltip title="Import into GraphScope for graph analysis">
<Button
icon={<GlobalOutlined />}
onClick={async () => {
// const rest = await runInteractive(id);
const rest = await useKuzuGraph(id);
console.log(rest, id);
window.open(`/paper-reading?graph_id=${id}`, '_blank');
}}
></Button>
</Tooltip>
<Tooltip title="Download extracted graph dataset">
<Button
icon={<FileZipOutlined />}
onClick={() => {
downloadDataset(id);
}}
></Button>
</Tooltip>
<Tooltip title="Delete dataset">
<Button onClick={handleDelete} icon={<DeleteOutlined />}></Button>
</Tooltip>
</Space>
</Flex>
);
};
1 change: 1 addition & 0 deletions examples/graphy/src/pages/dataset/service.ts
Original file line number Diff line number Diff line change
@@ -466,6 +466,7 @@ export const getDriver = async () => {
export const useKuzuGraph = async (dataset_id: string) => {
const driver = await getDriver();
const exist = await driver.existDataset(dataset_id);

if (!exist) {
await createKuzuGraph(dataset_id);
}
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ import { Flex, Input, Skeleton, List, Divider, Spin } from 'antd';
import { SearchOutlined } from '@ant-design/icons';
import { Utils } from '@graphscope/studio-components';
import Highlighter from 'react-highlight-words';
import './index.css';
// import './index.css';
import { useContext } from '@graphscope/studio-graph';
import { SERVICES } from '../registerServices';
const { getSearchParams, debounce } = Utils;
7 changes: 4 additions & 3 deletions examples/graphy/src/pages/explore/paper-reading/index.tsx
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ import React, { useRef } from 'react';

import { Button } from 'antd';

import { MultipleInstance, Section, useSection, Icons, FullScreen } from '@graphscope/studio-components';
import { Section, useSection, Icons, FullScreen, StudioProvier } from '@graphscope/studio-components';
import {
Toolbar,
SwitchEngine,
@@ -20,6 +20,7 @@ import {
ClearCanvas,
StyleSetting,
Brush,
GraphProvider,
} from '@graphscope/studio-graph';

import { FetchGraph, Searchbar, PaperList, PaperInfo, Statistics } from './components';
@@ -55,7 +56,7 @@ const PaperReading: React.FunctionComponent<QueryGraphProps> = props => {
console.log('PaperReading props', props);
return (
<IntlProvider messages={messages} locale={locale}>
<MultipleInstance>
<GraphProvider>
<div
style={{
background: '#fff',
@@ -131,7 +132,7 @@ const PaperReading: React.FunctionComponent<QueryGraphProps> = props => {
</Toolbar>
</Section>
</div>
</MultipleInstance>
</GraphProvider>
</IntlProvider>
);
};
1 change: 1 addition & 0 deletions examples/graphy/src/pages/explore/services/kuzu.tsx
Original file line number Diff line number Diff line change
@@ -29,6 +29,7 @@ export const queryStatistics = async () => {
};
export const reload = async () => {
const graph_id = (Utils.getSearchParams('graph_id') || '0') as string;
debugger;
const driver = await getDriver();
await driver.switchDataset(graph_id);
window.KUZU_DRIVER = driver;
9 changes: 5 additions & 4 deletions examples/graphy/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Suspense, useEffect } from 'react';
import { BrowserRouter, Routes, Route, Navigate, Outlet } from 'react-router-dom';
import { BrowserRouter, Routes, Route, Navigate, Outlet, HashRouter } from 'react-router-dom';
import { Layout } from '@graphscope/studio-components';
import { SIDE_MENU } from './const';
import { ConfigProvider } from 'antd';
@@ -34,6 +34,7 @@ interface IPagesProps {}

const routes = [
{ path: '/', redirect: '/dataset' },
{ path: '/tools/graphy/', redirect: '#/dataset' },
{
path: '/dataset',
index: true,
@@ -68,7 +69,7 @@ const Apps = () => {
return (
<>
<Outlet />
{isReady && <PaperReading queryCypher={queryCypher} queryCypherSchema={queryCypherSchema} />}
{isReady && <PaperReading />}
</>
);
};
@@ -107,14 +108,14 @@ const Pages: React.FunctionComponent<IPagesProps> = props => {
}}
>
<IntlProvider messages={messages} locale={locale}>
<BrowserRouter>
<HashRouter>
<Routes>
<Route path="/" element={<Layout sideMenu={[SIDE_MENU]} />}>
{routeComponents}
</Route>
<Route path={'/paper-reading'} element={<Apps />} />
</Routes>
</BrowserRouter>
</HashRouter>
</IntlProvider>
</ConfigProvider>
);
14 changes: 8 additions & 6 deletions examples/graphy/vite.config.ts
Original file line number Diff line number Diff line change
@@ -22,12 +22,14 @@ export default defineConfig({
},
build: {
outDir: './dist',
// rollupOptions: {
// external: ['@kuzu/kuzu-wasm'], // 将 @kuzu/kuzu-wasm 标记为外部依赖
// },
// rollupOptions: {
// external: ['react', 'react-dom', '@kuzu/kuzu-wasm'], // 将 react 和 react-dom 设为外部依赖
// },
rollupOptions: {
// external: ['@kuzu/kuzu-wasm'], // 将 @kuzu/kuzu-wasm 标记为外部依赖
// output: {
// globals: {
// '@kuzu/kuzu-wasm': 'KUZU_WASM',
// },
// },
},
},

optimizeDeps: {
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
"build": "turbo run build --no-cache",
"build:portal": "cd packages/studio-website && npm run build:site",
"build:examples": "pnpm i && rm -rf package-lock.json && npm run build && cd examples/graph-apps && npm run build:site",
"build:docs": "pnpm i && rm -rf package-lock.json && npm run build && cd docs/portal && npm run build",
"build:docs": "pnpm i && rm -rf package-lock.json && npm run build && cd docs/portal && npm run build:site",
"build:docs-dumi-components": "npm run prev && npm run build && dumi build",
"docs": "dumi dev",
"version": "changeset version",
8 changes: 3 additions & 5 deletions packages/studio-components/src/Logo/index.tsx
Original file line number Diff line number Diff line change
@@ -135,21 +135,19 @@ export const LogoText = ({
};

const Logo = (props: { style?: any; onlyIcon?: boolean }) => {
const { style = {}, onlyIcon } = props;
const { color = '#333' } = style;
const { style = {} } = props;

const { token } = theme.useToken();

return (
<div
style={{
overflow: 'hidden',
// padding: '0px 14px',
// width: onlyIcon ? `56px` : `150px`,
...style,
}}
>
<LogoImage style={{ width: '28px', marginTop: '-4px', marginRight: '6px' }} />
<LogoText style={{ width: '120px', height: '54px' }} color={token.colorTextLightSolid} />
<LogoText style={{ width: '120px', height: '54px' }} color={token.colorTextHeading} />
</div>
);
};
45 changes: 45 additions & 0 deletions packages/studio-components/src/hooks/useDynamicStyle.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { useEffect, useRef } from 'react';

/**
* 自定义 Hook,用于在组件中动态插入和移除 <style> 标签
* @param {string} css - 要插入的 CSS 样式字符串
* @param {string} [id] - <style> 标签的唯一 ID,默认为 'dynamic-style'
*/
export function useDynamicStyle(css: string, id: string = 'dynamic-style') {
const styleRef = useRef<HTMLStyleElement | null>(null);

useEffect(() => {
// 如果已经插入了样式,则跳过
if (styleRef.current) {
return;
}

// 创建一个 <style> 标签
const style = document.createElement('style');
style.type = 'text/css';
style.id = id;

// 将 CSS 样式插入到 <style> 标签中
if ('sheet' in style) {
// 现代浏览器
style.appendChild(document.createTextNode(css));
} else if ('styleSheet' in style) {
// IE8 及以下版本
(style as any).styleSheet.cssText = css;
}

// 将 <style> 标签插入到文档的 <head> 中
document.head.appendChild(style);

// 保存 <style> 标签的引用
styleRef.current = style;

// 清理函数,确保在组件卸载时移除 <style> 标签
return () => {
if (styleRef.current) {
document.head.removeChild(styleRef.current);
styleRef.current = null;
}
};
}, [css, id]);
}
2 changes: 2 additions & 0 deletions packages/studio-components/src/index.tsx
Original file line number Diff line number Diff line change
@@ -33,3 +33,5 @@ export { useCustomToken } from './Provider/useCustomToken';
export type { SegmentedTabsProps } from './SegmentedTabs';
export type { Property } from './PropertiesList/typing';
export type { ParsedFile } from './Utils/parseCSV';

export { useDynamicStyle } from './hooks/useDynamicStyle';
2 changes: 1 addition & 1 deletion packages/studio-draw-pattern/package.json
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
"module": "dist/esm/index.js",
"types": "dist/esm/index.d.ts",
"scripts": {
"dev": "father dev",
"start": "father dev",
"build": "father build",
"build:deps": "father prebundle",
"prepublishOnly": "father doctor && npm run build",
4 changes: 4 additions & 0 deletions packages/studio-graph-editor/.fatherrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default {
esm: { output: 'es' },
cjs: { output: 'lib' },
};
12 changes: 7 additions & 5 deletions packages/studio-graph-editor/package.json
Original file line number Diff line number Diff line change
@@ -2,9 +2,9 @@
"name": "@graphscope/studio-graph-editor",
"version": "0.1.1",
"description": "",
"main": "./src/index.tsx",
"module": "./src/index.tsx",
"types": "./dist/index.d.ts",
"main": "lib/index.js",
"module": "es/index.js",
"types": "lib/index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/GraphScope/portal.git"
@@ -19,8 +19,10 @@
"registry": "https://registry.npmjs.org/"
},
"scripts": {
"start": "vite dev",
"build": "vite build && tsc"
"start": "father dev",
"build": "father build",
"start:site": "vite dev",
"build:site": "vite build && tsc"
},
"peerDependencies": {
"react": "18.2.0",
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import { Toolbar } from '@graphscope/studio-components';
import 'reactflow/dist/style.css';
import ClearCanvas from './clear-canvas';
import AddNode from './add-node';

2 changes: 1 addition & 1 deletion packages/studio-graph-editor/src/canvas/index.tsx
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ import ButtonController from '../button-controller';
import useInteractive from './useInteractive';
import { FormattedMessage } from 'react-intl';
import { useGraphContext } from '..';
import 'reactflow/dist/style.css';
// import 'reactflow/dist/style.css';
import { useContext } from './useContext';

interface ISchemaGraphProps {
2 changes: 1 addition & 1 deletion packages/studio-graph-editor/src/index.tsx
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ import * as React from 'react';
import { MultipleInstance, Utils } from '@graphscope/studio-components';
import Canvas from './canvas';
import { ReactFlowProvider } from 'reactflow';
import 'reactflow/dist/style.css';
// import 'reactflow/dist/style.css';
import { IntlProvider } from 'react-intl';
import locales from './locales';
import { ISchemaNode } from './types/node';
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { Divider } from 'antd';
import { Toolbar, useCustomToken } from '@graphscope/studio-components';
import 'reactflow/dist/style.css';

import RightButton from './right-button';
import ClearCanvas from './clear-canvas';
import AddNode from './add-node';
7 changes: 5 additions & 2 deletions packages/studio-importor/src/app/index.tsx
Original file line number Diff line number Diff line change
@@ -3,8 +3,9 @@ import GraphCanvas from './graph-canvas';
import PropertiesEditor from './properties-editor';
import { Spin } from 'antd';
import { ReactFlowProvider } from 'reactflow';
import { Section, StudioProvier, GlobalSpin } from '@graphscope/studio-components';
import 'reactflow/dist/style.css';
import { Section, StudioProvier, GlobalSpin, useDynamicStyle } from '@graphscope/studio-components';
// import 'reactflow/dist/style.css';
import cssStyles from './style';
import { transformGraphNodes, transformEdges } from './elements/index';

import ButtonController from './button-controller';
@@ -50,6 +51,8 @@ const ImportApp: React.FunctionComponent<ImportorProps> = props => {
const { store, updateStore } = useContext();
const { isReady, displayMode } = store;

useDynamicStyle(cssStyles, 'graphscope-importor');

useEffect(() => {
(async () => {
let schema: ISchemaOptions = { nodes: [], edges: [] };
410 changes: 410 additions & 0 deletions packages/studio-importor/src/app/style.tsx

Large diffs are not rendered by default.

18 changes: 0 additions & 18 deletions packages/studio-query/src/components/cypher-editor/index.css

This file was deleted.

25 changes: 23 additions & 2 deletions packages/studio-query/src/components/cypher-editor/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { forwardRef, useEffect } from 'react';
import { useStudioProvier } from '@graphscope/studio-components';
import './index.css';
import { useStudioProvier, useDynamicStyle } from '@graphscope/studio-components';
import { editor, languages } from 'monaco-editor';
import 'monaco-editor/esm/vs/basic-languages/cypher/cypher.contribution';
import { registerGremlinLanguage } from '../basic-languages-gremlin/index';
@@ -55,7 +54,29 @@ interface IEditor extends CypherEditorProps {
onCreated?: (val: editor.IStandaloneCodeEditor) => void;
onChange?: (val: string) => void;
}
const cypherEditorStyle = `
.monaco-editor .view-overlays .current-line {
background-color: transparent !important;
}
.monaco-editor .monaco-scrollable-element::-webkit-scrollbar {
display: none;
}
.decorationsOverviewRuler {
display: none !important;
}
.monaco-editor .view-overlays .current-line-exact {
border: none !important;
}
.monaco-editor .scroll-decoration {
box-shadow: none;
}
`;
const Editor = forwardRef((props: IEditor, editorRef: any) => {
useDynamicStyle(cypherEditorStyle, 'cypher-editor-style');
const { value, language = 'cypher', maxRows = 10, minRows = 1, onChangeContent, clear, onInit } = props;
let codeEditor: editor.IStandaloneCodeEditor;
const MAGIC_NUMBER = onChangeContent ? 0 : countLines(value);
6 changes: 4 additions & 2 deletions packages/studio-website/package.json
Original file line number Diff line number Diff line change
@@ -12,7 +12,9 @@
"scripts": {
"build": "father build",
"start": "vite dev",
"build:site": "vite build",
"copyHtml": "cp -f dist/index.html ../../docs/portal/public/portal.html",
"build:site:single": "vite build --mode=single && npm run copyHtml",
"build:site": "vite build && npm run copyHtml",
"prepublishOnly": "npm run build"
},
"publishConfig": {
@@ -26,14 +28,14 @@
"@fortawesome/free-regular-svg-icons": "latest",
"@fortawesome/free-solid-svg-icons": "latest",
"@fortawesome/react-fontawesome": "latest",
"@graphscope/use-zustand": "workspace:*",
"@graphscope/studio-components": "workspace:*",
"@graphscope/studio-driver": "workspace:*",
"@graphscope/studio-explore": "workspace:*",
"@graphscope/studio-graph": "workspace:*",
"@graphscope/studio-importor": "workspace:*",
"@graphscope/studio-query": "workspace:*",
"@graphscope/studio-server": "workspace:*",
"@graphscope/use-zustand": "workspace:*",
"@uiw/react-codemirror": "^4.21.21",
"antd": "^5.17.0",
"js-yaml": "^4.1.0",
60 changes: 0 additions & 60 deletions packages/studio-website/src/layouts/index.css

This file was deleted.

4 changes: 2 additions & 2 deletions packages/studio-website/src/layouts/index.tsx
Original file line number Diff line number Diff line change
@@ -4,10 +4,10 @@ import { useContext, IGraph } from './useContext';
import { Layout, LogoText, Utils, useCustomToken, GlobalSpin } from '@graphscope/studio-components';
import { DeploymentApiFactory } from '@graphscope/studio-server';
import { SIDE_MENU, SETTING_MENU } from './const';
import { Flex, Spin, notification } from 'antd';
import { notification } from 'antd';
import { listGraphs } from '../pages/instance/lists/service';
import { SLOTS } from '../slots';
import './index.css';

export default function StudioLayout() {
const { store, updateStore } = useContext();
const { graphId, draftId } = store;
21 changes: 19 additions & 2 deletions packages/studio-website/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

import { viteSingleFile } from 'vite-plugin-singlefile';
import dotenv from 'dotenv';

// 获取传递的参数
const args = process.argv.slice(2);

// 解析参数
const params = {};
args.forEach(arg => {
const [key, value] = arg.split('=');
params[key.slice(2)] = value;
});
//@ts-ignore
const { mode } = params;
const isSingle = mode === 'single' && process.env.NODE_ENV === 'production';

console.log('params', params, args);

const plugins = isSingle ? [react(), viteSingleFile()] : [react()];

const { parsed } = dotenv.configDotenv();

const { COORDINATOR_URL } = parsed || {};
@@ -27,5 +44,5 @@ export default defineConfig({
external: ['node:os', 'fsevents'], // 要排除的模块
},
},
plugins: [react()],
plugins,
});
1 change: 1 addition & 0 deletions python/graphy/requirements.txt
Original file line number Diff line number Diff line change
@@ -41,4 +41,5 @@ torchtext==0.18.0
transformers>=4.41
webdriver-manager>=4.0
Werkzeug>=3.0.3
socksio>=1.0.0

13 changes: 11 additions & 2 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
{
"buildCommand": "npm run ci",
"buildCommand": "npm run build:docs",
"framework": null,
"headers": [
{
"source": "/(.*)",
"headers": [
{ "key": "Cross-Origin-Opener-Policy", "value": "same-origin" },
{ "key": "Cross-Origin-Embedder-Policy", "value": "require-corp" }
]
}
],
"rewrites": [
{
"source": "/api/(.*)",
"destination": "https://virtserver.swaggerhub.com/GRAPHSCOPE/flex-api/1.0.0/api/$1"
"destination": "http://127.0.0.1:8080/api/$1"
},
{ "source": "/(.*)", "destination": "/index.html" }
]

0 comments on commit 2b0fe47

Please sign in to comment.