feat: db test

This commit is contained in:
mozzie 2024-08-12 17:01:49 +08:00
parent f6329ff1f7
commit e0d787d65f
14 changed files with 275 additions and 76 deletions

View File

@ -4,7 +4,7 @@ import { spawn, ChildProcess } from "node:child_process";
import { BrowserWindow } from "electron";
class PythonManager {
private flaskProcess: ChildProcess | null = null;
public flaskProcess: ChildProcess | null = null;
private intervalId: NodeJS.Timeout | null = null;
constructor(
@ -17,6 +17,7 @@ class PythonManager {
public startFlask() {
if (this.flaskProcess) {
console.log("Flask service is already running.");
this.mainWindow?.webContents.send("flask", { running: true });
return;
}
@ -34,14 +35,14 @@ class PythonManager {
this.flaskProcess.stderr?.on("data", (data) => {
const message = data.toString();
console.error(`Flask stderr: ${message}`);
this.mainWindow?.webContents.send("flask", { stderr: message });
this.mainWindow?.webContents.send("flask-service:response", { stderr: message });
});
// 监听进程关闭事件
this.flaskProcess.on("close", (code) => {
console.log(`Flask process exited with code ${code}`);
this.flaskProcess = null;
this.mainWindow?.webContents.send("flask", { exited: true, code });
this.mainWindow?.webContents.send("flask-service:response", { exited: true, code });
});
// 开始轮询服务状态

6
electron/core/db.ts Normal file
View File

@ -0,0 +1,6 @@
import path from "node:path";
// const db = await JSONFilePreset("db.json", { posts: [] });
// const post = { id: 1, title: "lowdb is awesome", views: 100 };
// await db.update(({ posts }) => posts.push(post));

View File

@ -44,7 +44,6 @@ const registerIpcMainHandlers = (
ipcMain.on("python-service", (event, data) => {
const { running } = data;
console.log("执行调用");
running ? pythonManager.startFlask() : pythonManager.stopFlask();
});
};

View File

@ -11,6 +11,7 @@ import { fileURLToPath } from "node:url";
import path from "node:path";
import registerIpcMainHandlers from "./ipcMainHandlers";
import PythonManager from "./core/PythonManager";
import "./core/db";
const require = createRequire(import.meta.url);
const __dirname = path.dirname(fileURLToPath(import.meta.url));
@ -126,7 +127,7 @@ app.on("activate", () => {
});
app.on("before-quit", () => {
pythonManager?.stopFlask();
if (pythonManager?.flaskProcess) pythonManager?.stopFlask();
});
app.whenReady().then(() => {

View File

@ -22,6 +22,7 @@
"@types/react-icons": "^3.0.0",
"@xenova/transformers": "^2.17.2",
"antd": "^5.20.0",
"better-sqlite3": "^11.1.2",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"cmdk": "^1.0.0",
@ -30,6 +31,7 @@
"dexie": "^4.0.8",
"dicom-parser": "1.8.21",
"dockview": "^1.15.2",
"electron-store": "^10.0.0",
"flexlayout-react": "^0.7.15",
"framer-motion": "^11.3.24",
"lucide-react": "^0.408.0",

View File

@ -13,7 +13,7 @@ importers:
version: 5.4.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
'@google-cloud/spanner':
specifier: ^7.12.0
version: 7.13.0
version: 7.13.0(encoding@0.1.13)
'@radix-ui/react-dialog':
specifier: ^1.1.1
version: 1.1.1(@types/react-dom@18.3.0)(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
@ -41,6 +41,9 @@ importers:
antd:
specifier: ^5.20.0
version: 5.20.0(date-fns@3.6.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
better-sqlite3:
specifier: ^11.1.2
version: 11.1.2
class-variance-authority:
specifier: ^0.7.0
version: 0.7.0
@ -65,6 +68,9 @@ importers:
dockview:
specifier: ^1.15.2
version: 1.15.3
electron-store:
specifier: ^10.0.0
version: 10.0.0
flexlayout-react:
specifier: ^0.7.15
version: 0.7.15(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
@ -1464,6 +1470,14 @@ packages:
resolution: {integrity: sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==}
engines: {node: '>= 14'}
ajv-formats@3.0.1:
resolution: {integrity: sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==}
peerDependencies:
ajv: ^8.0.0
peerDependenciesMeta:
ajv:
optional: true
ajv-keywords@3.5.2:
resolution: {integrity: sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==}
peerDependencies:
@ -1472,6 +1486,9 @@ packages:
ajv@6.12.6:
resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==}
ajv@8.17.1:
resolution: {integrity: sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==}
ansi-regex@5.0.1:
resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==}
engines: {node: '>=8'}
@ -1576,6 +1593,9 @@ packages:
resolution: {integrity: sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==}
engines: {node: '>= 4.0.0'}
atomically@2.0.3:
resolution: {integrity: sha512-kU6FmrwZ3Lx7/7y3hPS5QnbJfaohcIul5fGqf7ok+4KklIEk9tJ0C2IQPdacSbVUWv6zVHXEBWoWd6NrVMT7Cw==}
autoprefixer@10.4.20:
resolution: {integrity: sha512-XY25y5xSv/wEoqzDyXXME4AFfkZI0P23z6Fs3YgymDnKJkCGOnkL0iTxCa85UTqaSgfcqyf3UA6+c7wUvx/16g==}
engines: {node: ^10 || ^12 || >=14}
@ -1607,6 +1627,9 @@ packages:
base64-js@1.5.1:
resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==}
better-sqlite3@11.1.2:
resolution: {integrity: sha512-gujtFwavWU4MSPT+h9B+4pkvZdyOUkH54zgLdIrMmmmd4ZqiBIrRNBzNzYVFO417xo882uP5HBu4GjOfaSrIQw==}
big.js@6.2.1:
resolution: {integrity: sha512-bCtHMwL9LeDIozFn+oNhhFoq+yQ3BNdnsLSASUxLciOb1vgvpHsIO1dsENiGMgbb4SkP5TrzWzRiLddn8ahVOQ==}
@ -1617,6 +1640,9 @@ packages:
resolution: {integrity: sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==}
engines: {node: '>=8'}
bindings@1.5.0:
resolution: {integrity: sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==}
bl@4.1.0:
resolution: {integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==}
@ -1802,6 +1828,10 @@ packages:
concat-map@0.0.1:
resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==}
conf@13.0.1:
resolution: {integrity: sha512-l9Uwc9eOnz39oADzGO2cSBDi7siv8lwO+31ocQ2nOJijnDiW3pxqm9VV10DPYUO28wW83DjABoUqY1nfHRR2hQ==}
engines: {node: '>=18'}
config-file-ts@0.2.6:
resolution: {integrity: sha512-6boGVaglwblBgJqGyxm4+xCmEGcWgnWHSWHY5jad58awQhB6gftq0G8HbzU39YqCIYHMLAiL1yjwiZ36m/CL8w==}
@ -1852,6 +1882,10 @@ packages:
dayjs@1.11.12:
resolution: {integrity: sha512-Rt2g+nTbLlDWZTwwrIXjy9MeiZmSDI375FvZs72ngxx8PDC6YXOeR3q5LAuPzjZQxhiWdRKac7RKV+YyQYfYIg==}
debounce-fn@6.0.0:
resolution: {integrity: sha512-rBMW+F2TXryBwB54Q0d8drNEI+TfoS9JpNTAoVpukbWEhjXQq4rySFYLaqXMFXwdv61Zb2OHtj5bviSoimqxRQ==}
engines: {node: '>=18'}
debug@4.3.6:
resolution: {integrity: sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==}
engines: {node: '>=6.0'}
@ -1936,6 +1970,10 @@ packages:
resolution: {integrity: sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==}
engines: {node: '>=6.0.0'}
dot-prop@9.0.0:
resolution: {integrity: sha512-1gxPBJpI/pcjQhKgIU91II6Wkay+dLcN3M6rf2uwP8hRur3HtQXjVrdAK3sjC0piaEuxzMwjXChcETiJl47lAQ==}
engines: {node: '>=18'}
dotenv-expand@5.1.0:
resolution: {integrity: sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA==}
@ -1971,6 +2009,10 @@ packages:
electron-publish@24.13.1:
resolution: {integrity: sha512-2ZgdEqJ8e9D17Hwp5LEq5mLQPjqU3lv/IALvgp+4W8VeNhryfGhYEQC/PgDPMrnWUp+l60Ou5SJLsu+k4mhQ8A==}
electron-store@10.0.0:
resolution: {integrity: sha512-BU/QZh+5twHBprRdLu3YZX/rIarmZzhTNpJvAvqG1/yN0mNCrsMh0kl7bM4xaUKDNRiHz1r7wP/7Prjh7cleIw==}
engines: {node: '>=20'}
electron-to-chromium@1.5.5:
resolution: {integrity: sha512-QR7/A7ZkMS8tZuoftC/jfqNkZLQO779SSW3YuZHP4eXpj3EffGLFcB/Xu9AAZQzLccTiCV+EmUo3ha4mQ9wnlA==}
@ -1985,6 +2027,9 @@ packages:
emoji-regex@9.2.2:
resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==}
encoding@0.1.13:
resolution: {integrity: sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==}
end-of-stream@1.4.4:
resolution: {integrity: sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==}
@ -1992,6 +2037,10 @@ packages:
resolution: {integrity: sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==}
engines: {node: '>=6'}
env-paths@3.0.0:
resolution: {integrity: sha512-dtJUTepzMW3Lm/NPxRf3wP4642UWhjL2sQxc+ym2YMj1m/H2zDNQOlezafzkHwn6sMstjHTwG6iQQsctDW/b1A==}
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
err-code@2.0.3:
resolution: {integrity: sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==}
@ -2112,6 +2161,9 @@ packages:
fast-levenshtein@2.0.6:
resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==}
fast-uri@3.0.1:
resolution: {integrity: sha512-MWipKbbYiYI0UC7cl8m/i/IWTqfC8YXsqjzybjddLsFjStroQzsHXkc73JutMvBiXmOvapk+axIl79ig5t55Bw==}
fastq@1.17.1:
resolution: {integrity: sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==}
@ -2122,6 +2174,9 @@ packages:
resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==}
engines: {node: ^10.12.0 || >=12.0.0}
file-uri-to-path@1.0.0:
resolution: {integrity: sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==}
filelist@1.0.4:
resolution: {integrity: sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==}
@ -2503,6 +2558,12 @@ packages:
json-schema-traverse@0.4.1:
resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==}
json-schema-traverse@1.0.0:
resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==}
json-schema-typed@8.0.1:
resolution: {integrity: sha512-XQmWYj2Sm4kn4WeTYvmpKEbyPsL7nBsb647c7pMe6l02/yx2+Jfc4dT6UZkEXnIUb5LhD55r2HPsJ1milQ4rDg==}
json-stable-stringify-without-jsonify@1.0.1:
resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==}
@ -2642,6 +2703,10 @@ packages:
engines: {node: '>=4.0.0'}
hasBin: true
mimic-function@5.0.1:
resolution: {integrity: sha512-VP79XUPxV2CigYP3jWwAUFSku2aKqBH7uTAapFWCBqutsbmDo96KY5o8uh6U+/YSIn5OxJnXp73beVkpqMIGhA==}
engines: {node: '>=18'}
mimic-response@1.0.1:
resolution: {integrity: sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==}
engines: {node: '>=4'}
@ -3337,6 +3402,10 @@ packages:
resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==}
engines: {node: '>=0.10.0'}
require-from-string@2.0.2:
resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==}
engines: {node: '>=0.10.0'}
resize-observer-polyfill@1.5.1:
resolution: {integrity: sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==}
@ -3534,6 +3603,9 @@ packages:
resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==}
engines: {node: '>=8'}
stubborn-fs@1.2.5:
resolution: {integrity: sha512-H2N9c26eXjzL/S/K+i/RHHcFanE74dptvvjM8iwzwbVcWY/zjBbgRqF3K0DY4+OD+uTTASTBvDoxPDaPN02D7g==}
stubs@3.0.0:
resolution: {integrity: sha512-PdHt7hHUJKxvTCgbKX9C1V/ftOcjJQgz8BZwNfV5c4B6dcGqlpelTbJ999jBGZ2jYiPAwcX5dP6oBwVlBlUbxw==}
@ -3676,11 +3748,19 @@ packages:
resolution: {integrity: sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==}
engines: {node: '>=10'}
type-fest@4.24.0:
resolution: {integrity: sha512-spAaHzc6qre0TlZQQ2aA/nGMe+2Z/wyGk5Z+Ru2VUfdNwT6kWO6TjevOlpebsATEG1EIQ2sOiDszud3lO5mt/Q==}
engines: {node: '>=16'}
typescript@5.5.4:
resolution: {integrity: sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==}
engines: {node: '>=14.17'}
hasBin: true
uint8array-extras@1.4.0:
resolution: {integrity: sha512-ZPtzy0hu4cZjv3z5NW9gfKnNLjoz4y6uv4HlelAjDK7sY/xOkKZv9xK/WQpcsBB3jEybChz9DPC2U/+cusjJVQ==}
engines: {node: '>=18'}
undici-types@5.26.5:
resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==}
@ -3790,6 +3870,9 @@ packages:
whatwg-url@5.0.0:
resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==}
when-exit@2.1.3:
resolution: {integrity: sha512-uVieSTccFIr/SFQdFWN/fFaQYmV37OKtuaGphMAzi4DmmUlrvRBJW5WSLkHyjNQY/ePJMz3LoiX9R3yy1Su6Hw==}
which@2.0.2:
resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==}
engines: {node: '>= 8'}
@ -4215,17 +4298,17 @@ snapshots:
'@floating-ui/utils@0.2.7': {}
'@google-cloud/common@5.0.2':
'@google-cloud/common@5.0.2(encoding@0.1.13)':
dependencies:
'@google-cloud/projectify': 4.0.0
'@google-cloud/promisify': 4.0.0
arrify: 2.0.1
duplexify: 4.1.3
extend: 3.0.2
google-auth-library: 9.13.0
google-auth-library: 9.13.0(encoding@0.1.13)
html-entities: 2.5.2
retry-request: 7.0.2
teeny-request: 9.0.0
retry-request: 7.0.2(encoding@0.1.13)
teeny-request: 9.0.0(encoding@0.1.13)
transitivePeerDependencies:
- encoding
- supports-color
@ -4236,9 +4319,9 @@ snapshots:
'@google-cloud/promisify@4.0.0': {}
'@google-cloud/spanner@7.13.0':
'@google-cloud/spanner@7.13.0(encoding@0.1.13)':
dependencies:
'@google-cloud/common': 5.0.2
'@google-cloud/common': 5.0.2(encoding@0.1.13)
'@google-cloud/precise-date': 4.0.0
'@google-cloud/projectify': 4.0.0
'@google-cloud/promisify': 4.0.0
@ -4251,19 +4334,19 @@ snapshots:
duplexify: 4.1.3
events-intercept: 2.0.0
extend: 3.0.2
google-auth-library: 9.13.0
google-gax: 4.3.8
google-auth-library: 9.13.0(encoding@0.1.13)
google-gax: 4.3.8(encoding@0.1.13)
grpc-gcp: 1.0.1
is: 3.3.0
lodash.snakecase: 4.1.1
merge-stream: 2.0.0
p-queue: 6.6.2
protobufjs: 7.3.2
retry-request: 7.0.2
retry-request: 7.0.2(encoding@0.1.13)
split-array-stream: 2.0.0
stack-trace: 0.0.10
stream-events: 1.0.5
teeny-request: 9.0.0
teeny-request: 9.0.0(encoding@0.1.13)
through2: 4.0.2
transitivePeerDependencies:
- encoding
@ -5216,6 +5299,10 @@ snapshots:
transitivePeerDependencies:
- supports-color
ajv-formats@3.0.1(ajv@8.17.1):
optionalDependencies:
ajv: 8.17.1
ajv-keywords@3.5.2(ajv@6.12.6):
dependencies:
ajv: 6.12.6
@ -5227,6 +5314,13 @@ snapshots:
json-schema-traverse: 0.4.1
uri-js: 4.4.1
ajv@8.17.1:
dependencies:
fast-deep-equal: 3.1.3
fast-uri: 3.0.1
json-schema-traverse: 1.0.0
require-from-string: 2.0.2
ansi-regex@5.0.1: {}
ansi-regex@6.0.1: {}
@ -5308,7 +5402,7 @@ snapshots:
app-builder-bin@4.0.0: {}
app-builder-lib@24.13.3(dmg-builder@24.13.3(electron-builder-squirrel-windows@24.13.3))(electron-builder-squirrel-windows@24.13.3(dmg-builder@24.13.3)):
app-builder-lib@24.13.3(dmg-builder@24.13.3(electron-builder-squirrel-windows@24.13.3(dmg-builder@24.13.3)))(electron-builder-squirrel-windows@24.13.3(dmg-builder@24.13.3)):
dependencies:
'@develar/schema-utils': 2.6.5
'@electron/notarize': 2.2.1
@ -5322,7 +5416,7 @@ snapshots:
builder-util-runtime: 9.2.4
chromium-pickle-js: 0.2.0
debug: 4.3.6
dmg-builder: 24.13.3(electron-builder-squirrel-windows@24.13.3)
dmg-builder: 24.13.3(electron-builder-squirrel-windows@24.13.3(dmg-builder@24.13.3))
ejs: 3.1.10
electron-builder-squirrel-windows: 24.13.3(dmg-builder@24.13.3)
electron-publish: 24.13.1
@ -5412,6 +5506,11 @@ snapshots:
at-least-node@1.0.0: {}
atomically@2.0.3:
dependencies:
stubborn-fs: 1.2.5
when-exit: 2.1.3
autoprefixer@10.4.20(postcss@8.4.41):
dependencies:
browserslist: 4.23.3
@ -5451,12 +5550,21 @@ snapshots:
base64-js@1.5.1: {}
better-sqlite3@11.1.2:
dependencies:
bindings: 1.5.0
prebuild-install: 7.1.2
big.js@6.2.1: {}
bignumber.js@9.1.2: {}
binary-extensions@2.3.0: {}
bindings@1.5.0:
dependencies:
file-uri-to-path: 1.0.0
bl@4.1.0:
dependencies:
buffer: 5.7.1
@ -5677,6 +5785,18 @@ snapshots:
concat-map@0.0.1: {}
conf@13.0.1:
dependencies:
ajv: 8.17.1
ajv-formats: 3.0.1(ajv@8.17.1)
atomically: 2.0.3
debounce-fn: 6.0.0
dot-prop: 9.0.0
env-paths: 3.0.0
json-schema-typed: 8.0.1
semver: 7.6.3
uint8array-extras: 1.4.0
config-file-ts@0.2.6:
dependencies:
glob: 10.4.5
@ -5723,6 +5843,10 @@ snapshots:
dayjs@1.11.12: {}
debounce-fn@6.0.0:
dependencies:
mimic-function: 5.0.1
debug@4.3.6:
dependencies:
ms: 2.1.2
@ -5777,9 +5901,9 @@ snapshots:
dlv@1.1.3: {}
dmg-builder@24.13.3(electron-builder-squirrel-windows@24.13.3):
dmg-builder@24.13.3(electron-builder-squirrel-windows@24.13.3(dmg-builder@24.13.3)):
dependencies:
app-builder-lib: 24.13.3(dmg-builder@24.13.3(electron-builder-squirrel-windows@24.13.3))(electron-builder-squirrel-windows@24.13.3(dmg-builder@24.13.3))
app-builder-lib: 24.13.3(dmg-builder@24.13.3(electron-builder-squirrel-windows@24.13.3(dmg-builder@24.13.3)))(electron-builder-squirrel-windows@24.13.3(dmg-builder@24.13.3))
builder-util: 24.13.1
builder-util-runtime: 9.2.4
fs-extra: 10.1.0
@ -5813,6 +5937,10 @@ snapshots:
dependencies:
esutils: 2.0.3
dot-prop@9.0.0:
dependencies:
type-fest: 4.24.0
dotenv-expand@5.1.0: {}
dotenv@9.0.2: {}
@ -5843,7 +5971,7 @@ snapshots:
electron-builder-squirrel-windows@24.13.3(dmg-builder@24.13.3):
dependencies:
app-builder-lib: 24.13.3(dmg-builder@24.13.3(electron-builder-squirrel-windows@24.13.3))(electron-builder-squirrel-windows@24.13.3(dmg-builder@24.13.3))
app-builder-lib: 24.13.3(dmg-builder@24.13.3(electron-builder-squirrel-windows@24.13.3(dmg-builder@24.13.3)))(electron-builder-squirrel-windows@24.13.3(dmg-builder@24.13.3))
archiver: 5.3.2
builder-util: 24.13.1
fs-extra: 10.1.0
@ -5853,11 +5981,11 @@ snapshots:
electron-builder@24.13.3(electron-builder-squirrel-windows@24.13.3(dmg-builder@24.13.3)):
dependencies:
app-builder-lib: 24.13.3(dmg-builder@24.13.3(electron-builder-squirrel-windows@24.13.3))(electron-builder-squirrel-windows@24.13.3(dmg-builder@24.13.3))
app-builder-lib: 24.13.3(dmg-builder@24.13.3(electron-builder-squirrel-windows@24.13.3(dmg-builder@24.13.3)))(electron-builder-squirrel-windows@24.13.3(dmg-builder@24.13.3))
builder-util: 24.13.1
builder-util-runtime: 9.2.4
chalk: 4.1.2
dmg-builder: 24.13.3(electron-builder-squirrel-windows@24.13.3)
dmg-builder: 24.13.3(electron-builder-squirrel-windows@24.13.3(dmg-builder@24.13.3))
fs-extra: 10.1.0
is-ci: 3.0.1
lazy-val: 1.0.5
@ -5880,6 +6008,11 @@ snapshots:
transitivePeerDependencies:
- supports-color
electron-store@10.0.0:
dependencies:
conf: 13.0.1
type-fest: 4.24.0
electron-to-chromium@1.5.5: {}
electron@30.3.1:
@ -5894,12 +6027,19 @@ snapshots:
emoji-regex@9.2.2: {}
encoding@0.1.13:
dependencies:
iconv-lite: 0.6.3
optional: true
end-of-stream@1.4.4:
dependencies:
once: 1.4.0
env-paths@2.2.1: {}
env-paths@3.0.0: {}
err-code@2.0.3: {}
es-define-property@1.0.0:
@ -6062,6 +6202,8 @@ snapshots:
fast-levenshtein@2.0.6: {}
fast-uri@3.0.1: {}
fastq@1.17.1:
dependencies:
reusify: 1.0.4
@ -6074,6 +6216,8 @@ snapshots:
dependencies:
flat-cache: 3.2.0
file-uri-to-path@1.0.0: {}
filelist@1.0.4:
dependencies:
minimatch: 5.1.6
@ -6160,20 +6304,20 @@ snapshots:
function-bind@1.1.2: {}
gaxios@6.7.0:
gaxios@6.7.0(encoding@0.1.13):
dependencies:
extend: 3.0.2
https-proxy-agent: 7.0.5
is-stream: 2.0.1
node-fetch: 2.7.0
node-fetch: 2.7.0(encoding@0.1.13)
uuid: 10.0.0
transitivePeerDependencies:
- encoding
- supports-color
gcp-metadata@6.1.0:
gcp-metadata@6.1.0(encoding@0.1.13):
dependencies:
gaxios: 6.7.0
gaxios: 6.7.0(encoding@0.1.13)
json-bigint: 1.0.0
transitivePeerDependencies:
- encoding
@ -6257,31 +6401,31 @@ snapshots:
merge2: 1.4.1
slash: 3.0.0
google-auth-library@9.13.0:
google-auth-library@9.13.0(encoding@0.1.13):
dependencies:
base64-js: 1.5.1
ecdsa-sig-formatter: 1.0.11
gaxios: 6.7.0
gcp-metadata: 6.1.0
gtoken: 7.1.0
gaxios: 6.7.0(encoding@0.1.13)
gcp-metadata: 6.1.0(encoding@0.1.13)
gtoken: 7.1.0(encoding@0.1.13)
jws: 4.0.0
transitivePeerDependencies:
- encoding
- supports-color
google-gax@4.3.8:
google-gax@4.3.8(encoding@0.1.13):
dependencies:
'@grpc/grpc-js': 1.11.1
'@grpc/proto-loader': 0.7.13
'@types/long': 4.0.2
abort-controller: 3.0.0
duplexify: 4.1.3
google-auth-library: 9.13.0
node-fetch: 2.7.0
google-auth-library: 9.13.0(encoding@0.1.13)
node-fetch: 2.7.0(encoding@0.1.13)
object-hash: 3.0.0
proto3-json-serializer: 2.0.2
protobufjs: 7.3.2
retry-request: 7.0.2
retry-request: 7.0.2(encoding@0.1.13)
uuid: 9.0.1
transitivePeerDependencies:
- encoding
@ -6314,9 +6458,9 @@ snapshots:
dependencies:
'@grpc/grpc-js': 1.11.1
gtoken@7.1.0:
gtoken@7.1.0(encoding@0.1.13):
dependencies:
gaxios: 6.7.0
gaxios: 6.7.0(encoding@0.1.13)
jws: 4.0.0
transitivePeerDependencies:
- encoding
@ -6503,6 +6647,10 @@ snapshots:
json-schema-traverse@0.4.1: {}
json-schema-traverse@1.0.0: {}
json-schema-typed@8.0.1: {}
json-stable-stringify-without-jsonify@1.0.1: {}
json-stringify-safe@5.0.1:
@ -6624,6 +6772,8 @@ snapshots:
mime@2.6.0: {}
mimic-function@5.0.1: {}
mimic-response@1.0.1: {}
mimic-response@3.1.0: {}
@ -6689,9 +6839,11 @@ snapshots:
node-addon-api@6.1.0: {}
node-fetch@2.7.0:
node-fetch@2.7.0(encoding@0.1.13):
dependencies:
whatwg-url: 5.0.0
optionalDependencies:
encoding: 0.1.13
node-releases@2.0.18: {}
@ -7416,6 +7568,8 @@ snapshots:
require-directory@2.1.1: {}
require-from-string@2.0.2: {}
resize-observer-polyfill@1.5.1: {}
resolve-alpn@1.2.1: {}
@ -7432,11 +7586,11 @@ snapshots:
dependencies:
lowercase-keys: 2.0.0
retry-request@7.0.2:
retry-request@7.0.2(encoding@0.1.13):
dependencies:
'@types/request': 2.48.12
extend: 3.0.2
teeny-request: 9.0.0
teeny-request: 9.0.0(encoding@0.1.13)
transitivePeerDependencies:
- encoding
- supports-color
@ -7641,6 +7795,8 @@ snapshots:
strip-json-comments@3.1.1: {}
stubborn-fs@1.2.5: {}
stubs@3.0.0: {}
stylis@4.3.2: {}
@ -7751,11 +7907,11 @@ snapshots:
mkdirp: 3.0.1
yallist: 5.0.0
teeny-request@9.0.0:
teeny-request@9.0.0(encoding@0.1.13):
dependencies:
http-proxy-agent: 5.0.0
https-proxy-agent: 5.0.1
node-fetch: 2.7.0
node-fetch: 2.7.0(encoding@0.1.13)
stream-events: 1.0.5
uuid: 9.0.1
transitivePeerDependencies:
@ -7833,8 +7989,12 @@ snapshots:
type-fest@0.20.2: {}
type-fest@4.24.0: {}
typescript@5.5.4: {}
uint8array-extras@1.4.0: {}
undici-types@5.26.5: {}
undici-types@6.13.0: {}
@ -7905,6 +8065,8 @@ snapshots:
tr46: 0.0.3
webidl-conversions: 3.0.1
when-exit@2.1.3: {}
which@2.0.2:
dependencies:
isexe: 2.0.0

View File

@ -1,10 +1,12 @@
import { ThemeProvider } from "@/components/theme-provider";
import LayoutMain from "@/pages/Layout";
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
import Aorta from "@/pages/Aorta";
import Boot from "@/pages/Boot";
import { Setting } from "./pages/Setting";
import { Env } from "./pages/Env";
import { useEffect } from "react";
import { Models } from "./pages/Models";
import { Tools } from "./pages/Tools";
import { Datasource } from "./pages/Datasource";
function App() {
const theme = document.querySelector("html")!.getAttribute("theme") as
@ -20,8 +22,10 @@ function App() {
<Router>
<Routes>
<Route path="/" element={<LayoutMain />}>
<Route index element={<Aorta />} />
<Route path="env" element={<Env />} />
<Route index element={<Boot />} />
<Route path="models" element={<Models />} />
<Route path="datasource" element={<Datasource />} />
<Route path="tools" element={<Tools />} />
<Route path="setting" element={<Setting />} />
</Route>
</Routes>

View File

@ -11,7 +11,7 @@ import {
} from "@/components/ui/card";
import { IoCheckmarkCircleSharp } from "react-icons/io5";
const Aorta = () => {
const Boot = () => {
const [flaskWaiting, setFlaskWaiting] = useState(false);
const [flaskRunning, setflaskRunning] = useState(false);
const [flaskInfo, setFlaskInfo] = useState("");
@ -22,12 +22,16 @@ const Aorta = () => {
};
useEffect(() => {
window.ipcRenderer.on("flask", (event, data) => {
window.ipcRenderer.on("flask-service:response", (event, data) => {
console.log(data);
if (data.running) {
setflaskRunning(true);
setFlaskWaiting(false);
}
if (data.stdout || data.stderr) {
setflaskRunning(true);
setFlaskWaiting(false);
setFlaskInfo((p) => p + (data.stdout || data.stderr));
setFlaskInfo(data.stderr);
}
if (data.exited) {
setFlaskInfo("");
@ -42,8 +46,9 @@ const Aorta = () => {
animate={{ y: 0, opacity: 1 }}
exit={{ y: 0, opacity: 0 }}
transition={{ duration: 0.25 }}
className="h-full"
>
<div className="p-4">
<div className="p-4 h-full flex flex-col">
<div
className="w-full h-[250px] rounded-md"
style={{
@ -51,21 +56,28 @@ const Aorta = () => {
backgroundSize: "cover",
}}
></div>
<div className="mt-4">
<pre>{flaskInfo}</pre>
<main className="flex-1 flex flex-col">
<div className="mt-4 flex-1">
<pre className="text-xs">{flaskInfo}</pre>
</div>
<footer className="flex justify-between">
<div className="left"></div>
<Button
disabled={flaskWaiting}
className="bg"
className={`bg-teal-500 hover:bg-teal-400 ${
flaskWaiting ? "bg-teal-700" : ""
}`}
size={"lg"}
onClick={handleBootPythonServer}
>
<IoCheckmarkCircleSharp className={`mr-2 h-4 w-4}`} />
{flaskRunning ? "运行中" : "启动"} python
</Button>
</footer>
</main>
</div>
</motion.div>
);
};
export default Aorta;
export default Boot;

View File

@ -0,0 +1,7 @@
import React from 'react'
export const Datasource = () => {
return (
<div>Datasource</div>
)
}

View File

@ -1,5 +0,0 @@
import React, { useEffect } from "react";
export const Env = () => {
return <div>index</div>;
};

View File

@ -5,8 +5,10 @@ import { MenuBar } from "./MenuBar";
const LayoutMain = () => {
const platform =
document.querySelector("html")?.getAttribute("platform") ?? "macos";
// const titleBarStyles =
// platform === "macos" ? "pl-[5rem] pr-[.5rem]" : "pl-[.5rem]";
const titleBarStyles =
platform === "macos" ? "pl-[5rem] pr-[.5rem]" : "pl-[.5rem]";
platform === "macos" ? "px-[.5rem]" : "pl-[.5rem]";
return (
<div className="h-full">
@ -20,12 +22,11 @@ const LayoutMain = () => {
>
<img src="logo.svg" className="h-[20px]" />
<span className="pl-2 text-xs">CVPilot </span>
{/* <MenuBar /> */}
</div>
</div>
<div className="relative h-[calc(100%-36px)]">
<div className="flex h-full">
<div className="workspace w-[80px] h-full">
<div className="workspace w-[80px] drag">
<LeftDocker />
</div>
<div className="relative w-[calc(100%-80px)]">

View File

@ -21,11 +21,10 @@ type MenuItem = {
const menuItems: MenuItem[] = [
{ to: "/", name: "一键启动", icon: <IoPlayOutline size={24} /> },
{ to: "/datalist", name: "数据列表", icon: <IoListOutline size={24} /> },
{ to: "/env", name: "环境管理", icon: <IoLayersOutline size={24} /> },
{ to: "/datasource", name: "数据列表", icon: <IoListOutline size={24} /> },
{ to: "/models", name: "模型管理", icon: <IoCubeOutline size={24} /> },
{ to: "/tools", name: "小工具", icon: <IoHammerOutline size={24} /> },
{ to: "/help", name: "帮助", icon: <IoHandLeftOutline size={24} /> },
// { to: "/help", name: "帮助", icon: <IoHandLeftOutline size={24} /> },
{ to: "/setting", name: "设置", icon: <IoSettingsOutline size={24} /> },
];
@ -37,11 +36,11 @@ export const LeftDocker = () => {
};
return (
<ul className="flex flex-col items-center pt-2 gap-4">
<ul className="no-drag flex flex-col items-center pt-2 gap-4">
{menuItems.map((item) => (
<li
key={item.name}
className={`w-full flex flex-col items-center justify-center ${location.pathname === item.to ? "active text-blue-500" : ""
className={`w-full flex flex-col items-center justify-center ${location.pathname === item.to ? "active text-teal-500" : ""
}`}
onClick={() => handleClick(item)}
>

View File

@ -0,0 +1,5 @@
import React from "react";
export const Models = () => {
return <div>Models</div>;
};

View File

@ -0,0 +1,5 @@
import React from "react";
export const Tools = () => {
return <div>Tools</div>;
};