Add reusable LLM parser profiles with multi-event extract.

Support kind=llm profiles (instruction/schema), optional multi-event posts via #eN URLs, and recover stale running/queued parse jobs after worker crashes.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-13 20:22:38 +03:00
co-authored by Cursor
parent 5811ecb134
commit 3f9dc6643b
27 changed files with 1334 additions and 205 deletions
+33 -3
View File
@@ -1,6 +1,7 @@
import { ADMIN_BASE, request } from "./client";
import type {
HeuristicProfile,
LlmProfile,
ParseChannel,
ParseChannelCreate,
ParseChannelUpdate,
@@ -10,7 +11,7 @@ import type {
TargetField,
} from "../types/admin";
export type { HeuristicProfile, TargetField } from "../types/admin";
export type { HeuristicProfile, LlmProfile, TargetField } from "../types/admin";
export function fetchChannels(): Promise<ParseChannel[]> {
return request<ParseChannel[]>("/parse-channels", undefined, ADMIN_BASE);
@@ -64,6 +65,10 @@ export function fetchTargetFields(): Promise<{ fields: TargetField[] }> {
return request<{ fields: TargetField[] }>("/parser-profiles/target-fields", undefined, ADMIN_BASE);
}
export function fetchLlmDefaults(): Promise<LlmProfile> {
return request<LlmProfile>("/parser-profiles/llm-defaults", undefined, ADMIN_BASE);
}
export function generateParserProfile(payload: {
sample_post: string;
hint?: string;
@@ -94,10 +99,35 @@ export function generateParserProfile(payload: {
export function previewParserProfile(
sample_post: string,
heuristic_profile: HeuristicProfile | Record<string, unknown>,
): Promise<{ fields: Record<string, string> }> {
return request<{ fields: Record<string, string> }>(
): Promise<{ fields: Record<string, string>; matched: boolean; missing_required: string[] }> {
return request<{ fields: Record<string, string>; matched: boolean; missing_required: string[] }>(
"/parser-profiles/preview",
{ method: "POST", body: JSON.stringify({ sample_post, heuristic_profile }) },
ADMIN_BASE,
);
}
export function previewLlmProfile(
sample_post: string,
llm_profile: LlmProfile | Record<string, unknown>,
): Promise<{
fields: Record<string, string>;
events: Record<string, string>[];
matched: boolean;
missing_required: string[];
is_event: boolean;
matched_count: number;
}> {
return request<{
fields: Record<string, string>;
events: Record<string, string>[];
matched: boolean;
missing_required: string[];
is_event: boolean;
matched_count: number;
}>(
"/parser-profiles/preview-llm",
{ method: "POST", body: JSON.stringify({ sample_post, llm_profile }) },
ADMIN_BASE,
);
}