Skip to content

Commit 584a2f5

Browse files
feat: Display research history for completed/errored researches
Adds a collapsible section to the research details page to display the research history. This section is only visible when the research is completed or in an error state. The history is fetched from the `research_status_history` table and displayed using the `ResearchStatusHistoryDisplay` component. The section is collapsed by default.
1 parent c0704c2 commit 584a2f5

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ app.get("/details/:id", async (c) => {
273273
.replaceAll("```", "");
274274

275275
let statusHistory: any[] = [];
276-
if (resp.results && resp.results.status === 1) {
276+
if (resp.results && (resp.results.status === 1 || resp.results.status === 2 || resp.results.status === 3)) {
277277
const historyQb = new D1QB(c.env.DB);
278278
const historyResult = await historyQb
279279
.select<{ status_text: string; timestamp: string }>(

src/templates/layout.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,16 @@ export const ResearchDetails: FC = (props) => {
609609
</div>
610610
)}
611611

612+
{/* Add this new section for research history */}
613+
{(researchData.status === 2 || researchData.status === 3) && researchData.statusHistory && researchData.statusHistory.length > 0 && (
614+
<details className="mt-4 mb-8">
615+
<summary className="cursor-pointer font-semibold text-gray-800 mb-3">Research History</summary>
616+
<div className="mt-2">
617+
<ResearchStatusHistoryDisplay statusHistory={researchData.statusHistory} />
618+
</div>
619+
</details>
620+
)}
621+
612622
{/* Report Content - direct child of main */}
613623
{researchData.status !== 1 && (
614624
<div className="prose prose-lg max-w-none">

0 commit comments

Comments
 (0)