@vectoriox/iox-ui 5.154.0 → 5.155.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -204,6 +204,12 @@ export enum AssistRouteKey {
|
|
|
204
204
|
Photos = 'photos',
|
|
205
205
|
Run = 'run',
|
|
206
206
|
Undo = 'undo',
|
|
207
|
+
/** S7 Files box ▸ Generate: the cost before the button (and why it may not run). */
|
|
208
|
+
GenerateQuote = 'generateQuote',
|
|
209
|
+
/** S7: a press — candidates are made by a run. */
|
|
210
|
+
Generate = 'generate',
|
|
211
|
+
/** S7: the asker's run, polled until every candidate has settled. */
|
|
212
|
+
GenerateRun = 'generateRun',
|
|
207
213
|
}
|
|
208
214
|
|
|
209
215
|
/** The path templates, `:param` filled by `assistPath` — neither side hand-types a URL. */
|
|
@@ -214,6 +220,9 @@ export const ASSIST_ROUTES: Readonly<Record<AssistRouteKey, string>> = {
|
|
|
214
220
|
[AssistRouteKey.Photos]: 'admin/api/org/:orgId/ai/assist/photos',
|
|
215
221
|
[AssistRouteKey.Run]: 'admin/api/org/:orgId/ai/assist/turns/:turnId/run',
|
|
216
222
|
[AssistRouteKey.Undo]: 'admin/api/org/:orgId/ai/assist/turns/:turnId/undo',
|
|
223
|
+
[AssistRouteKey.GenerateQuote]: 'admin/api/org/:orgId/ai/assist/generate/quote',
|
|
224
|
+
[AssistRouteKey.Generate]: 'admin/api/org/:orgId/ai/assist/generate',
|
|
225
|
+
[AssistRouteKey.GenerateRun]: 'admin/api/org/:orgId/ai/assist/generate/:runId',
|
|
217
226
|
};
|
|
218
227
|
|
|
219
228
|
export class AssistPathError extends Error {}
|
|
@@ -328,3 +328,54 @@ export function generateOutcome(candidates: ReadonlyArray<GenerateCandidate>): G
|
|
|
328
328
|
done: candidates.length > 0 && candidates.every(c => FINAL.includes(c.state)),
|
|
329
329
|
};
|
|
330
330
|
}
|
|
331
|
+
|
|
332
|
+
// ── The wire: what the Files box asks and reads (the paths are `ASSIST_ROUTES` generateQuote · generate · generateRun) ──
|
|
333
|
+
|
|
334
|
+
/** Where a press stands. */
|
|
335
|
+
export enum GenerateRunStatus {
|
|
336
|
+
Queued = 'queued',
|
|
337
|
+
Making = 'making',
|
|
338
|
+
/** Every candidate settled (made, flagged or failed). */
|
|
339
|
+
Done = 'done',
|
|
340
|
+
/** The run itself could not go on (refused mid-way, or the server gave up) — what was made is still kept. */
|
|
341
|
+
Failed = 'failed',
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
export const FINAL_GENERATE_STATUSES: ReadonlyArray<GenerateRunStatus> = [GenerateRunStatus.Done, GenerateRunStatus.Failed];
|
|
345
|
+
|
|
346
|
+
/** `GET …/generate/quote?count=&model=` — the cost before the button, from the SERVER's prices and meter. */
|
|
347
|
+
export interface GenerateQuoteView {
|
|
348
|
+
/** Null when no model can make a picture on this studio's key (then `refusal` or `models: []` says why). */
|
|
349
|
+
readonly estimate: GenerateEstimate | null;
|
|
350
|
+
/** The model a press would run on (the asked one, else the studio's default). */
|
|
351
|
+
readonly model: string | null;
|
|
352
|
+
readonly models: ReadonlyArray<GenerateModelChoice>;
|
|
353
|
+
/** Why a press would be refused right now — the button is off and says this. Null = it may run. */
|
|
354
|
+
readonly refusal: AiRefusal | null;
|
|
355
|
+
/** Credits left this period; null on an own key. */
|
|
356
|
+
readonly remaining: number | null;
|
|
357
|
+
/** "Your look": the site's art direction in a few words, or null when the studio has no look to wear yet. */
|
|
358
|
+
readonly look: string | null;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/** `POST …/generate` → 202. */
|
|
362
|
+
export interface GenerateAccepted {
|
|
363
|
+
readonly runId: string;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/** `GET …/generate/:runId` — the asker's run. */
|
|
367
|
+
export interface GenerateRunView {
|
|
368
|
+
readonly runId: string;
|
|
369
|
+
readonly status: `${GenerateRunStatus}`;
|
|
370
|
+
readonly prompt: string;
|
|
371
|
+
readonly shape: string;
|
|
372
|
+
readonly count: number;
|
|
373
|
+
readonly look: boolean;
|
|
374
|
+
readonly model: string;
|
|
375
|
+
/** The cost shown and agreed to — the most the run may spend. */
|
|
376
|
+
readonly shown: number;
|
|
377
|
+
readonly candidates: ReadonlyArray<GenerateCandidate>;
|
|
378
|
+
readonly outcome: GenerateOutcome;
|
|
379
|
+
/** `Failed`: why, in a refusal code or a short reason — never a stack. */
|
|
380
|
+
readonly error?: string;
|
|
381
|
+
}
|