diff --git a/README.md b/README.md index a583764..74b4bca 100644 --- a/README.md +++ b/README.md @@ -23,9 +23,7 @@ ## 声明 1. 本项目遵循 [MIT开源协议](/LICENSE),主要用于技术研究和学习,使用本项目时需遵守所在地法律法规、相关政策以及企业章程,禁止用于任何违法或侵犯他人权益的行为。任何个人、团队和企业,无论以何种方式使用该项目、对何对象提供服务,所产生的一切后果,本项目均不承担任何责任 -2. 境内使用该项目时,推荐使用国内厂商的大模型服务,并进行必要的内容安全审核及过滤 -3. 本项目当前主要接入协同办公平台,推荐使用飞书、钉钉、企微自建应用、网页、公众号等接入通道,其他通道持续扩展中,欢迎贡献代码或提交反馈 -4. 成本与安全:Agent模式下Token使用量高于普通对话模式,请根据效果及成本综合选择模型。Agent具有访问所在操作系统的能力,请谨慎选择项目部署环境。同时项目也会持续升级安全机制、并降低模型消耗成本 +2. 成本与安全:Agent模式下Token使用量高于普通对话模式,请根据效果及成本综合选择模型。Agent具有访问所在操作系统的能力,请谨慎选择项目部署环境。同时项目也会持续升级安全机制、并降低模型消耗成本 ## 演示 diff --git a/agent/protocol/agent_stream.py b/agent/protocol/agent_stream.py index 52a2fa9..4d516d8 100644 --- a/agent/protocol/agent_stream.py +++ b/agent/protocol/agent_stream.py @@ -5,7 +5,7 @@ Provides streaming output, event system, and complete tool-call loop """ import json import time -from typing import List, Dict, Any, Optional, Callable +from typing import List, Dict, Any, Optional, Callable, Tuple from agent.protocol.models import LLMRequest, LLMModel from agent.tools.base_tool import BaseTool, ToolResult @@ -84,7 +84,7 @@ class AgentStreamExecutor: args_str = json.dumps(args, sort_keys=True, ensure_ascii=False) return hashlib.md5(args_str.encode()).hexdigest()[:8] - def _check_consecutive_failures(self, tool_name: str, args: dict) -> tuple[bool, str, bool]: + def _check_consecutive_failures(self, tool_name: str, args: dict) -> Tuple[bool, str, bool]: """ Check if tool has failed too many times consecutively or called repeatedly with same args @@ -456,7 +456,7 @@ class AgentStreamExecutor: return final_response - def _call_llm_stream(self, retry_on_empty=True, retry_count=0, max_retries=3) -> tuple[str, List[Dict]]: + def _call_llm_stream(self, retry_on_empty=True, retry_count=0, max_retries=3) -> Tuple[str, List[Dict]]: """ Call LLM with streaming and automatic retry on errors diff --git a/agent/tools/utils/truncate.py b/agent/tools/utils/truncate.py index 1b0c1e0..c2ed0f6 100644 --- a/agent/tools/utils/truncate.py +++ b/agent/tools/utils/truncate.py @@ -8,7 +8,7 @@ Truncation is based on two independent limits - whichever is hit first wins: Never returns partial lines (except bash tail truncation edge case). """ -from typing import Dict, Any, Optional, Literal +from typing import Dict, Any, Optional, Literal, Tuple DEFAULT_MAX_LINES = 2000 @@ -278,7 +278,7 @@ def _truncate_string_to_bytes_from_end(text: str, max_bytes: int) -> str: return encoded[start:].decode('utf-8', errors='ignore') -def truncate_line(line: str, max_chars: int = GREP_MAX_LINE_LENGTH) -> tuple[str, bool]: +def truncate_line(line: str, max_chars: int = GREP_MAX_LINE_LENGTH) -> Tuple[str, bool]: """ Truncate single line to max characters, add [truncated] suffix. Used for grep match lines.