fix(ui): i18n repair round 5; extract networking notifications and drop dead labels

This commit is contained in:
吹雪 2026-06-11 08:53:59 +09:00
parent 43bbc47820
commit b691eff14c
5 changed files with 21 additions and 7 deletions

View file

@ -8,12 +8,10 @@ import { Organization, Team } from "../networking";
import { splitWildcardModels } from "./modelUtils";
const MODEL_SELECT_ALL_PROXY_MODELS_SPECIAL_VALUE = {
label: "All Proxy Models",
value: "all-proxy-models",
} as const;
const MODEL_SELECT_NO_DEFAULT_MODELS_SPECIAL_VALUE = {
label: "No Default Models",
value: "no-default-models",
} as const;

View file

@ -269,6 +269,7 @@ interface AssistantBubbleProps {
}
function AssistantBubble({ message, isLastMessage, isStreaming, isTypingIndicator, mcpEvents }: AssistantBubbleProps) {
const { t } = useTranslation();
// Ref to control ReasoningContent collapse on streaming end.
// ReasoningContent manages its own expanded state; we use a key to
// remount it (collapsed by default) when streaming finishes.

View file

@ -33,6 +33,7 @@ export const getInProductNudgesCall = async (accessToken: string) => {
* Helper file for calls being made to proxy
*/
import MessageManager from "@/components/molecules/message_manager";
import i18n from "@/lib/i18n";
import { clearTokenCookies, storeLoginToken } from "@/utils/cookieUtils";
import { TagNewRequest, TagUpdateRequest, TagListResponse, TagInfoResponse } from "./tag_management/types";
import { Team } from "./key_team_helpers/key_list";
@ -302,7 +303,7 @@ export const handleError = async (errorData: string | any) => {
// Convert errorData to string if it isn't already
const errorString = typeof errorData === "string" ? errorData : JSON.stringify(errorData);
if (errorString.includes("Authentication Error - Expired Key")) {
NotificationsManager.info("UI Session Expired. Logging out.");
NotificationsManager.info(i18n.t("networking.sessionExpired"));
lastErrorTime = currentTime;
clearTokenCookies();
const browserLocation = getWindowLocation();
@ -568,7 +569,7 @@ export const modelCreateCall = async (accessToken: string, formValues: Model) =>
MessageManager.destroy();
// Sequential success messages
NotificationsManager.success(`Model ${formValues.model_name} created successfully`);
NotificationsManager.success(i18n.t("networking.modelCreated", { model: formValues.model_name }));
return data;
} catch (error) {
@ -3423,7 +3424,7 @@ export const updateConfigFieldSetting = async (accessToken: string, fieldName: s
//NotificationsManager.info("Requesting model data");
const data = await apiClient.post(`/config/field/update`, { accessToken, body: formData });
//NotificationsManager.info("Received model data");
NotificationsManager.success("Successfully updated value!");
NotificationsManager.success(i18n.t("networking.valueUpdated"));
return data;
// Handle success - you might want to update some state or UI based on the created key
} catch (error) {
@ -3440,7 +3441,7 @@ export const deleteConfigFieldSetting = async (accessToken: string, fieldName: s
};
//NotificationsManager.info("Requesting model data");
const data = await apiClient.post(`/config/field/delete`, { accessToken, body: formData });
NotificationsManager.success("Field reset on proxy");
NotificationsManager.success(i18n.t("networking.fieldReset"));
return data;
// Handle success - you might want to update some state or UI based on the created key
} catch (error) {
@ -4873,7 +4874,7 @@ export const updateInternalUserSettings = async (accessToken: string, settings:
const data = await response.json();
console.log("Updated internal user settings:", data);
NotificationsManager.success("Internal user settings updated successfully");
NotificationsManager.success(i18n.t("networking.internalUserSettingsUpdated"));
return data;
} catch (error) {
console.error("Failed to update internal user settings:", error);

View file

@ -8732,5 +8732,12 @@
"passwordHelpSignup": "Create a password for your account"
},
"loading": "Loading..."
},
"networking": {
"sessionExpired": "UI Session Expired. Logging out.",
"modelCreated": "Model {{model}} created successfully",
"valueUpdated": "Successfully updated value!",
"fieldReset": "Field reset on proxy",
"internalUserSettingsUpdated": "Internal user settings updated successfully"
}
}

View file

@ -8732,5 +8732,12 @@
"passwordHelpSignup": "为您的账户创建密码"
},
"loading": "加载中..."
},
"networking": {
"sessionExpired": "UI 会话已过期,正在退出登录。",
"modelCreated": "模型 {{model}} 创建成功",
"valueUpdated": "更新成功!",
"fieldReset": "字段已在代理上重置",
"internalUserSettingsUpdated": "内部用户设置更新成功"
}
}