mudler / LocalAI

:robot: The free, Open Source alternative to OpenAI, Claude and others. Self-hosted and local-first. Drop-in replacement for OpenAI, running on consumer-grade hardware. No GPU required. Runs gguf, transformers, diffusers and many more models architectures. Features: Generate Text, Audio, Video, Images, Voice Cloning, Distributed inference
https://localai.io
MIT License
23.63k stars 1.81k forks source link

When using /images_settings, the chatgpt_telegram_bot example crashes #2634

Open greygoo opened 3 months ago

greygoo commented 3 months ago

LocalAI version: quay.io/go-skynet/local-ai:v1.18.0-ffmpeg rebuild with GO_TAGS=stablediffusion

Environment, CPU architecture, OS, and Version:

rtx4060/ryzen5700/32G

Describe the bug

NOTE: The affected code is not in the LocalAI repo, but at https://github.com/mudler/chatgpt_telegram_bot, it only gets used in the example documentation. No need to do anything, it's fixed here locally, this report is only for tracking (as I can't open one in the affected repo), I'll add a PR asap.

When using the /images_settings command of the telegram bot, python throws an error:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/telegram/ext/_application.py", line 1104, in process_update
    await coroutine
  File "/usr/local/lib/python3.11/site-packages/telegram/ext/_handler.py", line 141, in handle_update
    return await self.callback(update, context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/code/bot/bot.py", line 728, in image_settings_handle
    text, reply_markup = get_image_settings_menu(user_id)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/code/bot/bot.py", line 682, in get_image_settings_menu
    text = config.models["info"][current_model]["description"]
           ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
KeyError: 'stablediffusion'

To Reproduce See Description.

Expected behavior should show a image model setting menu

Logs

Additional context