better:优化快捷设置

This commit is contained in:
SengokuCola
2025-05-29 21:42:58 +08:00
parent 14da50ba33
commit d0f9cf9c7b
2 changed files with 44 additions and 25 deletions

View File

@@ -56,6 +56,15 @@ class ConfigEditor:
self.main_frame.columnconfigure(1, weight=1) self.main_frame.columnconfigure(1, weight=1)
self.main_frame.rowconfigure(1, weight=1) # 修改为1因为第0行是版本号 self.main_frame.rowconfigure(1, weight=1) # 修改为1因为第0行是版本号
# 默认选择快捷设置栏
self.current_section = "quick_settings"
self.create_quick_settings_widgets()
# 选中导航树中的快捷设置项
for item in self.tree.get_children():
if self.tree.item(item)["values"][0] == "quick_settings":
self.tree.selection_set(item)
break
def load_editor_config(self): def load_editor_config(self):
"""加载编辑器配置""" """加载编辑器配置"""
try: try:
@@ -539,13 +548,13 @@ class ConfigEditor:
current = current.get(key, {}) current = current.get(key, {})
value = current.get(path[-1]) # 获取最后一个键的值 value = current.get(path[-1]) # 获取最后一个键的值
# 创建名称标签 # 创建名称标签(加粗)
name_label = ttk.Label(frame, text=setting["name"], font=("微软雅黑", 18)) name_label = ttk.Label(frame, text=setting["name"], font=("微软雅黑", 16, "bold"))
name_label.pack(fill=tk.X, padx=5, pady=(2, 0)) name_label.pack(fill=tk.X, padx=5, pady=(2, 0))
# 创建描述标签 # 创建描述标签
if setting.get("description"): if setting.get("description"):
desc_label = ttk.Label(frame, text=setting['description'], foreground="gray", font=("微软雅黑", 16)) desc_label = ttk.Label(frame, text=setting['description'], foreground="gray", font=("微软雅黑", 10))
desc_label.pack(fill=tk.X, padx=5, pady=(0, 2)) desc_label.pack(fill=tk.X, padx=5, pady=(0, 2))
# 根据类型创建不同的控件 # 根据类型创建不同的控件
@@ -562,14 +571,14 @@ class ConfigEditor:
elif setting_type == "text": elif setting_type == "text":
value = str(value) if value is not None else "" value = str(value) if value is not None else ""
var = tk.StringVar(value=value) var = tk.StringVar(value=value)
entry = ttk.Entry(frame, textvariable=var, width=40, font=("微软雅黑", 18)) entry = ttk.Entry(frame, textvariable=var, width=40, font=("微软雅黑", 12))
entry.pack(fill=tk.X, padx=5, pady=(0,5)) entry.pack(fill=tk.X, padx=5, pady=(0,5))
var.trace_add("write", lambda *args, p=path, v=var: self.on_quick_setting_changed(p, v)) var.trace_add("write", lambda *args, p=path, v=var: self.on_quick_setting_changed(p, v))
elif setting_type == "number": elif setting_type == "number":
value = str(value) if value is not None else "0" value = str(value) if value is not None else "0"
var = tk.StringVar(value=value) var = tk.StringVar(value=value)
entry = ttk.Entry(frame, textvariable=var, width=10, font=("微软雅黑", 18)) entry = ttk.Entry(frame, textvariable=var, width=10, font=("微软雅黑", 12))
entry.pack(fill=tk.X, padx=5, pady=(0,5)) entry.pack(fill=tk.X, padx=5, pady=(0,5))
var.trace_add("write", lambda *args, p=path, v=var: self.on_quick_setting_changed(p, v)) var.trace_add("write", lambda *args, p=path, v=var: self.on_quick_setting_changed(p, v))

View File

@@ -8,6 +8,12 @@ window_width = 1000
window_height = 800 window_height = 800
save_delay = 1.0 save_delay = 1.0
[[editor.quick_settings.items]]
name = "核心性格"
description = "麦麦的核心性格描述建议50字以内"
path = "personality.personality_core"
type = "text"
[[editor.quick_settings.items]] [[editor.quick_settings.items]]
name = "性格细节" name = "性格细节"
description = "麦麦性格的细节描述条数任意不能为0" description = "麦麦性格的细节描述条数任意不能为0"
@@ -33,53 +39,57 @@ path = "chat.chat_mode"
type = "text" type = "text"
[[editor.quick_settings.items]] [[editor.quick_settings.items]]
name = "退出专注阈值" name = "回复频率normal模式"
description = "自动退出专注聊天的阈值,越低越容易退出专注聊天" description = "麦麦回复频率一般为1默认频率下30分钟麦麦回复30条约数"
path = "chat.exit_focus_threshold" path = "normal_chat.talk_frequency"
type = "number" type = "number"
[[editor.quick_settings.items]] [[editor.quick_settings.items]]
name = "偷取表情包" name = "自动专注阈值auto模式"
description = "是否偷取表情包,让麦麦可以发送她保存的这些表情包"
path = "emoji.steal_emoji"
type = "bool"
[[editor.quick_settings.items]]
name = "核心性格"
description = "麦麦的核心性格描述建议50字以内"
path = "personality.personality_core"
type = "text"
[[editor.quick_settings.items]]
name = "自动专注阈值"
description = "自动切换到专注聊天的阈值,越低越容易进入专注聊天" description = "自动切换到专注聊天的阈值,越低越容易进入专注聊天"
path = "chat.auto_focus_threshold" path = "chat.auto_focus_threshold"
type = "number" type = "number"
[[editor.quick_settings.items]] [[editor.quick_settings.items]]
name = "自我识别处理器" name = "退出专注阈值auto模式"
description = "自动退出专注聊天的阈值,越低越容易退出专注聊天"
path = "chat.exit_focus_threshold"
type = "number"
[[editor.quick_settings.items]]
name = "思考间隔focus模式"
description = "思考的时间间隔(秒),可以有效减少消耗"
path = "focus_chat.think_interval"
type = "number"
[[editor.quick_settings.items]]
name = "自我识别处理器focus模式"
description = "是否启用自我识别处理器" description = "是否启用自我识别处理器"
path = "focus_chat_processor.self_identify_processor" path = "focus_chat_processor.self_identify_processor"
type = "bool" type = "bool"
[[editor.quick_settings.items]] [[editor.quick_settings.items]]
name = "工具使用处理器" name = "工具使用处理器focus模式"
description = "是否启用工具使用处理器" description = "是否启用工具使用处理器"
path = "focus_chat_processor.tool_use_processor" path = "focus_chat_processor.tool_use_processor"
type = "bool" type = "bool"
[[editor.quick_settings.items]] [[editor.quick_settings.items]]
name = "工作记忆处理器" name = "工作记忆处理器focus模式"
description = "是否启用工作记忆处理器,不稳定,消耗量大" description = "是否启用工作记忆处理器,不稳定,消耗量大"
path = "focus_chat_processor.working_memory_processor" path = "focus_chat_processor.working_memory_processor"
type = "bool" type = "bool"
[[editor.quick_settings.items]] [[editor.quick_settings.items]]
name = "显示聊天模式" name = "显示聊天模式debug模式"
description = "是否在回复后显示当前聊天模式" description = "是否在回复后显示当前聊天模式"
path = "experimental.debug_show_chat_mode" path = "experimental.debug_show_chat_mode"
type = "bool" type = "bool"
[translations.sections.inner] [translations.sections.inner]
name = "版本" name = "版本"
description = "麦麦的内部配置,包含版本号等信息。此部分仅供显示,不可编辑。" description = "麦麦的内部配置,包含版本号等信息。此部分仅供显示,不可编辑。"