ui/client/features/story/services/StoryAiApi
the client calls behind the two AI-assisted story flows (design 9.6), backed by ui/server/src/storyAiApi.mjs.
Cockpit client (features), next. Source: ui/client/features/story/services/StoryAiApi.ts.
Type Aliases#
StoryExtractResult#
StoryExtractResult = {
calls:number;feature:string;ok:true;rejected:object[];sentBytes:number;url:string;values:Record<string,string|string[]>; } | {code:"MODEL_OFFLINE";error:string;ok:false; } | {code:"NOTHING_VERIFIED";error:string;ok:false;rejected:object[]; } | {code:string;error:string;ok:false; }
Defined in: ui/client/features/story/services/StoryAiApi.ts:17
StoryPatternProposeResult#
StoryPatternProposeResult = {
calls:number;feature:string;ok:true;parse:Record<string,StorySelector>;rejectedFields:object[];sentBytes:number;truncated:boolean;url:string; } | {code:"MODEL_OFFLINE";error:string;ok:false; } | {code:string;error:string;ok:false;rejectedFields?:object[]; }
Defined in: ui/client/features/story/services/StoryAiApi.ts:12
StorySkeletonResult#
StorySkeletonResult = {
bytes:number;ok:true;text:string;truncated:boolean; } | {code:string;error:string;ok:false; }
Defined in: ui/client/features/story/services/StoryAiApi.ts:8
Variables#
StoryAiApi#
constStoryAiApi:object
Defined in: ui/client/features/story/services/StoryAiApi.ts:25
Type Declaration#
extractValues()
extractValues(
input):Promise<StoryExtractResult>
"Extraction on every use": one model call over html that proposes field VALUES directly; every value is
mechanically re-verified as quoted text before being returned (unverifiable values are rejected, never
handed back as if real). Feed values to StoryBridgeApi.valuesPreview/.valuesSave to land it as a diff.
Parameters
input
feature
string
fields?
string[]
html
string
url
string
Returns
Promise<StoryExtractResult>
proposePattern()
proposePattern(
input):Promise<StoryPatternProposeResult>
"AI proposes the parse pattern ONCE": one model call over html (already fetched via StoryApi.fetch) that
proposes selectors, each re-validated and proved to match before being returned. Feed the result's parse
to StoryBridgeApi.preview/.save to land it as a diff -- this call never writes anything itself.
Parameters
input
feature
string
html
string
url
string
Returns
Promise<StoryPatternProposeResult>
skeleton()
skeleton(
html):Promise<StorySkeletonResult>
Structure-only skeleton of html (design 9.6, login-only pages) -- no model call, shown to the user before
anything is sent anywhere.
Parameters
html
string
Returns
Promise<StorySkeletonResult>