fix(cv): gate AI proposals on grounding and source freshness
This commit is contained in:
@@ -105,6 +105,12 @@ export type CvVariant = {
|
||||
|
||||
export type CvVariantVersionInfo = { version: number; source: string; createdAtUtc: string; isCurrent: boolean };
|
||||
export type CvRender = { themeId: string; html: string; suggestedFileName: string };
|
||||
export type CvAiProposal = { original: string; result: string; proposalToken: string };
|
||||
export type CvAiInput = { action: string; text?: string; targetId?: string; role?: string; language?: string; context?: string };
|
||||
export type CvAiCallbacks = {
|
||||
onGenerate: (input: CvAiInput) => Promise<CvAiProposal>;
|
||||
onAccept: (proposal: CvAiProposal, result?: string) => Promise<void>;
|
||||
};
|
||||
|
||||
export const AI_ACTIONS: { key: string; label: string }[] = [
|
||||
{ key: "improve", label: "Improve writing" },
|
||||
@@ -277,7 +283,9 @@ export const cvBuilderApi = {
|
||||
versions: (id: number) => api.get<CvVariantVersionInfo[]>(`/cv/variants/${id}/versions`).then((r) => r.data),
|
||||
restore: (id: number, version: number, expectedVersion: number) => api.post<CvVariant>(`/cv/variants/${id}/versions/${version}/restore`, { expectedVersion }).then((r) => r.data),
|
||||
previewSettings: (settings: CvVariantSettings) => api.post<CvRender>("/cv/preview", { settings }).then((r) => r.data),
|
||||
aiAssist: (body: { action: string; text: string; role?: string; language?: string; context?: string }) =>
|
||||
api.post<{ original: string; result: string }>("/cv/ai/assist", body).then((r) => r.data),
|
||||
aiAssist: (body: CvAiInput & { variantId: number; expectedVersion: number }) =>
|
||||
api.post<CvAiProposal>("/cv/ai/assist", body).then((r) => r.data),
|
||||
applyAi: (id: number, body: { proposalToken: string; result?: string }) =>
|
||||
api.post<CvVariant>(`/cv/variants/${id}/ai/apply`, body).then((r) => r.data),
|
||||
exportPdfUrl: (id: number) => `/cv/variants/${id}/export-pdf`,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user