fix: channel affinity (#2799)
* fix: channel affinity log styles * fix: Issue with incorrect data storage when switching key sources * feat: support not retrying after a single rule configuration fails * fix: render channel affinity tooltip as multiline content * feat: channel affinity cache hit * fix: prevent ChannelAffinityUsageCacheModal infinite loading and hide data before fetch * chore: format backend with gofmt and frontend with prettier/eslint autofix
This commit is contained in:
@@ -55,13 +55,20 @@ export const useModelDeploymentSettings = () => {
|
||||
|
||||
const isIoNetEnabled = settings['model_deployment.ionet.enabled'];
|
||||
|
||||
const buildConnectionError = (rawMessage, fallbackMessage = 'Connection failed') => {
|
||||
const buildConnectionError = (
|
||||
rawMessage,
|
||||
fallbackMessage = 'Connection failed',
|
||||
) => {
|
||||
const message = (rawMessage || fallbackMessage).trim();
|
||||
const normalized = message.toLowerCase();
|
||||
if (normalized.includes('expired') || normalized.includes('expire')) {
|
||||
return { type: 'expired', message };
|
||||
}
|
||||
if (normalized.includes('invalid') || normalized.includes('unauthorized') || normalized.includes('api key')) {
|
||||
if (
|
||||
normalized.includes('invalid') ||
|
||||
normalized.includes('unauthorized') ||
|
||||
normalized.includes('api key')
|
||||
) {
|
||||
return { type: 'invalid', message };
|
||||
}
|
||||
if (normalized.includes('network') || normalized.includes('timeout')) {
|
||||
@@ -85,7 +92,11 @@ export const useModelDeploymentSettings = () => {
|
||||
}
|
||||
|
||||
const message = response?.data?.message || 'Connection failed';
|
||||
setConnectionState({ loading: false, ok: false, error: buildConnectionError(message) });
|
||||
setConnectionState({
|
||||
loading: false,
|
||||
ok: false,
|
||||
error: buildConnectionError(message),
|
||||
});
|
||||
} catch (error) {
|
||||
if (error?.code === 'ERR_NETWORK') {
|
||||
setConnectionState({
|
||||
@@ -95,8 +106,13 @@ export const useModelDeploymentSettings = () => {
|
||||
});
|
||||
return;
|
||||
}
|
||||
const rawMessage = error?.response?.data?.message || error?.message || 'Unknown error';
|
||||
setConnectionState({ loading: false, ok: false, error: buildConnectionError(rawMessage, 'Connection failed') });
|
||||
const rawMessage =
|
||||
error?.response?.data?.message || error?.message || 'Unknown error';
|
||||
setConnectionState({
|
||||
loading: false,
|
||||
ok: false,
|
||||
error: buildConnectionError(rawMessage, 'Connection failed'),
|
||||
});
|
||||
}
|
||||
}, []);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user