feat:可关闭引用回复
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -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={
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user