mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(ui): remove isRefinerAvailable
state, update refiner node
We can derive `isRefinerAvailable` from the query result (eg are there any refiner models installed). This is a piece of server state, so by using the list models response directly, we can avoid needing to manually keep the client in sync with the server. Created a `useIsRefinerAvailable()` hook to return this boolean wherever it is needed. Also updated the main models & refiner models endpoints to only return the appropriate models. Now we don't need to filter the data on these endpoints.
This commit is contained in:
@ -148,7 +148,15 @@ const createModelEntities = <T extends AnyModelConfigEntity>(
|
||||
export const modelsApi = api.injectEndpoints({
|
||||
endpoints: (build) => ({
|
||||
getMainModels: build.query<EntityState<MainModelConfigEntity>, void>({
|
||||
query: () => ({ url: 'models/', params: { model_type: 'main' } }),
|
||||
query: () => {
|
||||
const params = {
|
||||
model_type: 'main',
|
||||
base_models: ['sd-1', 'sd-2', 'sdxl'],
|
||||
};
|
||||
|
||||
const query = queryString.stringify(params, { arrayFormat: 'none' });
|
||||
return `models/?${query}`;
|
||||
},
|
||||
providesTags: (result, error, arg) => {
|
||||
const tags: ApiFullTagDescription[] = [
|
||||
{ type: 'MainModel', id: LIST_TAG },
|
||||
@ -183,7 +191,7 @@ export const modelsApi = api.injectEndpoints({
|
||||
{
|
||||
query: () => ({
|
||||
url: 'models/',
|
||||
params: { model_type: 'main', base_models: 'sdxl-refiner' },
|
||||
params: { model_type: 'main', base_models: ['sdxl-refiner'] },
|
||||
}),
|
||||
providesTags: (result, error, arg) => {
|
||||
const tags: ApiFullTagDescription[] = [
|
||||
|
Reference in New Issue
Block a user