Spaces:
Running
on
Zero
Running
on
Zero
File size: 4,181 Bytes
0e59015 c7e3907 0e59015 e3f5f1d 0e59015 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
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
|