diff --git a/web/.husky/pre-commit b/web/.husky/pre-commit
index 832da580..aa89fa4b 100644
--- a/web/.husky/pre-commit
+++ b/web/.husky/pre-commit
@@ -1,3 +1,2 @@
cd web
pnpm lint-staged
-pnpm test
\ No newline at end of file
diff --git a/web/.lintstagedrc.json b/web/.lintstagedrc.json
index f7a24c1f..253287a0 100644
--- a/web/.lintstagedrc.json
+++ b/web/.lintstagedrc.json
@@ -1,3 +1,3 @@
{
- "*.{js,jsx,ts,tsx}": ["prettier --write", "eslint --fix", "eslint"]
-}
\ No newline at end of file
+ "*.{js,jsx,ts,tsx}": ["eslint --fix", "eslint"]
+}
diff --git a/web/.prettierrc.mjs b/web/.prettierrc.mjs
index 0ce90351..01ed3d48 100644
--- a/web/.prettierrc.mjs
+++ b/web/.prettierrc.mjs
@@ -3,7 +3,20 @@
* @type {import("prettier").Config}
*/
const config = {
- trailingComma: "none",
+ // 单行长度
+ printWidth: 80,
+ // 缩进
+ tabWidth: 2,
+ // 使用空格代替tab缩进
+ useTabs: false,
+ // 句末使用分号
+ semi: true,
+ // 使用单引号
+ singleQuote: true,
+ // 大括号前后空格
+ bracketSpacing: true,
+ attributeVerticalAlignment: 'auto',
+ trailingComma: 'all',
};
-export default config;
\ No newline at end of file
+export default config;
diff --git a/web/eslint.config.mjs b/web/eslint.config.mjs
index c85fb67c..18b74c95 100644
--- a/web/eslint.config.mjs
+++ b/web/eslint.config.mjs
@@ -1,6 +1,7 @@
-import { dirname } from "path";
-import { fileURLToPath } from "url";
-import { FlatCompat } from "@eslint/eslintrc";
+import { dirname } from 'path';
+import { fileURLToPath } from 'url';
+import { FlatCompat } from '@eslint/eslintrc';
+import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
@@ -10,7 +11,8 @@ const compat = new FlatCompat({
});
const eslintConfig = [
- ...compat.extends("next/core-web-vitals", "next/typescript"),
+ ...compat.extends('next/core-web-vitals', 'next/typescript'),
+ eslintPluginPrettierRecommended,
];
export default eslintConfig;
diff --git a/web/next.config.ts b/web/next.config.ts
index 9d1f4a25..1abe320c 100644
--- a/web/next.config.ts
+++ b/web/next.config.ts
@@ -1,8 +1,8 @@
-import type { NextConfig } from "next";
+import type { NextConfig } from 'next';
const nextConfig: NextConfig = {
/* config options here */
- output: 'export'
+ output: 'export',
};
export default nextConfig;
diff --git a/web/package-lock.json b/web/package-lock.json
index 73cc51e1..3ee13d82 100644
--- a/web/package-lock.json
+++ b/web/package-lock.json
@@ -25,10 +25,13 @@
"@types/react-dom": "^19",
"eslint": "^9",
"eslint-config-next": "15.2.4",
+ "eslint-config-prettier": "^10.1.2",
+ "eslint-plugin-prettier": "^5.2.6",
"husky": "^9.1.7",
"lint-staged": "^15.5.1",
"prettier": "^3.5.3",
- "typescript": "^5"
+ "typescript": "^5.8.3",
+ "typescript-eslint": "^8.31.1"
}
},
"node_modules/@ant-design/colors": {
@@ -906,6 +909,18 @@
"node": ">=12.4.0"
}
},
+ "node_modules/@pkgr/core": {
+ "version": "0.2.4",
+ "resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.2.4.tgz",
+ "integrity": "sha512-ROFF39F6ZrnzSUEmQQZUar0Jt4xVoP9WnDRdWwF4NNcXs3xBTLgBUDoOwW141y1jP+S8nahIbdxbFC7IShw9Iw==",
+ "dev": true,
+ "engines": {
+ "node": "^12.20.0 || ^14.18.0 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/pkgr"
+ }
+ },
"node_modules/@rc-component/async-validator": {
"version": "5.0.4",
"resolved": "https://registry.npmmirror.com/@rc-component/async-validator/-/async-validator-5.0.4.tgz",
@@ -1133,16 +1148,16 @@
}
},
"node_modules/@typescript-eslint/eslint-plugin": {
- "version": "8.28.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.28.0.tgz",
- "integrity": "sha512-lvFK3TCGAHsItNdWZ/1FkvpzCxTHUVuFrdnOGLMa0GGCFIbCgQWVk3CzCGdA7kM3qGVc+dfW9tr0Z/sHnGDFyg==",
+ "version": "8.31.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.31.1.tgz",
+ "integrity": "sha512-oUlH4h1ABavI4F0Xnl8/fOtML/eu8nI2A1nYd+f+55XI0BLu+RIqKoCiZKNo6DtqZBEQm5aNKA20G3Z5w3R6GQ==",
"dev": true,
"dependencies": {
"@eslint-community/regexpp": "^4.10.0",
- "@typescript-eslint/scope-manager": "8.28.0",
- "@typescript-eslint/type-utils": "8.28.0",
- "@typescript-eslint/utils": "8.28.0",
- "@typescript-eslint/visitor-keys": "8.28.0",
+ "@typescript-eslint/scope-manager": "8.31.1",
+ "@typescript-eslint/type-utils": "8.31.1",
+ "@typescript-eslint/utils": "8.31.1",
+ "@typescript-eslint/visitor-keys": "8.31.1",
"graphemer": "^1.4.0",
"ignore": "^5.3.1",
"natural-compare": "^1.4.0",
@@ -1162,15 +1177,15 @@
}
},
"node_modules/@typescript-eslint/parser": {
- "version": "8.28.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.28.0.tgz",
- "integrity": "sha512-LPcw1yHD3ToaDEoljFEfQ9j2xShY367h7FZ1sq5NJT9I3yj4LHer1Xd1yRSOdYy9BpsrxU7R+eoDokChYM53lQ==",
+ "version": "8.31.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.31.1.tgz",
+ "integrity": "sha512-oU/OtYVydhXnumd0BobL9rkJg7wFJ9bFFPmSmB/bf/XWN85hlViji59ko6bSKBXyseT9V8l+CN1nwmlbiN0G7Q==",
"dev": true,
"dependencies": {
- "@typescript-eslint/scope-manager": "8.28.0",
- "@typescript-eslint/types": "8.28.0",
- "@typescript-eslint/typescript-estree": "8.28.0",
- "@typescript-eslint/visitor-keys": "8.28.0",
+ "@typescript-eslint/scope-manager": "8.31.1",
+ "@typescript-eslint/types": "8.31.1",
+ "@typescript-eslint/typescript-estree": "8.31.1",
+ "@typescript-eslint/visitor-keys": "8.31.1",
"debug": "^4.3.4"
},
"engines": {
@@ -1186,13 +1201,13 @@
}
},
"node_modules/@typescript-eslint/scope-manager": {
- "version": "8.28.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.28.0.tgz",
- "integrity": "sha512-u2oITX3BJwzWCapoZ/pXw6BCOl8rJP4Ij/3wPoGvY8XwvXflOzd1kLrDUUUAIEdJSFh+ASwdTHqtan9xSg8buw==",
+ "version": "8.31.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.31.1.tgz",
+ "integrity": "sha512-BMNLOElPxrtNQMIsFHE+3P0Yf1z0dJqV9zLdDxN/xLlWMlXK/ApEsVEKzpizg9oal8bAT5Sc7+ocal7AC1HCVw==",
"dev": true,
"dependencies": {
- "@typescript-eslint/types": "8.28.0",
- "@typescript-eslint/visitor-keys": "8.28.0"
+ "@typescript-eslint/types": "8.31.1",
+ "@typescript-eslint/visitor-keys": "8.31.1"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -1203,13 +1218,13 @@
}
},
"node_modules/@typescript-eslint/type-utils": {
- "version": "8.28.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.28.0.tgz",
- "integrity": "sha512-oRoXu2v0Rsy/VoOGhtWrOKDiIehvI+YNrDk5Oqj40Mwm0Yt01FC/Q7nFqg088d3yAsR1ZcZFVfPCTTFCe/KPwg==",
+ "version": "8.31.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.31.1.tgz",
+ "integrity": "sha512-fNaT/m9n0+dpSp8G/iOQ05GoHYXbxw81x+yvr7TArTuZuCA6VVKbqWYVZrV5dVagpDTtj/O8k5HBEE/p/HM5LA==",
"dev": true,
"dependencies": {
- "@typescript-eslint/typescript-estree": "8.28.0",
- "@typescript-eslint/utils": "8.28.0",
+ "@typescript-eslint/typescript-estree": "8.31.1",
+ "@typescript-eslint/utils": "8.31.1",
"debug": "^4.3.4",
"ts-api-utils": "^2.0.1"
},
@@ -1226,9 +1241,9 @@
}
},
"node_modules/@typescript-eslint/types": {
- "version": "8.28.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.28.0.tgz",
- "integrity": "sha512-bn4WS1bkKEjx7HqiwG2JNB3YJdC1q6Ue7GyGlwPHyt0TnVq6TtD/hiOdTZt71sq0s7UzqBFXD8t8o2e63tXgwA==",
+ "version": "8.31.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.31.1.tgz",
+ "integrity": "sha512-SfepaEFUDQYRoA70DD9GtytljBePSj17qPxFHA/h3eg6lPTqGJ5mWOtbXCk1YrVU1cTJRd14nhaXWFu0l2troQ==",
"dev": true,
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -1239,13 +1254,13 @@
}
},
"node_modules/@typescript-eslint/typescript-estree": {
- "version": "8.28.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.28.0.tgz",
- "integrity": "sha512-H74nHEeBGeklctAVUvmDkxB1mk+PAZ9FiOMPFncdqeRBXxk1lWSYraHw8V12b7aa6Sg9HOBNbGdSHobBPuQSuA==",
+ "version": "8.31.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.31.1.tgz",
+ "integrity": "sha512-kaA0ueLe2v7KunYOyWYtlf/QhhZb7+qh4Yw6Ni5kgukMIG+iP773tjgBiLWIXYumWCwEq3nLW+TUywEp8uEeag==",
"dev": true,
"dependencies": {
- "@typescript-eslint/types": "8.28.0",
- "@typescript-eslint/visitor-keys": "8.28.0",
+ "@typescript-eslint/types": "8.31.1",
+ "@typescript-eslint/visitor-keys": "8.31.1",
"debug": "^4.3.4",
"fast-glob": "^3.3.2",
"is-glob": "^4.0.3",
@@ -1317,15 +1332,15 @@
}
},
"node_modules/@typescript-eslint/utils": {
- "version": "8.28.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.28.0.tgz",
- "integrity": "sha512-OELa9hbTYciYITqgurT1u/SzpQVtDLmQMFzy/N8pQE+tefOyCWT79jHsav294aTqV1q1u+VzqDGbuujvRYaeSQ==",
+ "version": "8.31.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.31.1.tgz",
+ "integrity": "sha512-2DSI4SNfF5T4oRveQ4nUrSjUqjMND0nLq9rEkz0gfGr3tg0S5KB6DhwR+WZPCjzkZl3cH+4x2ce3EsL50FubjQ==",
"dev": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.4.0",
- "@typescript-eslint/scope-manager": "8.28.0",
- "@typescript-eslint/types": "8.28.0",
- "@typescript-eslint/typescript-estree": "8.28.0"
+ "@typescript-eslint/scope-manager": "8.31.1",
+ "@typescript-eslint/types": "8.31.1",
+ "@typescript-eslint/typescript-estree": "8.31.1"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -1340,12 +1355,12 @@
}
},
"node_modules/@typescript-eslint/visitor-keys": {
- "version": "8.28.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.28.0.tgz",
- "integrity": "sha512-hbn8SZ8w4u2pRwgQ1GlUrPKE+t2XvcCW5tTRF7j6SMYIuYG37XuzIW44JCZPa36evi0Oy2SnM664BlIaAuQcvg==",
+ "version": "8.31.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.31.1.tgz",
+ "integrity": "sha512-I+/rgqOVBn6f0o7NDTmAPWWC6NuqhV174lfYvAm9fUaWeiefLdux9/YI3/nLugEn9L8fcSi0XmpKi/r5u0nmpw==",
"dev": true,
"dependencies": {
- "@typescript-eslint/types": "8.28.0",
+ "@typescript-eslint/types": "8.31.1",
"eslint-visitor-keys": "^4.2.0"
},
"engines": {
@@ -2640,6 +2655,18 @@
}
}
},
+ "node_modules/eslint-config-prettier": {
+ "version": "10.1.2",
+ "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-10.1.2.tgz",
+ "integrity": "sha512-Epgp/EofAUeEpIdZkW60MHKvPyru1ruQJxPL+WIycnaPApuseK0Zpkrh/FwL9oIpQvIhJwV7ptOy0DWUjTlCiA==",
+ "dev": true,
+ "bin": {
+ "eslint-config-prettier": "bin/cli.js"
+ },
+ "peerDependencies": {
+ "eslint": ">=7.0.0"
+ }
+ },
"node_modules/eslint-import-resolver-node": {
"version": "0.3.9",
"resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz",
@@ -2800,6 +2827,36 @@
"eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9"
}
},
+ "node_modules/eslint-plugin-prettier": {
+ "version": "5.2.6",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.2.6.tgz",
+ "integrity": "sha512-mUcf7QG2Tjk7H055Jk0lGBjbgDnfrvqjhXh9t2xLMSCjZVcw9Rb1V6sVNXO0th3jgeO7zllWPTNRil3JW94TnQ==",
+ "dev": true,
+ "dependencies": {
+ "prettier-linter-helpers": "^1.0.0",
+ "synckit": "^0.11.0"
+ },
+ "engines": {
+ "node": "^14.18.0 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint-plugin-prettier"
+ },
+ "peerDependencies": {
+ "@types/eslint": ">=8.0.0",
+ "eslint": ">=8.0.0",
+ "eslint-config-prettier": ">= 7.0.0 <10.0.0 || >=10.1.0",
+ "prettier": ">=3.0.0"
+ },
+ "peerDependenciesMeta": {
+ "@types/eslint": {
+ "optional": true
+ },
+ "eslint-config-prettier": {
+ "optional": true
+ }
+ }
+ },
"node_modules/eslint-plugin-react": {
"version": "7.37.4",
"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.37.4.tgz",
@@ -2992,6 +3049,12 @@
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
"dev": true
},
+ "node_modules/fast-diff": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz",
+ "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==",
+ "dev": true
+ },
"node_modules/fast-glob": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz",
@@ -4715,6 +4778,18 @@
"url": "https://github.com/prettier/prettier?sponsor=1"
}
},
+ "node_modules/prettier-linter-helpers": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz",
+ "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==",
+ "dev": true,
+ "dependencies": {
+ "fast-diff": "^1.1.2"
+ },
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
"node_modules/prop-types": {
"version": "15.8.1",
"resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz",
@@ -6117,6 +6192,22 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/synckit": {
+ "version": "0.11.4",
+ "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.11.4.tgz",
+ "integrity": "sha512-Q/XQKRaJiLiFIBNN+mndW7S/RHxvwzuZS6ZwmRzUBqJBv/5QIKCEwkBC8GBf8EQJKYnaFs0wOZbKTXBPj8L9oQ==",
+ "dev": true,
+ "dependencies": {
+ "@pkgr/core": "^0.2.3",
+ "tslib": "^2.8.1"
+ },
+ "engines": {
+ "node": "^14.18.0 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/synckit"
+ }
+ },
"node_modules/throttle-debounce": {
"version": "5.0.2",
"resolved": "https://registry.npmmirror.com/throttle-debounce/-/throttle-debounce-5.0.2.tgz",
@@ -6300,9 +6391,9 @@
}
},
"node_modules/typescript": {
- "version": "5.8.2",
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.2.tgz",
- "integrity": "sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ==",
+ "version": "5.8.3",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz",
+ "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
@@ -6312,6 +6403,28 @@
"node": ">=14.17"
}
},
+ "node_modules/typescript-eslint": {
+ "version": "8.31.1",
+ "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.31.1.tgz",
+ "integrity": "sha512-j6DsEotD/fH39qKzXTQRwYYWlt7D+0HmfpOK+DVhwJOFLcdmn92hq3mBb7HlKJHbjjI/gTOqEcc9d6JfpFf/VA==",
+ "dev": true,
+ "dependencies": {
+ "@typescript-eslint/eslint-plugin": "8.31.1",
+ "@typescript-eslint/parser": "8.31.1",
+ "@typescript-eslint/utils": "8.31.1"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependencies": {
+ "eslint": "^8.57.0 || ^9.0.0",
+ "typescript": ">=4.8.4 <5.9.0"
+ }
+ },
"node_modules/unbox-primitive": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.1.0.tgz",
diff --git a/web/package.json b/web/package.json
index 2fc93f2e..17b7ffda 100644
--- a/web/package.json
+++ b/web/package.json
@@ -28,9 +28,12 @@
"@types/react-dom": "^19",
"eslint": "^9",
"eslint-config-next": "15.2.4",
+ "eslint-config-prettier": "^10.1.2",
+ "eslint-plugin-prettier": "^5.2.6",
"husky": "^9.1.7",
"lint-staged": "^15.5.1",
"prettier": "^3.5.3",
- "typescript": "^5"
+ "typescript": "^5.8.3",
+ "typescript-eslint": "^8.31.1"
}
}
diff --git a/web/src/app/home/bots/components/bot-card/BotCard.tsx b/web/src/app/home/bots/components/bot-card/BotCard.tsx
index 92d2449a..f57a2761 100644
--- a/web/src/app/home/bots/components/bot-card/BotCard.tsx
+++ b/web/src/app/home/bots/components/bot-card/BotCard.tsx
@@ -1,39 +1,33 @@
-import {BotCardVO} from "@/app/home/bots/components/bot-card/BotCardVO";
-import styles from "./botCard.module.css";
+import { BotCardVO } from '@/app/home/bots/components/bot-card/BotCardVO';
+import styles from './botCard.module.css';
-export default function BotCard({
- botCardVO
-}: {
- botCardVO: BotCardVO;
-}) {
- return (
-
- {/* icon和基本信息 */}
-
- {/* icon */}
-
- ICO
-
- {/* bot基本信息 */}
-
-
- {botCardVO.name}
-
-
- 平台:{botCardVO.adapter}
-
-
- 绑定流水线:{botCardVO.pipelineName}
-
-
-
- {/* 描述和创建时间 */}
-
- 描述:{botCardVO.description}
-
- {/*
+export default function BotCard({ botCardVO }: { botCardVO: BotCardVO }) {
+ return (
+
+ {/* icon和基本信息 */}
+
+ {/* icon */}
+
ICO
+ {/* bot基本信息 */}
+
+
+ {botCardVO.name}
+
+
+ 平台:{botCardVO.adapter}
+
+
+ 绑定流水线:{botCardVO.pipelineName}
+
+
+
+ {/* 描述和创建时间 */}
+
+ 描述:{botCardVO.description}
+
+ {/*
更新时间:{botCardVO.updateTime}
*/}
-
- )
-}
\ No newline at end of file
+
+ );
+}
diff --git a/web/src/app/home/bots/components/bot-card/BotCardVO.ts b/web/src/app/home/bots/components/bot-card/BotCardVO.ts
index 6f32b183..a015a6c7 100644
--- a/web/src/app/home/bots/components/bot-card/BotCardVO.ts
+++ b/web/src/app/home/bots/components/bot-card/BotCardVO.ts
@@ -1,28 +1,26 @@
export interface IBotCardVO {
- id: string;
- name: string;
- adapter: string;
- description: string;
- updateTime: string;
- pipelineName: string;
+ id: string;
+ name: string;
+ adapter: string;
+ description: string;
+ updateTime: string;
+ pipelineName: string;
}
export class BotCardVO implements IBotCardVO {
- id: string;
- adapter: string;
- description: string;
- name: string;
- updateTime: string;
- pipelineName: string;
+ id: string;
+ adapter: string;
+ description: string;
+ name: string;
+ updateTime: string;
+ pipelineName: string;
-
- constructor(props: IBotCardVO) {
- this.id = props.id;
- this.name = props.name;
- this.adapter = props.adapter;
- this.description = props.description;
- this.updateTime = props.updateTime;
- this.pipelineName = props.pipelineName;
- }
-
-}
\ No newline at end of file
+ constructor(props: IBotCardVO) {
+ this.id = props.id;
+ this.name = props.name;
+ this.adapter = props.adapter;
+ this.description = props.description;
+ this.updateTime = props.updateTime;
+ this.pipelineName = props.pipelineName;
+ }
+}
diff --git a/web/src/app/home/bots/components/bot-form/BotForm.tsx b/web/src/app/home/bots/components/bot-form/BotForm.tsx
index 5c3e804d..156ee581 100644
--- a/web/src/app/home/bots/components/bot-form/BotForm.tsx
+++ b/web/src/app/home/bots/components/bot-form/BotForm.tsx
@@ -1,24 +1,24 @@
import {
BotFormEntity,
- IBotFormEntity
-} from "@/app/home/bots/components/bot-form/BotFormEntity";
-import { Button, Form, Input, notification, Select, Space } from "antd";
-import { useEffect, useState } from "react";
-import { IChooseAdapterEntity } from "@/app/home/bots/components/bot-form/ChooseAdapterEntity";
+ IBotFormEntity,
+} from '@/app/home/bots/components/bot-form/BotFormEntity';
+import { Button, Form, Input, notification, Select, Space } from 'antd';
+import { useEffect, useState } from 'react';
+import { IChooseAdapterEntity } from '@/app/home/bots/components/bot-form/ChooseAdapterEntity';
import {
DynamicFormItemConfig,
IDynamicFormItemConfig,
- parseDynamicFormItemType
-} from "@/app/home/components/dynamic-form/DynamicFormItemConfig";
-import { UUID } from "uuidjs";
-import DynamicFormComponent from "@/app/home/components/dynamic-form/DynamicFormComponent";
-import { httpClient } from "@/app/infra/http/HttpClient";
-import { Bot } from "@/app/infra/api/api-types";
+ parseDynamicFormItemType,
+} from '@/app/home/components/dynamic-form/DynamicFormItemConfig';
+import { UUID } from 'uuidjs';
+import DynamicFormComponent from '@/app/home/components/dynamic-form/DynamicFormComponent';
+import { httpClient } from '@/app/infra/http/HttpClient';
+import { Bot } from '@/app/infra/api/api-types';
export default function BotForm({
initBotId,
onFormSubmit,
- onFormCancel
+ onFormCancel,
}: {
initBotId?: string;
onFormSubmit: (value: IBotFormEntity) => void;
@@ -55,9 +55,9 @@ export default function BotForm({
rawAdapterList.adapters.map((item) => {
return {
label: item.label.zh_CN,
- value: item.name
+ value: item.name,
};
- })
+ }),
);
// 初始化适配器表单map
rawAdapterList.adapters.forEach((rawAdapter) => {
@@ -71,9 +71,9 @@ export default function BotForm({
label: item.label,
name: item.name,
required: item.required,
- type: parseDynamicFormItemType(item.type)
- })
- )
+ type: parseDynamicFormItemType(item.type),
+ }),
+ ),
);
});
// 拉取初始化表单信息
@@ -99,12 +99,12 @@ export default function BotForm({
adapter: bot.adapter,
description: bot.description,
name: bot.name,
- adapter_config: bot.adapter_config
+ adapter_config: bot.adapter_config,
});
}
function handleAdapterSelect(adapterName: string) {
- console.log("Select adapter: ", adapterName);
+ console.log('Select adapter: ', adapterName);
if (adapterName) {
const dynamicFormConfigList =
adapterNameToDynamicConfigMap.get(adapterName);
@@ -129,33 +129,33 @@ export default function BotForm({
// 只有通过外层固定表单验证才会走到这里,真正的提交逻辑在这里
function onDynamicFormSubmit(value: object) {
setIsLoading(true);
- console.log("set loading", true);
+ console.log('set loading', true);
if (initBotId) {
// 编辑提交
- console.log("submit edit", form.getFieldsValue(), value);
+ console.log('submit edit', form.getFieldsValue(), value);
const updateBot: Bot = {
uuid: initBotId,
name: form.getFieldsValue().name,
description: form.getFieldsValue().description,
adapter: form.getFieldsValue().adapter,
- adapter_config: value
+ adapter_config: value,
};
httpClient
.updateBot(initBotId, updateBot)
.then((res) => {
// TODO success toast
- console.log("update bot success", res);
+ console.log('update bot success', res);
onFormSubmit(form.getFieldsValue());
notification.success({
- message: "更新成功",
- description: "机器人更新成功"
+ message: '更新成功',
+ description: '机器人更新成功',
});
})
.catch(() => {
// TODO error toast
notification.error({
- message: "更新失败",
- description: "机器人更新失败"
+ message: '更新失败',
+ description: '机器人更新失败',
});
})
.finally(() => {
@@ -165,20 +165,20 @@ export default function BotForm({
});
} else {
// 创建提交
- console.log("submit create", form.getFieldsValue(), value);
+ console.log('submit create', form.getFieldsValue(), value);
const newBot: Bot = {
name: form.getFieldsValue().name,
description: form.getFieldsValue().description,
adapter: form.getFieldsValue().adapter,
- adapter_config: value
+ adapter_config: value,
};
httpClient
.createBot(newBot)
.then((res) => {
// TODO success toast
notification.success({
- message: "创建成功",
- description: "机器人创建成功"
+ message: '创建成功',
+ description: '机器人创建成功',
});
console.log(res);
onFormSubmit(form.getFieldsValue());
@@ -186,8 +186,8 @@ export default function BotForm({
.catch(() => {
// TODO error toast
notification.error({
- message: "创建失败",
- description: "机器人创建失败"
+ message: '创建失败',
+ description: '机器人创建失败',
});
})
.finally(() => {
@@ -197,7 +197,7 @@ export default function BotForm({
});
}
setShowDynamicForm(false);
- console.log("set loading", false);
+ console.log('set loading', false);
// TODO 刷新bot列表
// TODO 关闭当前弹窗 Already closed @setShowDynamicForm(false)?
}
@@ -217,9 +217,9 @@ export default function BotForm({
disabled={isLoading}
>
- label={"机器人名称"}
- name={"name"}
- rules={[{ required: true, message: "该项为必填项哦~" }]}
+ label={'机器人名称'}
+ name={'name'}
+ rules={[{ required: true, message: '该项为必填项哦~' }]}
>
- label={"描述"}
- name={"description"}
- rules={[{ required: true, message: "该项为必填项哦~" }]}
+ label={'描述'}
+ name={'description'}
+ rules={[{ required: true, message: '该项为必填项哦~' }]}
>
- label={"平台/适配器选择"}
- name={"adapter"}
- rules={[{ required: true, message: "该项为必填项哦~" }]}
+ label={'平台/适配器选择'}
+ name={'adapter'}
+ rules={[{ required: true, message: '该项为必填项哦~' }]}
>