feat: localize optimizer interface

This commit is contained in:
Codex
2026-06-21 23:43:02 +08:00
parent 1298456683
commit 1596de4527
6 changed files with 72 additions and 56 deletions
+12 -12
View File
@@ -55,12 +55,12 @@ export default function Home() {
body: JSON.stringify(input),
});
const body = await response.json();
if (!response.ok) throw new Error(body.error ?? "Analyze failed");
if (!response.ok) throw new Error(body.error ?? "分析失败");
setJobId(body.job.id);
setFactCard(body.candidateFactCard);
setMessage("Candidate fact card created.");
setMessage("候选事实卡已生成。");
} catch (error) {
setMessage(error instanceof Error ? error.message : "Analyze failed");
setMessage(error instanceof Error ? error.message : "分析失败");
} finally {
setBusyAction(null);
}
@@ -77,11 +77,11 @@ export default function Home() {
body: JSON.stringify(toConfirmedFactCard(factCard)),
});
const body = await response.json();
if (!response.ok) throw new Error(body.error ?? "Confirm failed");
if (!response.ok) throw new Error(body.error ?? "确认失败");
setFactCard(body.factCard);
setMessage("Fact card confirmed.");
setMessage("事实卡已确认。");
} catch (error) {
setMessage(error instanceof Error ? error.message : "Confirm failed");
setMessage(error instanceof Error ? error.message : "确认失败");
} finally {
setBusyAction(null);
}
@@ -96,16 +96,16 @@ export default function Home() {
method: "POST",
});
const body = await response.json();
if (!response.ok) throw new Error(body.error ?? "Optimize failed");
if (!response.ok) throw new Error(body.error ?? "优化失败");
setOptimizedArticle(body.optimizedArticle);
setQaReport(body.qaReport);
setMessage(
body.qaReport.overall_status === "fail"
? "QA found hard failures; export is blocked."
: "Optimization complete.",
? "质检发现硬性失败,已阻止导出。"
: "优化完成。",
);
} catch (error) {
setMessage(error instanceof Error ? error.message : "Optimize failed");
setMessage(error instanceof Error ? error.message : "优化失败");
} finally {
setBusyAction(null);
}
@@ -115,7 +115,7 @@ export default function Home() {
<main className="app-shell">
<header className="topbar">
<div>
<h1>GEO Agent Article Optimizer</h1>
<h1>GEO </h1>
{message && <p>{message}</p>}
</div>
<button
@@ -123,7 +123,7 @@ export default function Home() {
onClick={optimize}
type="button"
>
{busyAction === "optimize" ? "Optimizing..." : "Optimize"}
{busyAction === "optimize" ? "优化中..." : "开始优化"}
</button>
</header>
<div className="workflow-grid">