mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-09-12 06:59:07 +00:00
fix(frontend): localize Settings load errors (#5337)
Co-authored-by: ming <silverchris@foxmail.com>
This commit is contained in:
parent
c9c7076ba7
commit
452d09b96b
@ -546,7 +546,9 @@ export function MemorySettingsPage() {
|
|||||||
{t.common.loading}
|
{t.common.loading}
|
||||||
</div>
|
</div>
|
||||||
) : error ? (
|
) : error ? (
|
||||||
<div>Error: {error.message}</div>
|
<div>
|
||||||
|
{t.common.error} {error.message}
|
||||||
|
</div>
|
||||||
) : !memory ? (
|
) : !memory ? (
|
||||||
<div className="text-muted-foreground text-sm">
|
<div className="text-muted-foreground text-sm">
|
||||||
{t.settings.memory.empty}
|
{t.settings.memory.empty}
|
||||||
|
|||||||
@ -57,7 +57,9 @@ export function SkillSettingsPage({ onClose }: { onClose?: () => void } = {}) {
|
|||||||
{t.settings.skills.adminRequired}
|
{t.settings.skills.adminRequired}
|
||||||
</div>
|
</div>
|
||||||
) : error ? (
|
) : error ? (
|
||||||
<div>Error: {error.message}</div>
|
<div>
|
||||||
|
{t.common.error} {error.message}
|
||||||
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<SkillSettingsList skills={skills} onClose={onClose} />
|
<SkillSettingsList skills={skills} onClose={onClose} />
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -55,7 +55,9 @@ export function ToolSettingsPage() {
|
|||||||
{t.settings.tools.adminRequired}
|
{t.settings.tools.adminRequired}
|
||||||
</div>
|
</div>
|
||||||
) : error ? (
|
) : error ? (
|
||||||
<div>Error: {error.message}</div>
|
<div>
|
||||||
|
{t.common.error} {error.message}
|
||||||
|
</div>
|
||||||
) : (
|
) : (
|
||||||
config && <MCPServerList servers={config.mcp_servers} />
|
config && <MCPServerList servers={config.mcp_servers} />
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -38,6 +38,7 @@ export const enUS: Translations = {
|
|||||||
custom: "Custom",
|
custom: "Custom",
|
||||||
notAvailableInDemoMode: "Not available in demo mode",
|
notAvailableInDemoMode: "Not available in demo mode",
|
||||||
loading: "Loading...",
|
loading: "Loading...",
|
||||||
|
error: "Error:",
|
||||||
version: "Version",
|
version: "Version",
|
||||||
lastUpdated: "Last updated",
|
lastUpdated: "Last updated",
|
||||||
code: "Code",
|
code: "Code",
|
||||||
|
|||||||
@ -27,6 +27,7 @@ export interface Translations {
|
|||||||
custom: string;
|
custom: string;
|
||||||
notAvailableInDemoMode: string;
|
notAvailableInDemoMode: string;
|
||||||
loading: string;
|
loading: string;
|
||||||
|
error: string;
|
||||||
version: string;
|
version: string;
|
||||||
lastUpdated: string;
|
lastUpdated: string;
|
||||||
code: string;
|
code: string;
|
||||||
|
|||||||
@ -38,6 +38,7 @@ export const zhCN: Translations = {
|
|||||||
custom: "自定义",
|
custom: "自定义",
|
||||||
notAvailableInDemoMode: "在演示模式下不可用",
|
notAvailableInDemoMode: "在演示模式下不可用",
|
||||||
loading: "加载中...",
|
loading: "加载中...",
|
||||||
|
error: "错误:",
|
||||||
version: "版本",
|
version: "版本",
|
||||||
lastUpdated: "最后更新",
|
lastUpdated: "最后更新",
|
||||||
code: "代码",
|
code: "代码",
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import { ToolSettingsPage } from "@/components/workspace/settings/tool-settings-
|
|||||||
|
|
||||||
const mcpMockState = rs.hoisted(() => ({
|
const mcpMockState = rs.hoisted(() => ({
|
||||||
isPending: false,
|
isPending: false,
|
||||||
|
error: null as Error | null,
|
||||||
mutate: rs.fn(),
|
mutate: rs.fn(),
|
||||||
updateIsPending: false,
|
updateIsPending: false,
|
||||||
updateMutate: rs.fn(),
|
updateMutate: rs.fn(),
|
||||||
@ -27,6 +28,7 @@ rs.mock("@/core/i18n/hooks", () => ({
|
|||||||
useI18n: () => ({
|
useI18n: () => ({
|
||||||
t: {
|
t: {
|
||||||
common: {
|
common: {
|
||||||
|
error: "Error:",
|
||||||
loading: "Loading",
|
loading: "Loading",
|
||||||
cancel: "Cancel",
|
cancel: "Cancel",
|
||||||
save: "Save",
|
save: "Save",
|
||||||
@ -67,7 +69,7 @@ rs.mock("@/core/mcp/hooks", () => ({
|
|||||||
useMCPConfig: () => ({
|
useMCPConfig: () => ({
|
||||||
config: { mcp_servers: mcpMockState.servers },
|
config: { mcp_servers: mcpMockState.servers },
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
error: null,
|
error: mcpMockState.error,
|
||||||
}),
|
}),
|
||||||
useEnableMCPServer: () => ({
|
useEnableMCPServer: () => ({
|
||||||
isPending: mcpMockState.isPending,
|
isPending: mcpMockState.isPending,
|
||||||
@ -118,6 +120,7 @@ function definitionTextbox(): HTMLTextAreaElement {
|
|||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
mcpMockState.isPending = false;
|
mcpMockState.isPending = false;
|
||||||
|
mcpMockState.error = null;
|
||||||
mcpMockState.updateIsPending = false;
|
mcpMockState.updateIsPending = false;
|
||||||
mcpMockState.mutate.mockReset();
|
mcpMockState.mutate.mockReset();
|
||||||
mcpMockState.updateMutate.mockReset();
|
mcpMockState.updateMutate.mockReset();
|
||||||
@ -126,6 +129,14 @@ afterEach(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("ToolSettingsPage MCP switches", () => {
|
describe("ToolSettingsPage MCP switches", () => {
|
||||||
|
it("renders a localized load error", () => {
|
||||||
|
mcpMockState.error = new Error("request failed");
|
||||||
|
|
||||||
|
render(<ToolSettingsPage />);
|
||||||
|
|
||||||
|
expect(screen.getByText("Error: request failed")).toBeDefined();
|
||||||
|
});
|
||||||
|
|
||||||
it("disables every switch while a targeted update is pending", () => {
|
it("disables every switch while a targeted update is pending", () => {
|
||||||
twoServers();
|
twoServers();
|
||||||
mcpMockState.isPending = true;
|
mcpMockState.isPending = true;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user