Localize provider errors
This commit is contained in:
1 parent
abaf845e94
commit
958cc68cba
3 files changed
+9
-6
No files matched your search
@@ -126,6 +126,7 @@ const createAssistantAttachmentAdapter = (allowImages: boolean): AttachmentAdapt
|
|||||||
};
|
};
|
||||||
|
|
||||||
const AssistantPreferencesProvider = ({ children }: PropsWithChildren) => {
|
const AssistantPreferencesProvider = ({ children }: PropsWithChildren) => {
|
||||||
|
const t = useScopedI18n("common.assistant");
|
||||||
const { data, isLoading } = clientApi.assistant.getRuntimeOptions.useQuery(undefined, {
|
const { data, isLoading } = clientApi.assistant.getRuntimeOptions.useQuery(undefined, {
|
||||||
staleTime: 10 * 60_000,
|
staleTime: 10 * 60_000,
|
||||||
});
|
});
|
||||||
@@ -192,9 +193,9 @@ const AssistantPreferencesProvider = ({ children }: PropsWithChildren) => {
|
|||||||
try {
|
try {
|
||||||
const nextQuota = await workshopClient.getAssistantUsage(controller.signal);
|
const nextQuota = await workshopClient.getAssistantUsage(controller.signal);
|
||||||
if (quotaRequestRef.current === controller && !controller.signal.aborted) setQuota(nextQuota);
|
if (quotaRequestRef.current === controller && !controller.signal.aborted) setQuota(nextQuota);
|
||||||
} catch (error) {
|
} catch {
|
||||||
if (quotaRequestRef.current === controller && !controller.signal.aborted) {
|
if (quotaRequestRef.current === controller && !controller.signal.aborted) {
|
||||||
setQuotaError(error instanceof Error ? error.message : "The Homarr provider allowance could not be loaded.");
|
setQuotaError(t("providerQuota.loadError"));
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
if (quotaRequestRef.current === controller) {
|
if (quotaRequestRef.current === controller) {
|
||||||
@@ -202,7 +203,7 @@ const AssistantPreferencesProvider = ({ children }: PropsWithChildren) => {
|
|||||||
setQuotaLoading(false);
|
setQuotaLoading(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [data?.provider, workshopClient]);
|
}, [data?.provider, t, workshopClient]);
|
||||||
const signInToProvider = useCallback(async () => {
|
const signInToProvider = useCallback(async () => {
|
||||||
setQuotaLoading(true);
|
setQuotaLoading(true);
|
||||||
setQuotaError(null);
|
setQuotaError(null);
|
||||||
@@ -211,12 +212,12 @@ const AssistantPreferencesProvider = ({ children }: PropsWithChildren) => {
|
|||||||
setProviderUser(user);
|
setProviderUser(user);
|
||||||
await refreshQuota();
|
await refreshQuota();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setQuotaError(error instanceof Error ? error.message : "GitHub sign-in failed.");
|
setQuotaError(t("providerQuota.signInError"));
|
||||||
throw error;
|
throw error;
|
||||||
} finally {
|
} finally {
|
||||||
setQuotaLoading(false);
|
setQuotaLoading(false);
|
||||||
}
|
}
|
||||||
}, [refreshQuota, workshopClient]);
|
}, [refreshQuota, t, workshopClient]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!data) return;
|
if (!data) return;
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ for client_id in workshop-test-client workshop-rotated-client; do
|
|||||||
node apps/workshop/tests/oauth-sync.integration.mjs
|
node apps/workshop/tests/oauth-sync.integration.mjs
|
||||||
done
|
done
|
||||||
|
|
||||||
OPENROUTER_API_KEY= PB_EXPOSE_PORT="$WORKSHOP_TEST_PORT" docker compose -p "$WORKSHOP_TEST_PROJECT" \
|
OPENROUTER_API_KEY="" PB_EXPOSE_PORT="$WORKSHOP_TEST_PORT" docker compose -p "$WORKSHOP_TEST_PROJECT" \
|
||||||
-f apps/workshop/docker-compose.yml up -d --force-recreate workshop
|
-f apps/workshop/docker-compose.yml up -d --force-recreate workshop
|
||||||
for attempt in $(seq 1 60); do
|
for attempt in $(seq 1 60); do
|
||||||
if curl --fail --silent "http://127.0.0.1:$WORKSHOP_TEST_PORT/api/health" >/dev/null; then
|
if curl --fail --silent "http://127.0.0.1:$WORKSHOP_TEST_PORT/api/health" >/dev/null; then
|
||||||
|
|||||||
@@ -2094,6 +2094,8 @@
|
|||||||
"exhaustedDescription": "Your Homarr provider allowance is used for today. It resets at midnight UTC.",
|
"exhaustedDescription": "Your Homarr provider allowance is used for today. It resets at midnight UTC.",
|
||||||
"unavailableDescription": "Sign in to the Workshop or wait for your Homarr provider allowance to reset.",
|
"unavailableDescription": "Sign in to the Workshop or wait for your Homarr provider allowance to reset.",
|
||||||
"signIn": "Sign in with GitHub",
|
"signIn": "Sign in with GitHub",
|
||||||
|
"signInError": "GitHub sign-in failed. Try again in a moment.",
|
||||||
|
"loadError": "The Homarr provider allowance could not be loaded.",
|
||||||
"reset": "Resets {relative} at <time></time>",
|
"reset": "Resets {relative} at <time></time>",
|
||||||
"toolCalls": "Each model request and completed tool call uses one request.",
|
"toolCalls": "Each model request and completed tool call uses one request.",
|
||||||
"retry": "Reload allowance",
|
"retry": "Reload allowance",
|
||||||
|
|||||||
Reference in new issue
Block a user