diff --git a/llm_web_kit/api/database.py b/llm_web_kit/api/database.py index f58e1752..0c93a7b7 100644 --- a/llm_web_kit/api/database.py +++ b/llm_web_kit/api/database.py @@ -43,6 +43,8 @@ def initialize(self): pool_pre_ping=True, pool_size=settings.db_pool_size, max_overflow=settings.db_max_overflow, + pool_recycle=3600, + pool_use_lifo=True, ) # 创建异步会话工厂 diff --git a/llm_web_kit/api/models/db_models.py b/llm_web_kit/api/models/db_models.py index 2a15b6c2..871093fc 100644 --- a/llm_web_kit/api/models/db_models.py +++ b/llm_web_kit/api/models/db_models.py @@ -6,6 +6,7 @@ from datetime import datetime from sqlalchemy import Column, DateTime, Integer, String, Text +from sqlalchemy.dialects.mysql import LONGTEXT from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() @@ -19,7 +20,7 @@ class RequestLog(Base): id = Column(Integer, primary_key=True, autoincrement=True, comment='主键ID') request_id = Column(String(64), nullable=False, unique=True, index=True, comment='请求ID') input_type = Column(String(32), nullable=False, comment='输入类型: html_content, url, file') - input_html = Column(Text, nullable=True, comment='输入HTML字符串') + input_html = Column(LONGTEXT, nullable=True, comment='输入HTML字符串') url = Column(Text, nullable=True, comment='输入URL地址') output_markdown = Column(Text, nullable=True, comment='输出Markdown内容') status = Column(String(32), default='processing', nullable=False, comment='状态: processing-处理中, success-成功, fail-失败') diff --git a/llm_web_kit/api/routers/htmls.py b/llm_web_kit/api/routers/htmls.py index 0a505ba6..2d3f60a2 100644 --- a/llm_web_kit/api/routers/htmls.py +++ b/llm_web_kit/api/routers/htmls.py @@ -138,7 +138,7 @@ async def upload_html_file( except Exception as commit_error: logger.error(f'提交初始日志时出错: {commit_error}') - result = await html_service.parse_html(html_content=html_content) + result = await html_service.parse_html(html_content=html_content, url="www.baidu.com") # 更新日志为成功 await RequestLogService.update_log_success(