fix: evaluate status add lock state

This commit is contained in:
jialin
2025-06-12 09:57:25 +08:00
parent 281d8bddc1
commit 1b6cfdbdc4
6 changed files with 71 additions and 22 deletions
-6
View File
@@ -20,12 +20,6 @@ export default function createProxyTable(target?: string) {
ws: true,
log: 'debug',
pathRewrite: (pth: string) => pth.replace(`/^/${api}`, `/${api}`),
// onProxyRes: (proxyRes: any, req: any, res: any) => {
// console.log('headers=========', {
// res: proxyRes.headers,
// req: req.headers
// });
// },
headers: {
origin: newTarget,
Connection: 'keep-alive'
+6 -1
View File
@@ -33,7 +33,7 @@
"ansi-to-html": "^0.7.2",
"antd": "^5.21.6",
"antd-style": "^3.6.2",
"axios": "^1.7.2",
"axios": "^1.8.2",
"classnames": "^2.5.1",
"clipboard": "^2.0.11",
"crypto-js": "^4.2.0",
@@ -101,5 +101,10 @@
"url-loader": "^4.1.1",
"webpack-bundle-analyzer": "^4.10.2",
"worker-loader": "^3.0.8"
},
"pnpm": {
"overrides": {
"elliptic": "^6.6.1"
}
}
}
+12 -8
View File
@@ -6,6 +6,7 @@ settings:
overrides:
immer: ^9.0.6
elliptic: ^6.6.1
dependencies:
'@ant-design/icons':
@@ -60,8 +61,8 @@ dependencies:
specifier: ^3.6.2
version: 3.6.2(@types/react@18.3.1)(antd@5.21.6)(react-dom@18.2.0)(react@18.2.0)
axios:
specifier: ^1.7.2
version: 1.7.2
specifier: ^1.8.2
version: 1.9.0
classnames:
specifier: ^2.5.1
version: 2.5.1
@@ -7832,8 +7833,8 @@ packages:
transitivePeerDependencies:
- debug
/axios@1.7.2:
resolution: {integrity: sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==, tarball: https://registry.npmjs.org/axios/-/axios-1.7.2.tgz}
/axios@1.9.0:
resolution: {integrity: sha512-re4CqKTJaURpzbLHtIi6XpDv20/CnpXOtjRY5/CU32L8gU8ek9UIivcfvSWvmKEngmVbrUtPpdDwWDWL7DNHvg==, tarball: https://registry.npmjs.org/axios/-/axios-1.9.0.tgz}
dependencies:
follow-redirects: 1.15.6
form-data: 4.0.0
@@ -8177,7 +8178,7 @@ packages:
browserify-rsa: 4.1.0
create-hash: 1.2.0
create-hmac: 1.1.7
elliptic: 6.5.5
elliptic: 6.6.1
hash-base: 3.0.4
inherits: 2.0.4
parse-asn1: 5.1.7
@@ -8790,7 +8791,7 @@ packages:
resolution: {integrity: sha512-mf+TCx8wWc9VpuxfP2ht0iSISLZnt0JgWlrOKZiNqyUZWnjIaCIVNQArMHnCZKfEYRg6IM7A+NeJoN8gf/Ws0A==, tarball: https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.4.tgz}
dependencies:
bn.js: 4.12.0
elliptic: 6.5.5
elliptic: 6.6.1
dev: false
/create-hash@1.2.0:
@@ -9530,8 +9531,8 @@ packages:
/electron-to-chromium@1.5.73:
resolution: {integrity: sha512-8wGNxG9tAG5KhGd3eeA0o6ixhiNdgr0DcHWm85XPCphwZgD1lIEoi6t3VERayWao7SF7AAZTw6oARGJeVjH8Kg==, tarball: https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.73.tgz}
/elliptic@6.5.5:
resolution: {integrity: sha512-7EjbcmUm17NQFu4Pmgmq2olYMj8nwMnpcddByChSUjArp8F5DQWcIcpriwO4ZToLNAJig0yiyjswfyGNje/ixw==, tarball: https://registry.npmjs.org/elliptic/-/elliptic-6.5.5.tgz}
/elliptic@6.6.1:
resolution: {integrity: sha512-RaddvvMatK2LJHqFJ+YA4WysVN5Ita9E35botqIYspQ4TkRAlCicdzKOjlyv/1Za5RyTNn7di//eEV0uTAfe3g==, tarball: https://registry.npmjs.org/elliptic/-/elliptic-6.6.1.tgz}
dependencies:
bn.js: 4.12.0
brorand: 1.1.0
@@ -19107,6 +19108,7 @@ packages:
/tr46@0.0.3:
resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==, tarball: https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz}
requiresBuild: true
dev: false
/trim-lines@3.0.1:
@@ -19928,6 +19930,7 @@ packages:
/webidl-conversions@3.0.1:
resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==, tarball: https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz}
requiresBuild: true
dev: false
/webpack-5-chain@8.0.1:
@@ -20007,6 +20010,7 @@ packages:
/whatwg-url@5.0.0:
resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==, tarball: https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz}
requiresBuild: true
dependencies:
tr46: 0.0.3
webidl-conversions: 3.0.1
+1 -1
View File
@@ -128,7 +128,7 @@ const MixLineBarChart: React.FC<
...options.xAxis,
data: xAxisData
},
series: [...linedata, ...barData]
series: [...barData, ...linedata]
};
}, [seriesData, xAxisData, yAxisName, title, smooth, legendData, options]);
+12 -3
View File
@@ -84,7 +84,7 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
const [query, setQuery] = useState({
page: 1,
perPage: 10,
total: 100
total: 0
});
const modelFilesSortOptions = useRef<any[]>([
{
@@ -120,7 +120,8 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
return isGGUF || isGGUFFromMs;
};
const handleOnSelectModel = (item: any, evaluate?: boolean) => {
const handleOnSelectModel = (model: any, evaluate?: boolean) => {
const item = model || {};
onSelectModel(item, evaluate);
setCurrent(item.id);
currentRef.current = item.id;
@@ -207,6 +208,13 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
});
return list;
} catch (error) {
setQuery((prev) => {
return {
...prev,
page: queryParams.page,
total: 0
};
});
return [];
}
};
@@ -367,7 +375,7 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
displayEvaluateStatus?.({
show: true,
flag: {
model: true
model: list.length > 0
}
});
handleOnSelectModel(list[0]);
@@ -375,6 +383,7 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
handleEvaluate(list);
} catch (error: any) {
console.log('error:', error);
setDataSource({
repoOptions: [],
loading: false,
+40 -3
View File
@@ -36,6 +36,11 @@ type MessageStatus = {
evaluateResult?: EvaluateResult;
};
type WarningStausOptions = {
lockAfterUpdate?: boolean;
override?: boolean;
};
export const useGenerateFormEditInitialValues = () => {
const gpuDeviceList = useRef<any[]>([]);
const workerList = useRef<any[]>([]);
@@ -268,6 +273,7 @@ export const useCheckCompatibility = () => {
const submitAnyway = useRef<boolean>(false);
const requestIdRef = useRef(0);
const updateStatusTimer = useRef<any>(null);
const isLockWarningStatus = useRef<boolean>(false);
const [warningStatus, setWarningStatus] = useState<MessageStatus>({
show: false,
title: '',
@@ -279,6 +285,33 @@ export const useCheckCompatibility = () => {
return requestIdRef.current;
};
const lockWarningStatus = () => {
isLockWarningStatus.current = true;
};
const unlockWarningStatus = () => {
isLockWarningStatus.current = false;
};
const updateWarningStatus = (
params: MessageStatus,
options?: WarningStausOptions
) => {
const { lockAfterUpdate = false, override = false } = options || {};
setWarningStatus((prev: MessageStatus) => {
if (isLockWarningStatus.current && !override) {
return prev;
}
if (lockAfterUpdate) {
lockWarningStatus();
}
return params;
});
};
const handleEvaluate = async (data: any) => {
try {
checkTokenRef.current?.cancel();
@@ -374,13 +407,16 @@ export const useCheckCompatibility = () => {
};
};
const handleShowCompatibleAlert = (evaluateResult: EvaluateResult | null) => {
const handleShowCompatibleAlert = (
evaluateResult: EvaluateResult | null,
options?: WarningStausOptions
) => {
const result = handleCheckCompatibility(evaluateResult);
if (updateStatusTimer.current) {
clearTimeout(updateStatusTimer.current);
}
updateStatusTimer.current = setTimeout(() => {
setWarningStatus(result);
updateWarningStatus(result, options);
}, 300);
};
@@ -562,7 +598,8 @@ export const useCheckCompatibility = () => {
handleDoEvalute,
generateGPUIds,
handleEvaluate,
setWarningStatus,
setWarningStatus: updateWarningStatus,
unlockWarningStatus,
cancelEvaluate,
handleBackendChangeBefore,
handleOnValuesChange: debounceHandleValuesChange,