mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-02-14 02:55:11 -05:00
31 lines
887 B
TypeScript
31 lines
887 B
TypeScript
import type { components } from 'services/api/schema';
|
|
|
|
import { api, buildV1Url } from '..';
|
|
|
|
/**
|
|
* Builds an endpoint URL for the utilities router
|
|
* @example
|
|
* buildUtilitiesUrl('some-path')
|
|
* // '/api/v1/utilities/some-path'
|
|
*/
|
|
const buildUtilitiesUrl = (path: string = '') => buildV1Url(`utilities/${path}`);
|
|
|
|
export const utilitiesApi = api.injectEndpoints({
|
|
endpoints: (build) => ({
|
|
dynamicPrompts: build.query<
|
|
components['schemas']['DynamicPromptsResponse'],
|
|
{ prompt: string; max_prompts: number }
|
|
>({
|
|
query: (arg) => ({
|
|
url: buildUtilitiesUrl('dynamicprompts'),
|
|
body: arg,
|
|
method: 'POST',
|
|
}),
|
|
keepUnusedDataFor: 86400, // 24 hours
|
|
// We need to fetch this on reconnect bc the user may have changed the text field while
|
|
// disconnected.
|
|
providesTags: ['FetchOnReconnect'],
|
|
}),
|
|
}),
|
|
});
|