- 恢复 kb-zhihu-metadata, kb-bilibili-metadata, kb-deep-analyzer - 修改 zhihu.py 和 analyze.py 使用 sys.path 方式导入 - 删除符号链接 kb_zhihu_metadata Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -9,9 +9,15 @@ from __future__ import annotations
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Optional, Dict, Any
|
||||
|
||||
# Add kb-deep-analyzer to path for import
|
||||
_kb_deep_analyzer_path = Path(__file__).parent.parent.parent / "kb-deep-analyzer"
|
||||
if str(_kb_deep_analyzer_path) not in sys.path:
|
||||
sys.path.insert(0, str(_kb_deep_analyzer_path))
|
||||
|
||||
from ..config import get_settings
|
||||
from ..schemas import AnalyzeInput, AnalyzeOutput
|
||||
from ..state import WorkflowStateManager
|
||||
@@ -194,7 +200,7 @@ class AnalyzeProcessor(BaseProcessor):
|
||||
AnalysisResult 对象
|
||||
"""
|
||||
# Lazy import to avoid dependency issues
|
||||
from kb_deep_analyzer.deep_analyzer import DeepAnalyzer, SimpleAIClient
|
||||
from deep_analyzer import DeepAnalyzer, SimpleAIClient
|
||||
|
||||
# 初始化 AI 客户端
|
||||
ai_client = self._create_ai_client()
|
||||
@@ -211,7 +217,7 @@ class AnalyzeProcessor(BaseProcessor):
|
||||
Returns:
|
||||
SimpleAIClient 实例
|
||||
"""
|
||||
from kb_deep_analyzer.deep_analyzer import SimpleAIClient
|
||||
from deep_analyzer import SimpleAIClient
|
||||
|
||||
# 从环境变量获取配置
|
||||
api_key = os.environ.get("AI_API_KEY", "")
|
||||
@@ -263,7 +269,7 @@ class AnalyzeProcessor(BaseProcessor):
|
||||
result: AnalysisResult 对象
|
||||
content_type: 内容类型
|
||||
"""
|
||||
from kb_deep_analyzer.deep_analyzer import generate_frontmatter
|
||||
from deep_analyzer import generate_frontmatter
|
||||
|
||||
# 标准化元数据(扁平化嵌套结构)
|
||||
normalized_metadata = self._normalize_metadata(metadata)
|
||||
|
||||
Reference in New Issue
Block a user