import os from modelscope_studio.components.pro.chatbot import ChatbotActionConfig, ChatbotBotConfig, ChatbotUserConfig, ChatbotWelcomeConfig, ChatbotMarkdownConfig from modelscope_studio.components.pro.multimodal_input import MultimodalInputUploadConfig from example_prompts import get_example_prompts save_history = True MINISTRAL_MODELS = { "14B": { "instruct": "mistralai/Ministral-3-14B-Instruct-2512-BF16", "reasoning": "mistralai/Ministral-3-14B-Reasoning-2512" }, "8B": { "instruct": "mistralai/Ministral-3-8B-Instruct-2512-BF16", "reasoning": "mistralai/Ministral-3-8B-Reasoning-2512" }, "3B": { "instruct": "mistralai/Ministral-3-3B-Instruct-2512-BF16", "reasoning": "mistralai/Ministral-3-3B-Reasoning-2512" } } DEFAULT_MODEL_SIZE = "3B" def markdown_config(): return ChatbotMarkdownConfig() def user_config(disabled_actions=None): return ChatbotUserConfig( class_names=dict(content="user-message-content"), actions=[ "copy", "edit", ChatbotActionConfig( action="delete", popconfirm=dict(title="Delete the message", description="Are you sure to delete this message?", okButtonProps=dict(danger=True))) ], disabled_actions=disabled_actions) def bot_config(disabled_actions=None): return ChatbotBotConfig(actions=[ "copy", "edit", ChatbotActionConfig( action="retry", popconfirm=dict( title="Regenerate the message", description="Regenerate the message will also delete all subsequent messages.", okButtonProps=dict(danger=True))), ChatbotActionConfig(action="delete", popconfirm=dict( title="Delete the message", description="Are you sure to delete this message?", okButtonProps=dict(danger=True))) ], avatar="./assets/m-boxed-rainbow.png", disabled_actions=disabled_actions) def welcome_config(): return ChatbotWelcomeConfig( variant="borderless", icon="./assets/m-boxed-rainbow.png", title="", description="Enter text and upload images to get started.", prompts=dict( title="How can I help you today?", styles={ "list": { "width": '100%', }, "item": { "flex": 1, }, }, items=get_example_prompts()), ) def upload_config(): return MultimodalInputUploadConfig( accept="image/*,video/*", placeholder={ "inline": { "title": "Upload files", "description": "Click or drag files to this area to upload images or videos" }, "drop": { "title": "Drop files here", } }) DEFAULT_SYS_PROMPT = "You are a helpful and harmless assistant." LIGHT_THEME = { "token": { "colorPrimary": "#FF8205", "colorSuccess": "#FFAF00", "colorWarning": "#FFD800", "colorError": "#E10500", "colorInfo": "#FA500F", "colorBgLayout": "#FFFAEB", "colorBgContainer": "#FFF0C3", "colorBgElevated": "#FFFAEB", "colorBorder": "#E9E2CB", "colorText": "#000000", "colorTextSecondary": "#1E1E1E", "borderRadius": 8, }, "algorithm": "default" } DARK_THEME = { "token": { "colorPrimary": "#FF8205", "colorSuccess": "#FFAF00", "colorWarning": "#FFD800", "colorError": "#E10500", "colorInfo": "#FA500F", "colorBgLayout": "#000000", "colorBgContainer": "#1E1E1E", "colorBgElevated": "#2a2a2a", "colorBorder": "#3a3a3a", "colorText": "#FFFAEB", "colorTextSecondary": "#E9E2CB", "borderRadius": 8, }, "algorithm": "dark" } DEFAULT_THEME = LIGHT_THEME