Chainlit / chainlit

Build Conversational AI in minutes ⚡️
https://docs.chainlit.io
Apache License 2.0
7.24k stars 955 forks source link

disabled microphone #1516

Closed cesi08 closed 1 week ago

cesi08 commented 1 week ago

with chainlit version 1.2.0 in wich way i can disable/hide the microphone? image

dokterbob commented 1 week ago

@dosu Anything in the config for disabling audio or the microphone?

dosubot[bot] commented 1 week ago

To disable or hide the microphone in Chainlit version 1.2.0, you need to set the audio.enabled feature to false in the configuration. This can be done by modifying the config object, which is defined in the backend/chainlit/config.py file. Ensure that config.features.audio.enabled is set to false. This will prevent the microphone button from being rendered in the UI [1][2].

To continue talking to Dosu, mention @dosu.

cesi08 commented 1 week ago

@dosu i have try

from chainlit.config import config
config.features.audio.enabled = False

but the microphone still appared

dosubot[bot] commented 1 week ago

After modifying the config object, you need to call the reload_config() function to apply the configuration changes. This function updates the global config object with the new settings, which should prevent the microphone button from appearing [1].

To continue talking to Dosu, mention @dosu.

cesi08 commented 1 week ago

@dosu it does not work

from chainlit.config import config, reload_config config.features.audio.enabled = False reload_config()

cesi08 commented 1 week ago

@dosu ? suggestion?

dosubot[bot] commented 1 week ago

If the microphone button is still appearing after setting config.features.audio.enabled to False and calling reload_config(), there might be other factors affecting the configuration. Here are a few suggestions to troubleshoot the issue:

  1. Check for Overrides: Ensure there are no other parts of your code or configuration files that might be overriding this setting. Double-check any configuration files like config.toml or other scripts that might modify the config object.

  2. Frontend Caching: The frontend might be caching the previous configuration. Try clearing your browser cache or using a different browser to see if the changes take effect.

  3. Auto-reload: Make sure you are running your application with the -w flag, like chainlit run app.py -w, to enable auto-reloading. This ensures that the UI components are refreshed when configuration files are updated [1].

  4. Dependencies: Verify that all dependencies are up to date and correctly installed, as they might affect the UI components [2].

If none of these steps resolve the issue, consider checking the logs for any errors or warnings that might provide more insight into why the configuration changes are not being applied.

To continue talking to Dosu, mention @dosu.

cesi08 commented 1 week ago

@dosu not works

dosubot[bot] commented 1 week ago

If the previous suggestions didn't work, let's try a few more steps:

  1. Direct Configuration File Edit: Instead of modifying the config object in your script, try directly editing the configuration file (e.g., config.toml or similar) if it exists, and set audio.enabled = false there.

  2. Environment Variables: Check if there are any environment variables that might be overriding your configuration settings. Sometimes, environment variables can take precedence over code-based configurations.

  3. Rebuild the Frontend: If you have access to the frontend code, try rebuilding it to ensure that any changes in configuration are reflected. This can be done by running the build command for the frontend, usually something like npm run build or yarn build.

  4. Check for Hardcoded Values: Ensure there are no hardcoded values in the frontend code that might be forcing the microphone button to appear regardless of the configuration.

  5. Debugging: Add some logging or debugging statements in the MicButton component to verify if the isEnabled variable is being set correctly. This can help identify if the configuration is being read properly.

If these steps still don't resolve the issue, there might be a deeper problem in how the configuration is being applied or read.

To continue talking to Dosu, mention @dosu.

dokterbob commented 1 week ago

@dosu i have try

from chainlit.config import config
config.features.audio.enabled = False

but the microphone still appared

Config updating doesn't really work (its on the roadmap). You'd best edit the config file on-disk, then restart chainlit.

Let me know if there's any issues with that, in which case you can re-open this issue.

cesi08 commented 1 week ago

@dokterbob in wich way i can edit config.toml? beacause i ve tried

[features.audio] enabled = false

but didn't work ( i have restarted chainlit)