first commit

This commit is contained in:
2026-05-02 17:40:07 +08:00
commit 664fec7485
20 changed files with 7271 additions and 0 deletions

9
WebSite/.env.example Normal file
View File

@@ -0,0 +1,9 @@
# GEMINI_API_KEY: Required for Gemini AI API calls.
# AI Studio automatically injects this at runtime from user secrets.
# Users configure this via the Secrets panel in the AI Studio UI.
GEMINI_API_KEY="MY_GEMINI_API_KEY"
# APP_URL: The URL where this applet is hosted.
# AI Studio automatically injects this at runtime with the Cloud Run service URL.
# Used for self-referential links, OAuth callbacks, and API endpoints.
APP_URL="MY_APP_URL"

8
WebSite/.gitignore vendored Normal file
View File

@@ -0,0 +1,8 @@
node_modules/
build/
dist/
coverage/
.DS_Store
*.log
.env*
!.env.example

41
WebSite/README.md Normal file
View File

@@ -0,0 +1,41 @@
<div align="center">
<img width="1200" height="475" alt="GHBanner" src="https://github.com/user-attachments/assets/0aa67016-6eaf-458a-adb2-6e31a0763ed6" />
</div>
# Run and deploy your AI Studio app
This contains everything you need to run your app locally.
View your app in AI Studio: https://ai.studio/apps/b9650cf9-3b26-4e84-a699-78ba380bb4db
## Run Locally
**Prerequisites:** Node.js, Python 3.8+
1. Install Python dependencies in the project root:
`pip install -r ../requirements.txt`
2. Install website dependencies:
`npm install`
3. Start the local Python backend:
`npm run backend`
4. In another terminal, run the website:
`npm run dev`
The website talks to `http://127.0.0.1:8787` and maps UI actions to:
- `head_extension_app.py`: preview and four-state DICOM deformation output
- `generate_head_extension_video.py`: 0° to target-angle MP4 generation
- `video_generator_app.py`: kept as the desktop GUI wrapper for the same video generator
## Data Flow
The Image Library is now the source of DICOM data for the workstation:
1. Open `数据影像库`.
2. Click `上传文件夹` to choose a folder that contains `.dcm` files, or click `上传压缩包` to upload a `.zip` archive containing `.dcm` files.
3. Click `调阅工作站` on a library item.
4. The `影像变换工作站` will run preview, four-state deformation, and video generation from that selected library dataset.
5. Four-state deformation results are packaged by the backend as a downloadable `.zip` file under `../web_results/`.
6. Generated videos are also written under `../web_results/` and exposed as downloadable `.mp4` files.
Uploaded DICOM datasets are stored by the local backend under `../web_library/`.

13
WebSite/index.html Normal file
View File

@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>My Google AI Studio App</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>

6
WebSite/metadata.json Normal file
View File

@@ -0,0 +1,6 @@
{
"name": "",
"description": "",
"requestFramePermissions": [],
"majorCapabilities": []
}

4320
WebSite/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

35
WebSite/package.json Normal file
View File

@@ -0,0 +1,35 @@
{
"name": "react-example",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite --port=3000 --host=0.0.0.0",
"backend": "python ../web_backend.py",
"build": "vite build",
"preview": "vite preview",
"clean": "rm -rf dist",
"lint": "tsc --noEmit"
},
"dependencies": {
"@google/genai": "^1.29.0",
"@tailwindcss/vite": "^4.1.14",
"@vitejs/plugin-react": "^5.0.4",
"lucide-react": "^0.546.0",
"react": "^19.0.1",
"react-dom": "^19.0.1",
"vite": "^6.2.3",
"express": "^4.21.2",
"dotenv": "^17.2.3",
"motion": "^12.23.24"
},
"devDependencies": {
"@types/node": "^22.14.0",
"autoprefixer": "^10.4.21",
"tailwindcss": "^4.1.14",
"tsx": "^4.21.0",
"typescript": "~5.8.2",
"vite": "^6.2.3",
"@types/express": "^4.17.21"
}
}

1048
WebSite/src/App.tsx Normal file

File diff suppressed because it is too large Load Diff

1
WebSite/src/index.css Normal file
View File

@@ -0,0 +1 @@
@import "tailwindcss";

10
WebSite/src/main.tsx Normal file
View File

@@ -0,0 +1,10 @@
import {StrictMode} from 'react';
import {createRoot} from 'react-dom/client';
import App from './App.tsx';
import './index.css';
createRoot(document.getElementById('root')!).render(
<StrictMode>
<App />
</StrictMode>,
);

26
WebSite/tsconfig.json Normal file
View File

@@ -0,0 +1,26 @@
{
"compilerOptions": {
"target": "ES2022",
"experimentalDecorators": true,
"useDefineForClassFields": false,
"module": "ESNext",
"lib": [
"ES2022",
"DOM",
"DOM.Iterable"
],
"skipLibCheck": true,
"moduleResolution": "bundler",
"isolatedModules": true,
"moduleDetection": "force",
"allowJs": true,
"jsx": "react-jsx",
"paths": {
"@/*": [
"./*"
]
},
"allowImportingTsExtensions": true,
"noEmit": true
}
}

24
WebSite/vite.config.ts Normal file
View File

@@ -0,0 +1,24 @@
import tailwindcss from '@tailwindcss/vite';
import react from '@vitejs/plugin-react';
import path from 'path';
import {defineConfig, loadEnv} from 'vite';
export default defineConfig(({mode}) => {
const env = loadEnv(mode, '.', '');
return {
plugins: [react(), tailwindcss()],
define: {
'process.env.GEMINI_API_KEY': JSON.stringify(env.GEMINI_API_KEY),
},
resolve: {
alias: {
'@': path.resolve(__dirname, '.'),
},
},
server: {
// HMR is disabled in AI Studio via DISABLE_HMR env var.
// Do not modify—file watching is disabled to prevent flickering during agent edits.
hmr: process.env.DISABLE_HMR !== 'true',
},
};
});