2025-07-15 15:47:47 +08:00
|
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
2025-07-08 17:45:40 +08:00
|
|
|
|
"""
|
2025-07-15 15:47:47 +08:00
|
|
|
|
Core Module
|
|
|
|
|
|
核心模块
|
|
|
|
|
|
|
|
|
|
|
|
提供内容整合的核心服务,通过适配器模式与xhs_spider和document模块交互
|
2025-07-08 17:45:40 +08:00
|
|
|
|
"""
|
2025-04-17 11:05:46 +08:00
|
|
|
|
|
2025-07-15 18:20:36 +08:00
|
|
|
|
# 注意:ContentIntegrationService已移至api.services模块
|
|
|
|
|
|
# 这里不再导入,以避免与API服务冲突
|
2025-07-08 17:45:40 +08:00
|
|
|
|
|
2025-07-15 15:47:47 +08:00
|
|
|
|
# 导入适配器
|
|
|
|
|
|
from .xhs_adapter import XHSAdapter, XHSNote, XHSSearchResult
|
|
|
|
|
|
from .document_adapter import DocumentAdapter, DocumentContent, IntegratedContent
|
|
|
|
|
|
|
|
|
|
|
|
# 导入管理器
|
|
|
|
|
|
from .cookie_manager import CookieManager
|
|
|
|
|
|
from .media_manager import ImageStorageManager
|
|
|
|
|
|
|
2025-12-09 21:16:44 +08:00
|
|
|
|
# 导入新增模块
|
|
|
|
|
|
from .logging_config import setup_logging, get_logger, init_logging_from_env
|
|
|
|
|
|
from .unified_config import UnifiedConfig, get_unified_config
|
|
|
|
|
|
from .exceptions import (
|
|
|
|
|
|
BaseAppException,
|
|
|
|
|
|
ConfigError, ConfigNotFoundError,
|
|
|
|
|
|
ValidationError, MissingParameterError, InvalidParameterError,
|
|
|
|
|
|
ResourceError, ResourceNotFoundError, ResourceExistsError,
|
|
|
|
|
|
EngineError, EngineNotFoundError, EngineExecutionError, EngineTimeoutError,
|
|
|
|
|
|
AIError, AIRateLimitError, AIContentFilterError, AIResponseParseError,
|
|
|
|
|
|
DatabaseError, DatabaseConnectionError,
|
|
|
|
|
|
FileError, FileUploadError,
|
|
|
|
|
|
NetworkError,
|
|
|
|
|
|
AuthError, PermissionDeniedError,
|
|
|
|
|
|
)
|
|
|
|
|
|
|
2025-07-15 15:47:47 +08:00
|
|
|
|
# 版本信息
|
|
|
|
|
|
__version__ = "1.0.0"
|
|
|
|
|
|
__author__ = "TravelContentCreator Team"
|
|
|
|
|
|
|
|
|
|
|
|
# 导出所有公共接口
|
2025-07-08 17:45:40 +08:00
|
|
|
|
__all__ = [
|
2025-07-15 15:47:47 +08:00
|
|
|
|
# 适配器
|
|
|
|
|
|
'XHSAdapter',
|
|
|
|
|
|
'DocumentAdapter',
|
|
|
|
|
|
|
|
|
|
|
|
# 适配器数据模型
|
|
|
|
|
|
'XHSNote',
|
|
|
|
|
|
'XHSSearchResult',
|
|
|
|
|
|
'DocumentContent',
|
|
|
|
|
|
'IntegratedContent',
|
|
|
|
|
|
|
|
|
|
|
|
# 管理器
|
|
|
|
|
|
'CookieManager',
|
|
|
|
|
|
'ImageStorageManager',
|
|
|
|
|
|
|
2025-12-09 21:16:44 +08:00
|
|
|
|
# 日志
|
|
|
|
|
|
'setup_logging',
|
|
|
|
|
|
'get_logger',
|
|
|
|
|
|
'init_logging_from_env',
|
|
|
|
|
|
|
|
|
|
|
|
# 配置
|
|
|
|
|
|
'UnifiedConfig',
|
|
|
|
|
|
'get_unified_config',
|
|
|
|
|
|
|
|
|
|
|
|
# 异常
|
|
|
|
|
|
'BaseAppException',
|
|
|
|
|
|
'ConfigError', 'ConfigNotFoundError',
|
|
|
|
|
|
'ValidationError', 'MissingParameterError', 'InvalidParameterError',
|
|
|
|
|
|
'ResourceError', 'ResourceNotFoundError', 'ResourceExistsError',
|
|
|
|
|
|
'EngineError', 'EngineNotFoundError', 'EngineExecutionError', 'EngineTimeoutError',
|
|
|
|
|
|
'AIError', 'AIRateLimitError', 'AIContentFilterError', 'AIResponseParseError',
|
|
|
|
|
|
'DatabaseError', 'DatabaseConnectionError',
|
|
|
|
|
|
'FileError', 'FileUploadError',
|
|
|
|
|
|
'NetworkError',
|
|
|
|
|
|
'AuthError', 'PermissionDeniedError',
|
|
|
|
|
|
|
2025-07-15 15:47:47 +08:00
|
|
|
|
# 版本信息
|
|
|
|
|
|
'__version__',
|
|
|
|
|
|
'__author__'
|
2025-07-08 17:45:40 +08:00
|
|
|
|
]
|
2025-07-15 15:47:47 +08:00
|
|
|
|
|
2025-07-15 18:20:36 +08:00
|
|
|
|
# 注意:ContentIntegrationService及相关模型已移至api.services模块
|