feat: add code graph feature with interactive visualization

- Implemented CodeGraphView component for visualizing project file structure using Sigma.js.
- Added NodeSearchBox for searching nodes within the graph.
- Created API module to fetch file data from backend.
- Developed graph building logic to construct a tree structure from file data.
- Integrated new routes and updated route tree to include the code graph page.
- Updated Vite configuration to load environment variables and changed server port.
- Added example data for testing the code graph functionality.
This commit is contained in:
xiongxiao
2026-03-13 22:01:14 +08:00
committed by cnb
parent 3e54f994fd
commit fa11796aef
15 changed files with 1457 additions and 17 deletions

View File

@@ -4,18 +4,20 @@ import path from 'path';
import pkgs from './package.json';
import tailwindcss from '@tailwindcss/vite';
import { tanstackRouter } from '@tanstack/router-plugin/vite'
import 'dotenv/config';
import dotenv from 'dotenv';
const config = dotenv.config().parsed || {};
console.log('Loaded .env config:', config);
const isDev = process.env.NODE_ENV === 'development';
const basename = isDev ? '/' : pkgs?.basename || '/';
let target = process.env.VITE_API_URL || 'http://localhost:51515';
let target = config.VITE_API_URL || 'http://localhost:51515';
const apiProxy = { target: target, changeOrigin: true, ws: true, rewriteWsOrigin: true, secure: false, cookieDomainRewrite: 'localhost' };
let proxy = {
'/root/': apiProxy,
'/api': apiProxy,
'/client': apiProxy,
};
console.log('API Proxy Target:', target);
/**
* @see https://vitejs.dev/config/
*/
@@ -39,7 +41,7 @@ export default defineConfig({
BASE_NAME: JSON.stringify(basename),
},
server: {
port: 7008,
port: 7009,
host: '0.0.0.0',
allowedHosts: true,
proxy,