diff --git a/api-reference/chat-profiles.mdx b/api-reference/chat-profiles.mdx index 3fc5089..e7dfe0b 100644 --- a/api-reference/chat-profiles.mdx +++ b/api-reference/chat-profiles.mdx @@ -88,3 +88,37 @@ async def on_chat_start(): content=f"starting chat with {user.identifier} using the {chat_profile} chat profile" ).send() ``` + +## Dynamic Configuration + +You can override the global `config.toml` for specific ChatProfiles by configuring overrides + +```python +from chainlit.config import ( + ChainlitConfigOverrides, + FeaturesSettings, + McpFeature, + UISettings, +) + +@cl.set_chat_profiles +async def chat_profile(current_user: cl.User): + return [ + cl.ChatProfile( + name="MCP Enabled", + markdown_description="Profile with **MCP features enabled**. This profile has *Model Context Protocol* support activated. [Learn more](https://example.com/mcp)", + icon="https://picsum.photos/250", + starters=starters, + config_overrides=ChainlitConfigOverrides( + ui=UISettings(name="MCP UI"), + features=FeaturesSettings( + mcp=McpFeature( + enabled=True, + stdio={"enabled": True}, + sse={"enabled": True}, + streamable_http={"enabled": True}, + ) + ), + ), + ), +``` \ No newline at end of file diff --git a/backend/config/overview.mdx b/backend/config/overview.mdx index 949fa0a..bdce4dc 100644 --- a/backend/config/overview.mdx +++ b/backend/config/overview.mdx @@ -4,6 +4,8 @@ title: "Overview" The `.chainlit/config.toml` file is created when you run `chainlit run ...` or `chainlit init`. It allows you to configure your Chainlit app and to enable/disable specific features. +You can also dynamically override specific `config.toml` variables by Chat Profile at runtime. See [Dynamic Profile-based Configuration](/api-reference/lifecycle-hooks/on-profile-switch) for details. + It is composed of three sections: