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:
@@ -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,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user