merge: 合入 main(PR #4 搜索 API + MCP 截图识别),解决 .gitignore 冲突

This commit is contained in:
ABAPPLO
2026-08-27 16:32:03 +08:00
15 changed files with 358 additions and 37 deletions

View File

@@ -498,6 +498,9 @@ export default function Home({ currentUser }: { currentUser: AuthUser }) {
const [activeNav, setActiveNav] = useState<NavKey>("overview");
const [loading, setLoading] = useState(true);
const [working, setWorking] = useState(false);
const [collectingDistributionIds, setCollectingDistributionIds] = useState<Set<string>>(
new Set(),
);
const [error, setError] = useState("");
const [toast, setToast] = useState("");
const [menuOpen, setMenuOpen] = useState(false);
@@ -767,10 +770,23 @@ export default function Home({ currentUser }: { currentUser: AuthUser }) {
};
const collectMetrics = async (distribution: Distribution) => {
await runAction(
{ action: "collect_now", distributionId: distribution.id },
"公开数据已更新",
);
setCollectingDistributionIds((current) => {
const next = new Set(current);
next.add(distribution.id);
return next;
});
try {
await runAction(
{ action: "collect_now", distributionId: distribution.id },
"公开数据已更新",
);
} finally {
setCollectingDistributionIds((current) => {
const next = new Set(current);
next.delete(distribution.id);
return next;
});
}
};
const updateDistributionPublishUrl = async (
@@ -1141,6 +1157,7 @@ export default function Home({ currentUser }: { currentUser: AuthUser }) {
tasks={data.tasks}
distributions={data.distributions}
working={working}
collectingDistributionIds={collectingDistributionIds}
canUpdatePublishUrl={isManager}
onCollect={collectMetrics}
onUpdatePublishUrl={updateDistributionPublishUrl}
@@ -3882,6 +3899,7 @@ function RecoveryPage({
tasks,
distributions,
working,
collectingDistributionIds,
canUpdatePublishUrl,
onCollect,
onUpdatePublishUrl,
@@ -3896,6 +3914,7 @@ function RecoveryPage({
tasks: Task[];
distributions: Distribution[];
working: boolean;
collectingDistributionIds: ReadonlySet<string>;
canUpdatePublishUrl: boolean;
onCollect: (distribution: Distribution) => void;
onUpdatePublishUrl: (distribution: Distribution) => void;
@@ -4183,7 +4202,9 @@ function RecoveryPage({
</span>
) : item.screenshot_key ? (
<span className="creator-ocr-failed">
待KOC填写数据
{item.ocr_status === "processing"
? "正在识别数据"
: "识别失败,请手动填写"}
</span>
) : null}
{item.screenshot_key &&
@@ -4206,7 +4227,12 @@ function RecoveryPage({
) : (
<button
className="collect-button"
disabled={working || !noteUrl}
disabled={
!noteUrl ||
(working &&
(collectingDistributionIds.size === 0 ||
collectingDistributionIds.has(item.id)))
}
onClick={() => onCollect(item)}
>
{noteUrl ? "立即采集" : "待填链接"}