feat:webui支持更加优化的模型配置,优化多处UI体验,支持设置视觉和cache价格,修复多重表达不生效的问题,修复表情包路径错误
This commit is contained in:
@@ -58,7 +58,7 @@ LEGACY_ENV_PATH: Path = (PROJECT_ROOT / ".env").resolve().absolute()
|
||||
A_MEMORIX_LEGACY_CONFIG_PATH: Path = (CONFIG_DIR / "a_memorix.toml").resolve().absolute()
|
||||
MMC_VERSION: str = "1.0.0-pre.10"
|
||||
CONFIG_VERSION: str = "8.10.6"
|
||||
MODEL_CONFIG_VERSION: str = "1.14.8"
|
||||
MODEL_CONFIG_VERSION: str = "1.15.3"
|
||||
|
||||
logger = get_logger("config")
|
||||
|
||||
|
||||
@@ -135,7 +135,6 @@ class ConfigBase(BaseModel, AttrDocBase):
|
||||
__ui_parent__: ClassVar[str] = "" # 父配置类在 Config 中的字段名,空表示独立 Tab
|
||||
__ui_label__: ClassVar[str] = "" # Tab 显示名称(仅做 Tab 主人时使用),空则使用 classDoc
|
||||
__ui_icon__: ClassVar[str] = "" # Tab 图标名称(Lucide 图标名)
|
||||
__ui_merge_children__: ClassVar[List[str]] = [] # 在 WebUI 中并入当前配置卡片展示的子配置字段名
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, attribute_data: AttributeData, data: dict[str, Any]):
|
||||
|
||||
@@ -402,6 +402,7 @@ class TaskConfig(ConfigBase):
|
||||
"x-widget": "input",
|
||||
"x-icon": "alert-circle",
|
||||
"step": 0.1,
|
||||
"advanced": True,
|
||||
},
|
||||
)
|
||||
"""慢请求阈值(秒),超过此值会输出警告日志"""
|
||||
@@ -420,15 +421,6 @@ class TaskConfig(ConfigBase):
|
||||
class ModelTaskConfig(ConfigBase):
|
||||
"""模型配置类"""
|
||||
|
||||
utils: TaskConfig = Field(
|
||||
default_factory=TaskConfig,
|
||||
json_schema_extra={
|
||||
"x-widget": "custom",
|
||||
"x-icon": "wrench",
|
||||
},
|
||||
)
|
||||
"""组件使用的模型, 例如表情包模块, 取名模块, 关系模块, 麦麦的情绪变化等,是麦麦必须的模型"""
|
||||
|
||||
replyer: TaskConfig = Field(
|
||||
default_factory=TaskConfig,
|
||||
json_schema_extra={
|
||||
@@ -436,17 +428,7 @@ class ModelTaskConfig(ConfigBase):
|
||||
"x-icon": "message-square",
|
||||
},
|
||||
)
|
||||
"""首要回复模型配置"""
|
||||
|
||||
learner: TaskConfig = Field(
|
||||
default_factory=TaskConfig,
|
||||
json_schema_extra={
|
||||
"x-widget": "custom",
|
||||
"x-icon": "graduation-cap",
|
||||
"advanced": True,
|
||||
},
|
||||
)
|
||||
"""学习模型配置,用于表达方式学习和黑话学习;留空时自动继用 utils 模型"""
|
||||
"""回复模型配置"""
|
||||
|
||||
planner: TaskConfig = Field(
|
||||
default_factory=TaskConfig,
|
||||
@@ -457,6 +439,25 @@ class ModelTaskConfig(ConfigBase):
|
||||
)
|
||||
"""规划模型配置"""
|
||||
|
||||
utils: TaskConfig = Field(
|
||||
default_factory=TaskConfig,
|
||||
json_schema_extra={
|
||||
"x-widget": "custom",
|
||||
"x-icon": "wrench",
|
||||
},
|
||||
)
|
||||
"""组件使用的模型, 例如表情包模块, 取名模块, 关系模块, 麦麦的情绪变化等,是麦麦必须的模型"""
|
||||
|
||||
learner: TaskConfig = Field(
|
||||
default_factory=TaskConfig,
|
||||
json_schema_extra={
|
||||
"x-widget": "custom",
|
||||
"x-icon": "graduation-cap",
|
||||
"advanced": True,
|
||||
},
|
||||
)
|
||||
"""学习模型配置,用于表达方式学习和黑话学习;留空时自动继用 utils 模型"""
|
||||
|
||||
vlm: TaskConfig = Field(
|
||||
default_factory=TaskConfig,
|
||||
json_schema_extra={
|
||||
@@ -471,6 +472,7 @@ class ModelTaskConfig(ConfigBase):
|
||||
json_schema_extra={
|
||||
"x-widget": "custom",
|
||||
"x-icon": "volume-2",
|
||||
"advanced": True,
|
||||
},
|
||||
)
|
||||
"""语音识别模型配置"""
|
||||
|
||||
@@ -84,6 +84,8 @@ class PersonalityConfig(ConfigBase):
|
||||
json_schema_extra={
|
||||
"x-widget": "textarea",
|
||||
"x-icon": "user-circle",
|
||||
"x-textarea-min-height": 40,
|
||||
"x-textarea-rows": 1,
|
||||
},
|
||||
)
|
||||
"""人格,建议200字以内,描述人格特质和身份特征;可以写完整设定。要求第二人称"""
|
||||
@@ -93,6 +95,8 @@ class PersonalityConfig(ConfigBase):
|
||||
json_schema_extra={
|
||||
"x-widget": "textarea",
|
||||
"x-icon": "message-square",
|
||||
"x-textarea-min-height": 40,
|
||||
"x-textarea-rows": 1,
|
||||
},
|
||||
)
|
||||
"""默认表达风格,描述麦麦说话的表达风格,表达习惯,如要修改,可以酌情新增内容,建议1-2行"""
|
||||
@@ -321,7 +325,8 @@ class ChatConfig(ConfigBase):
|
||||
class MessageReceiveConfig(ConfigBase):
|
||||
"""消息接收配置类"""
|
||||
|
||||
__ui_parent__ = "response_post_process"
|
||||
__ui_label__ = "消息接收"
|
||||
__ui_icon__ = "message-square-text"
|
||||
|
||||
image_parse_threshold: int = Field(
|
||||
default=5,
|
||||
@@ -394,7 +399,7 @@ class TargetItem(ConfigBase):
|
||||
class MemoryConfig(ConfigBase):
|
||||
"""记忆配置类"""
|
||||
|
||||
__ui_parent__ = "emoji"
|
||||
__ui_parent__ = "a_memorix"
|
||||
|
||||
|
||||
global_memory: bool = Field(
|
||||
@@ -1051,7 +1056,7 @@ class LearningItem(ConfigBase):
|
||||
"x-icon": "message-square",
|
||||
},
|
||||
)
|
||||
"""是否启用表达学习"""
|
||||
"""是否使用表达"""
|
||||
|
||||
enable_learning: bool = Field(
|
||||
default=True,
|
||||
@@ -1060,7 +1065,7 @@ class LearningItem(ConfigBase):
|
||||
"x-icon": "graduation-cap",
|
||||
},
|
||||
)
|
||||
"""是否启用表达优化学习"""
|
||||
"""是否学习表达"""
|
||||
|
||||
enable_jargon_learning: bool = Field(
|
||||
default=False,
|
||||
@@ -1069,7 +1074,7 @@ class LearningItem(ConfigBase):
|
||||
"x-icon": "book",
|
||||
},
|
||||
)
|
||||
"""是否启用jargon学习"""
|
||||
"""是否学习黑话"""
|
||||
|
||||
class ExpressionGroup(ConfigBase):
|
||||
"""表达互通组配置类,若列表为空代表全局共享"""
|
||||
@@ -1177,7 +1182,8 @@ class ExpressionConfig(ConfigBase):
|
||||
class VoiceConfig(ConfigBase):
|
||||
"""语音识别配置类"""
|
||||
|
||||
__ui_parent__ = "emoji"
|
||||
__ui_label__ = "语音"
|
||||
__ui_icon__ = "mic"
|
||||
|
||||
enable_asr: bool = Field(
|
||||
default=False,
|
||||
@@ -1192,8 +1198,8 @@ class VoiceConfig(ConfigBase):
|
||||
class EmojiConfig(ConfigBase):
|
||||
"""表情包配置类"""
|
||||
|
||||
__ui_label__ = "功能"
|
||||
__ui_icon__ = "puzzle"
|
||||
__ui_label__ = "表情包"
|
||||
__ui_icon__ = "smile"
|
||||
|
||||
emoji_send_num: int = Field(
|
||||
default=25,
|
||||
@@ -1314,7 +1320,7 @@ class KeywordRuleConfig(ConfigBase):
|
||||
class KeywordReactionConfig(ConfigBase):
|
||||
"""关键词配置类"""
|
||||
|
||||
__ui_parent__ = "response_post_process"
|
||||
__ui_parent__ = "message_receive"
|
||||
|
||||
keyword_rules: list[KeywordRuleConfig] = Field(
|
||||
default_factory=lambda: [],
|
||||
@@ -1345,9 +1351,8 @@ class KeywordReactionConfig(ConfigBase):
|
||||
class ResponsePostProcessConfig(ConfigBase):
|
||||
"""回复后处理配置类"""
|
||||
|
||||
__ui_label__ = "处理"
|
||||
__ui_label__ = "后处理"
|
||||
__ui_icon__ = "settings"
|
||||
__ui_merge_children__ = ["chinese_typo", "response_splitter"]
|
||||
|
||||
enable_response_post_process: bool = Field(
|
||||
default=True,
|
||||
|
||||
Reference in New Issue
Block a user