fix: enforce the image generation flag on the legacy chat feature path (#27759)
* fix: enforce the image generation flag on the legacy chat feature path * fix: refresh the config store when image generation is disabled in admin settings * fix: hide active feature pills when the feature is no longer available
This commit is contained in:
3 files changed
+18
-4
No files matched your search
@@ -1716,6 +1716,19 @@ async def chat_image_generation_handler(request: Request, form_data: dict, extra
|
|||||||
|
|
||||||
system_message_content = f'<context>Image generation was attempted but failed. The system is currently unable to generate the image. Tell the user that the following error occurred: {error_message}</context>'
|
system_message_content = f'<context>Image generation was attempted but failed. The system is currently unable to generate the image. Tell the user that the following error occurred: {error_message}</context>'
|
||||||
|
|
||||||
|
elif not await Config.get('image_generation.enable'):
|
||||||
|
await __event_emitter__(
|
||||||
|
{
|
||||||
|
'type': 'status',
|
||||||
|
'data': {
|
||||||
|
'description': 'Image generation is disabled',
|
||||||
|
'done': True,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
system_message_content = '<context>Image generation was requested but the feature is currently disabled by the administrator, so no image was created. Let the user know that image generation is currently unavailable.</context>'
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Create image(s)
|
# Create image(s)
|
||||||
if await Config.get('image_generation.prompt.enable'):
|
if await Config.get('image_generation.prompt.enable'):
|
||||||
|
|||||||
@@ -150,8 +150,9 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
|
backendConfig.set(await getBackendConfig());
|
||||||
|
|
||||||
if (res.ENABLE_IMAGE_GENERATION) {
|
if (res.ENABLE_IMAGE_GENERATION) {
|
||||||
backendConfig.set(await getBackendConfig());
|
|
||||||
getModels();
|
getModels();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2241,7 +2241,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
|
|
||||||
{#if webSearchEnabled}
|
{#if webSearchEnabled && showWebSearchButton}
|
||||||
<Tooltip content={$i18n.t('Web Search')} placement="top">
|
<Tooltip content={$i18n.t('Web Search')} placement="top">
|
||||||
<button
|
<button
|
||||||
on:click|preventDefault={() => (webSearchEnabled = !webSearchEnabled)}
|
on:click|preventDefault={() => (webSearchEnabled = !webSearchEnabled)}
|
||||||
@@ -2259,7 +2259,7 @@
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if imageGenerationEnabled}
|
{#if imageGenerationEnabled && showImageGenerationButton}
|
||||||
<Tooltip content={$i18n.t('Image')} placement="top">
|
<Tooltip content={$i18n.t('Image')} placement="top">
|
||||||
<button
|
<button
|
||||||
on:click|preventDefault={() =>
|
on:click|preventDefault={() =>
|
||||||
@@ -2277,7 +2277,7 @@
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if codeInterpreterEnabled}
|
{#if codeInterpreterEnabled && showCodeInterpreterButton}
|
||||||
<Tooltip content={$i18n.t('Code Interpreter')} placement="top">
|
<Tooltip content={$i18n.t('Code Interpreter')} placement="top">
|
||||||
<button
|
<button
|
||||||
aria-label={codeInterpreterEnabled
|
aria-label={codeInterpreterEnabled
|
||||||
|
|||||||
Reference in new issue
Block a user