feat(chat): add regenerate endpoint for chat threads to support editing and reloading responses

This commit is contained in:
DESKTOP-RTLN3BA\$punk 2026-01-23 01:42:10 -08:00
parent 14b6001489
commit ad475397c4
5 changed files with 691 additions and 10 deletions

View file

@ -160,6 +160,30 @@ export async function getThreadFull(threadId: number): Promise<ThreadRecord> {
return baseApiService.get<ThreadRecord>(`/api/v1/threads/${threadId}/full`);
}
/**
* Regeneration request parameters
*/
export interface RegenerateParams {
searchSpaceId: number;
userQuery?: string | null; // New user query (for edit). Null/undefined = reload with same query
attachments?: Array<{
id: string;
name: string;
type: string;
content: string;
}>;
mentionedDocumentIds?: number[];
mentionedSurfsenseDocIds?: number[];
}
/**
* Get the URL for the regenerate endpoint (for streaming fetch)
*/
export function getRegenerateUrl(threadId: number): string {
const backendUrl = process.env.NEXT_PUBLIC_FASTAPI_BACKEND_URL || "http://localhost:8000";
return `${backendUrl}/api/v1/threads/${threadId}/regenerate`;
}
// =============================================================================
// Thread List Manager (for thread list sidebar)
// =============================================================================