feat: add thread status read views

This commit is contained in:
kris
2026-04-04 11:39:06 +08:00
parent 7d578aa12f
commit 010d8eda2d
8 changed files with 580 additions and 1 deletions

View File

@@ -0,0 +1,34 @@
import { NextRequest, NextResponse } from "next/server";
import { requireRequestSession } from "@/lib/boss-auth";
import { readState } from "@/lib/boss-data";
export async function GET(
request: NextRequest,
context: { params: Promise<{ projectId: string }> },
) {
const session = await requireRequestSession(request);
if (!session) {
return NextResponse.json({ ok: false, message: "UNAUTHORIZED" }, { status: 401 });
}
const { projectId } = await context.params;
const state = await readState();
const project = state.projects.find((item) => item.id === projectId);
if (!project) {
return NextResponse.json({ ok: false, message: "PROJECT_NOT_FOUND" }, { status: 404 });
}
const threadStatusDocument =
state.threadStatusDocuments.find((item) => item.projectId === projectId) ?? null;
const recentProgressEvents = state.threadProgressEvents
.filter((item) => item.projectId === projectId)
.sort((a, b) => b.createdAt.localeCompare(a.createdAt))
.slice(0, 5);
return NextResponse.json({
ok: true,
projectId,
threadStatusDocument,
recentProgressEvents,
});
}

View File

@@ -762,7 +762,7 @@ export function ChatBubble({ message }: { message: Message }) {
export function ProjectHeaderActions({ projectId }: { projectId: string }) {
return (
<div className="grid grid-cols-3 gap-3">
<div className="grid grid-cols-2 gap-3 sm:grid-cols-4">
<Link
href={`/conversations/${projectId}/goals`}
className="flex h-11 items-center justify-center rounded-2xl bg-[#EAF7F0] text-[14px] font-semibold text-[#215B39]"
@@ -781,6 +781,14 @@ export function ProjectHeaderActions({ projectId }: { projectId: string }) {
>
</Link>
<Link
href={`/api/v1/projects/${projectId}/thread-status`}
target="_blank"
rel="noreferrer"
className="flex h-11 items-center justify-center rounded-2xl bg-white text-[14px] font-semibold text-[#111111]"
>
线
</Link>
</div>
);
}