Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
# src/services/llm/__init__.py
|
||||
"""LLM服务模块"""
|
||||
|
||||
from .llm_factory import LLMFactory, get_llm_client
|
||||
@@ -12,4 +11,4 @@ __all__ = [
|
||||
"BaseLLMClient", "LLMResponse", "LLMConfig", "LLMProvider",
|
||||
"DeepSeekClient", "QwenClient", "QwenVLClient",
|
||||
"DocumentSummarizer", "summarize_document", "DocumentSummary"
|
||||
]
|
||||
]
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# src/services/llm/base_client.py
|
||||
"""LLM客户端基类 - 统一接口定义"""
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
@@ -113,4 +112,4 @@ class BaseLLMClient(ABC):
|
||||
# 中文字符约1.5 token,英文约0.25 token
|
||||
chinese_chars = sum(1 for c in text if '一' <= c <= '鿿')
|
||||
other_chars = len(text) - chinese_chars
|
||||
return int(chinese_chars * 1.5 + other_chars * 0.25)
|
||||
return int(chinese_chars * 1.5 + other_chars * 0.25)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# src/services/llm/deepseek_client.py
|
||||
"""DeepSeek LLM客户端 - OpenAI兼容API"""
|
||||
|
||||
import time
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# src/services/llm/document_summarizer.py
|
||||
"""文档摘要生成服务 - LLM生成法规文档摘要"""
|
||||
|
||||
from typing import Dict, Optional
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# src/services/llm/llm_factory.py
|
||||
"""LLM工厂 - 统一创建和管理LLM客户端"""
|
||||
|
||||
from typing import Optional, Dict, Any
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# src/services/llm/qwen_client.py
|
||||
"""Qwen LLM客户端 - 支持OpenAI兼容API格式"""
|
||||
|
||||
import time
|
||||
|
||||
Reference in New Issue
Block a user