feat(FN-1151): preserve and display planning conversation history
- Persist per-turn thinking output for planning and mission interview sessions, including history serialization and recovery-safe state fields - Add shared conversation history parsing/API types and a reusable timeline component with formatted answers and expandable AI reasoning - Restore and render conversation history across Planning Mode, Mission Interview, and Subtask Breakdown modals during resume and live question flow - Harden response submission with nullable-question guards and expand unit/e2e coverage for history rendering and persistence behavior
This commit is contained in:
@@ -3302,6 +3302,12 @@ export interface AiSessionSummary {
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
export interface ConversationHistoryEntry {
|
||||
question?: PlanningQuestion;
|
||||
response?: Record<string, unknown>;
|
||||
thinkingOutput?: string;
|
||||
}
|
||||
|
||||
export interface AiSessionDetail extends AiSessionSummary {
|
||||
inputPayload: string;
|
||||
conversationHistory: string;
|
||||
@@ -3312,6 +3318,17 @@ export interface AiSessionDetail extends AiSessionSummary {
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
export function parseConversationHistory(raw: string): ConversationHistoryEntry[] {
|
||||
if (!raw) return [];
|
||||
|
||||
try {
|
||||
const parsed = JSON.parse(raw);
|
||||
return Array.isArray(parsed) ? parsed : [];
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
export async function fetchAiSessions(projectId?: string): Promise<AiSessionSummary[]> {
|
||||
const params = projectId ? `?projectId=${encodeURIComponent(projectId)}` : "";
|
||||
const res = await fetch(buildApiUrl(`/ai-sessions${params}`));
|
||||
|
||||
Reference in New Issue
Block a user