Add profile generate refine via manager hint and auto-preview.

When Preview leaves fields empty, managers can send a hint plus the current profile so DeepSeek revises rules; generate now returns preview and empty_fields for the UI.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-16 22:25:27 +03:00
co-authored by Cursor
parent 71f8cf169e
commit 52185aeaa8
4 changed files with 203 additions and 35 deletions
+22 -3
View File
@@ -64,10 +64,29 @@ export function fetchTargetFields(): Promise<{ fields: TargetField[] }> {
return request<{ fields: TargetField[] }>("/parser-profiles/target-fields", undefined, ADMIN_BASE);
}
export function generateParserProfile(sample_post: string): Promise<{ profile: HeuristicProfile }> {
return request<{ profile: HeuristicProfile }>(
export function generateParserProfile(payload: {
sample_post: string;
hint?: string;
current_profile?: HeuristicProfile | Record<string, unknown> | null;
}): Promise<{
profile: HeuristicProfile;
preview: Record<string, string>;
empty_fields: string[];
}> {
return request<{
profile: HeuristicProfile;
preview: Record<string, string>;
empty_fields: string[];
}>(
"/parser-profiles/generate",
{ method: "POST", body: JSON.stringify({ sample_post }) },
{
method: "POST",
body: JSON.stringify({
sample_post: payload.sample_post,
hint: payload.hint || undefined,
current_profile: payload.current_profile || undefined,
}),
},
ADMIN_BASE,
);
}