From 6696eb2fd467677ae32c2f35c36c1804e159b01e Mon Sep 17 00:00:00 2001 From: SengokuCola <1026294844@qq.com> Date: Mon, 20 Apr 2026 23:40:20 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E5=8F=AF=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E5=BC=95=E7=94=A8=E5=9B=9E=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config/config.py | 2 +- src/config/official_configs.py | 9 +++++++++ src/maisaka/builtin_tool/reply.py | 14 ++++++++++---- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/config/config.py b/src/config/config.py index 006c8ae1..6301a199 100644 --- a/src/config/config.py +++ b/src/config/config.py @@ -55,7 +55,7 @@ BOT_CONFIG_PATH: Path = (CONFIG_DIR / "bot_config.toml").resolve().absolute() MODEL_CONFIG_PATH: Path = (CONFIG_DIR / "model_config.toml").resolve().absolute() LEGACY_ENV_PATH: Path = (PROJECT_ROOT / ".env").resolve().absolute() MMC_VERSION: str = "1.0.0" -CONFIG_VERSION: str = "8.9.4" +CONFIG_VERSION: str = "8.9.5" MODEL_CONFIG_VERSION: str = "1.14.1" logger = get_logger("config") diff --git a/src/config/official_configs.py b/src/config/official_configs.py index d68e707d..bf90c876 100644 --- a/src/config/official_configs.py +++ b/src/config/official_configs.py @@ -194,6 +194,15 @@ class ChatConfig(ConfigBase): inevitable_at_reply: bool = Field(default=True) """是否启用at必回复""" + enable_reply_quote: bool = Field( + default=True, + json_schema_extra={ + "x-widget": "switch", + "x-icon": "quote", + }, + ) + """是否启用回复时附带引用回复""" + max_context_size: int = Field( default=30, json_schema_extra={ diff --git a/src/maisaka/builtin_tool/reply.py b/src/maisaka/builtin_tool/reply.py index c3d3bf4a..a2d3ddbc 100644 --- a/src/maisaka/builtin_tool/reply.py +++ b/src/maisaka/builtin_tool/reply.py @@ -1,12 +1,14 @@ """reply 内置工具。""" -import traceback from typing import Optional +import traceback + from src.chat.replyer.replyer_manager import replyer_manager from src.cli.maisaka_cli_sender import CLI_PLATFORM_NAME, render_cli_message from src.common.data_models.reply_generation_data_models import ReplyGenerationResult from src.common.logger import get_logger +from src.config import config as config_module from src.core.tooling import ToolExecutionContext, ToolExecutionResult, ToolInvocation, ToolSpec from src.services import send_service @@ -84,6 +86,8 @@ async def handle_tool( reference_info = str(invocation.arguments.get("reference_info") or "").strip() target_message_id = str(invocation.arguments.get("msg_id") or "").strip() set_quote = bool(invocation.arguments.get("set_quote", True)) + enable_reply_quote = bool(config_module.global_config.chat.enable_reply_quote) + effective_set_quote = set_quote and enable_reply_quote if not target_message_id: return tool_ctx.build_failure_result( @@ -172,8 +176,8 @@ async def handle_tool( sent_message = await send_service.text_to_stream_with_message( text=segment, stream_id=tool_ctx.runtime.session_id, - set_reply=set_quote if index == 0 else False, - reply_message=target_message if set_quote and index == 0 else None, + set_reply=effective_set_quote if index == 0 else False, + reply_message=target_message if effective_set_quote and index == 0 else None, selected_expressions=reply_result.selected_expression_ids or None, typing=index > 0, sync_to_maisaka_history=True, @@ -202,6 +206,7 @@ async def handle_tool( structured_content={ "msg_id": target_message_id, "set_quote": set_quote, + "effective_set_quote": effective_set_quote, "reply_segments": reply_segments, }, metadata=reply_metadata, @@ -217,7 +222,7 @@ async def handle_tool( await tool_ctx.runtime.track_reply_effect( tool_call_id=invocation.call_id, target_message=target_message, - set_quote=set_quote, + set_quote=effective_set_quote, reply_text=combined_reply_text, reply_segments=reply_segments, planner_reasoning=latest_thought, @@ -231,6 +236,7 @@ async def handle_tool( structured_content={ "msg_id": target_message_id, "set_quote": set_quote, + "effective_set_quote": effective_set_quote, "reply_text": combined_reply_text, "reply_segments": reply_segments, "target_user_name": target_user_name,