refactor: 移除未使用的导入和优化代码风格
本次提交主要包含以下代码重构和风格优化: - 从多个文件中移除了未被使用的导入,例如 `Dict`, `Any`, `List`, `os`, `threading` 等,以保持代码的整洁性。 - 统一了测试脚本中的输出格式,移除了不必要的 f-string,使代码更加简洁。 - 清理了部分冗余的类型提示,提升了代码的可读性。
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
|
||||
import asyncio
|
||||
import time
|
||||
from typing import List, Dict, Any
|
||||
from typing import List
|
||||
|
||||
|
||||
class MockMessage:
|
||||
@@ -129,7 +129,7 @@ async def test_message_driven_logic():
|
||||
)
|
||||
|
||||
# 统计结果
|
||||
print(f"\n=== 测试结果 ===")
|
||||
print("\n=== 测试结果 ===")
|
||||
print(f"思考循环次数: {chat_loop.thinking_cycles}")
|
||||
print(f"状态检查次数: {chat_loop.status_checks}")
|
||||
print(f"思考/检查比例: {chat_loop.thinking_cycles}/{chat_loop.status_checks}")
|
||||
@@ -163,7 +163,7 @@ async def test_no_message_scenario():
|
||||
if not has_new_messages:
|
||||
await asyncio.sleep(1.0)
|
||||
|
||||
print(f"无消息运行结果:")
|
||||
print("无消息运行结果:")
|
||||
print(f" 思考循环: {chat_loop.thinking_cycles} 次")
|
||||
print(f" 状态检查: {chat_loop.status_checks} 次")
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import asyncio
|
||||
import time
|
||||
from typing import Optional, List, Dict, Any
|
||||
from typing import Optional, Dict, Any
|
||||
from src.common.logger import get_logger
|
||||
from src.config.config import global_config
|
||||
|
||||
|
||||
@@ -8,8 +8,6 @@ import asyncio
|
||||
import time
|
||||
from typing import Dict, List, Optional, Any, Callable
|
||||
from dataclasses import dataclass
|
||||
from queue import Queue
|
||||
import threading
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from src.common.logger import get_logger
|
||||
from src.config.config import global_config
|
||||
|
||||
@@ -4,10 +4,8 @@ Bing search engine implementation
|
||||
import asyncio
|
||||
import functools
|
||||
import random
|
||||
import os
|
||||
import traceback
|
||||
from typing import Dict, List, Any
|
||||
from datetime import datetime, timedelta
|
||||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ URL parser tool implementation
|
||||
"""
|
||||
import asyncio
|
||||
import functools
|
||||
from typing import Any, Dict, List
|
||||
from typing import Any, Dict
|
||||
from exa_py import Exa
|
||||
import httpx
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
@@ -5,7 +5,7 @@ import asyncio
|
||||
from typing import Any, Dict, List
|
||||
|
||||
from src.common.logger import get_logger
|
||||
from src.plugin_system import BaseTool, ToolParamType, llm_api
|
||||
from src.plugin_system import BaseTool, ToolParamType
|
||||
from src.plugin_system.apis import config_api
|
||||
from src.common.cache_manager import tool_cache
|
||||
|
||||
|
||||
Reference in New Issue
Block a user