From 87a6a03943f52898cb86470a5bf27f6be1cd0b0c Mon Sep 17 00:00:00 2001 From: JOJO <1498581755@qq.com> Date: Sun, 26 Jul 2026 00:55:46 +0800 Subject: [PATCH] =?UTF-8?q?feat(settings):=20=E6=96=B0=E5=BB=BA=E5=AF=B9?= =?UTF-8?q?=E8=AF=9D=E6=8C=89=E9=92=AE=E8=A1=8C=E4=B8=BA=E5=8F=AF=E9=80=89?= =?UTF-8?q?=EF=BC=8C=E7=A7=BB=E9=99=A4=E6=A0=B9=E7=9B=AE=E5=BD=95=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E6=96=87=E4=BB=B6=E4=B8=8E=E8=AF=8A=E6=96=AD=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/file_manager/crud_mixin.py | 12 -- modules/personalization_manager.py | 11 +- server/app_legacy.py | 15 -- static/src/app/methods/conversation/action.ts | 17 ++ .../personalization/PersonalizationDrawer.vue | 176 +++--------------- static/src/stores/personalization.ts | 8 +- 6 files changed, 49 insertions(+), 190 deletions(-) diff --git a/modules/file_manager/crud_mixin.py b/modules/file_manager/crud_mixin.py index 36752a54..85d2b8fb 100644 --- a/modules/file_manager/crud_mixin.py +++ b/modules/file_manager/crud_mixin.py @@ -64,18 +64,6 @@ class CrudMixin: relative_path = self._relative_path(full_path) try: - # 检查是否允许在根目录创建文件 - personalization_config = self._load_personalization_config() - allow_root_creation = bool( - personalization_config.get("allow_root_file_creation", False) - ) if isinstance(personalization_config, dict) else False - - if full_path.parent == self.project_path and not allow_root_creation: - return { - "success": False, - "error": "禁止在项目根目录直接创建文件,请先创建或选择合适的子目录。", - "suggestion": "然后必须**重新**再次创建文件。" - } if self._use_container(): result = self._container_call("create_file", { "path": relative_path, diff --git a/modules/personalization_manager.py b/modules/personalization_manager.py index 91d072b3..7f0dc517 100644 --- a/modules/personalization_manager.py +++ b/modules/personalization_manager.py @@ -103,7 +103,7 @@ DEFAULT_PERSONALIZATION_CONFIG: Dict[str, Any] = { "versioning_backup_mode": "shallow", # 文件备份方式:shallow-浅备份(只备份AI编辑的文件)/ full-完全备份(整个工作区) "versioning_restore_mode": "overwrite", # 版本回溯模式固定为 overwrite "agents_md_auto_inject": False, # AGENTS.md 自动注入开关 - "allow_root_file_creation": False, # 允许在根目录创建文件开关 + "new_chat_button_behavior": "route", # 新建对话按钮行为:route-跳转空白新对话页 / blank-立即创建空对话 "default_hide_workspace": False, # 默认隐藏工作区 "hide_quick_dock": False, # 隐藏快捷窗口(对话区右侧的待办/子智能体/后台指令/文件窗口列) "group_sidebar_by_workspace": False, # 侧边栏按工作区/项目分组显示对话 @@ -517,11 +517,12 @@ def sanitize_personalization_payload( else: base["agents_md_auto_inject"] = bool(base.get("agents_md_auto_inject", False)) - # 允许根目录创建文件开关 - if "allow_root_file_creation" in data: - base["allow_root_file_creation"] = bool(data.get("allow_root_file_creation")) + # 新建对话按钮行为:route-跳转空白新对话页 / blank-立即创建空对话 + new_chat_behavior = data.get("new_chat_button_behavior", base.get("new_chat_button_behavior")) + if isinstance(new_chat_behavior, str) and new_chat_behavior.strip().lower() in ("route", "blank"): + base["new_chat_button_behavior"] = new_chat_behavior.strip().lower() else: - base["allow_root_file_creation"] = bool(base.get("allow_root_file_creation", False)) + base["new_chat_button_behavior"] = "route" # 默认隐藏工作区 if "default_hide_workspace" in data: diff --git a/server/app_legacy.py b/server/app_legacy.py index ee18bc62..d4cfe813 100644 --- a/server/app_legacy.py +++ b/server/app_legacy.py @@ -1134,21 +1134,6 @@ def resource_busy_page(): return app.send_static_file('resource_busy.html'), 503 -@app.route('/api/voice_debug', methods=['POST']) -def voice_debug(): - """接收手机端语音调试日志""" - import os, datetime - data = request.get_data(as_text=True) - log_dir = os.environ.get('LOGS_DIR', os.path.join(os.path.dirname(__file__), '..', 'logs')) - voice_log_dir = os.path.join(log_dir, 'voice_debug') - os.makedirs(voice_log_dir, exist_ok=True) - ts = datetime.datetime.now().strftime('%Y%m%d_%H%M%S') - filename = os.path.join(voice_log_dir, f'voice_{ts}.log') - with open(filename, 'w') as f: - f.write(data) - return jsonify({'ok': True, 'file': filename}) - - @app.route('/api/client_debug_log', methods=['POST']) def client_debug_log(): """接收前端目标模式等调试日志""" diff --git a/static/src/app/methods/conversation/action.ts b/static/src/app/methods/conversation/action.ts index 60be32fa..74c83453 100644 --- a/static/src/app/methods/conversation/action.ts +++ b/static/src/app/methods/conversation/action.ts @@ -62,6 +62,23 @@ export const actionMethods = { keepalive: true }).catch(() => {}); + // 按个性化设置分流:route-跳转空白新对话页(发送首条消息时才真正创建); + // blank-保持现有行为,立即创建空对话 + let newChatBehavior = 'route'; + try { + newChatBehavior = usePersonalizationStore()?.form?.new_chat_button_behavior || 'route'; + } catch (error) { + console.warn('读取新建对话按钮行为设置失败,按默认跳转处理:', error); + } + if (newChatBehavior !== 'blank') { + const target = this.multiAgentMode ? '/multiagent/new' : '/new'; + const normalize = (p) => String(p || '/').replace(/^\/+|\/+$/g, ''); + if (normalize(window.location.pathname) !== normalize(target)) { + window.location.href = target; + } + return; + } + // 应用个性化设置中的默认模型和思考模式 try { const personalizationStore = usePersonalizationStore(); diff --git a/static/src/components/personalization/PersonalizationDrawer.vue b/static/src/components/personalization/PersonalizationDrawer.vue index 7092c93a..6c103570 100644 --- a/static/src/components/personalization/PersonalizationDrawer.vue +++ b/static/src/components/personalization/PersonalizationDrawer.vue @@ -431,21 +431,6 @@ -