|
|
|
@ -9,6 +9,8 @@ from domain.ai_seo import AiAnswer, AiSearchResult |
|
|
|
from utils import create_logger |
|
|
|
from glom import glom, Coalesce |
|
|
|
|
|
|
|
from utils.ai_seo_api_utils import AiSeoApis |
|
|
|
|
|
|
|
logger = create_logger(__name__) |
|
|
|
|
|
|
|
|
|
|
|
@ -52,6 +54,7 @@ class KimiSpider(AbstractAiSeoSpider): |
|
|
|
|
|
|
|
# 报错检查 |
|
|
|
if self.fail_status: |
|
|
|
await AiSeoApis.update_spider_session(self.session_info['id'], 2) |
|
|
|
raise self.fail_exception |
|
|
|
|
|
|
|
# 关闭侧边栏 |
|
|
|
@ -85,6 +88,12 @@ class KimiSpider(AbstractAiSeoSpider): |
|
|
|
if json_data['items']: |
|
|
|
logger.debug(json_data) |
|
|
|
detail = json_data['items'][-1] |
|
|
|
if 'error' in detail: |
|
|
|
logger.error(f"kimi回复错误: {detail['error']['detail']}") |
|
|
|
self.fail_status = True |
|
|
|
self.fail_exception = Exception(detail['error']['detail']) |
|
|
|
self.completed_event.set() |
|
|
|
return |
|
|
|
content = detail['content'] |
|
|
|
if self.think: |
|
|
|
self.ai_answer.search_result = self.get_search_list_enable_think(detail) |
|
|
|
|