fix: auto-fix code issues (cron)
- 修复重复导入/字段 - 修复异常处理 - 修复PEP8格式问题 - 添加类型注解 - 清理未使用的导入 - 统一字符串格式化为f-string - 修复行长度超过120字符的问题
This commit is contained in:
@@ -18,6 +18,7 @@ from datetime import datetime, timedelta
|
||||
from typing import Any, Optional
|
||||
|
||||
import httpx
|
||||
from export_manager import ExportEntity, ExportRelation, ExportTranscript
|
||||
from fastapi import (
|
||||
Body,
|
||||
Depends,
|
||||
@@ -33,12 +34,9 @@ from fastapi import (
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from fastapi.responses import JSONResponse, PlainTextResponse, StreamingResponse
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
from pydantic import BaseModel, Field
|
||||
from export_manager import ExportEntity
|
||||
from export_manager import ExportRelation
|
||||
from export_manager import ExportTranscript
|
||||
from ops_manager import OpsManager
|
||||
from plugin_manager import PluginManager
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
# Configure logger
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -1166,7 +1164,7 @@ async def create_manual_entity(
|
||||
start_pos=entity.start_pos,
|
||||
end_pos=entity.end_pos,
|
||||
text_snippet=text[
|
||||
max(0, entity.start_pos - 20) : min(len(text), entity.end_pos + 20)
|
||||
max(0, entity.start_pos - 20): min(len(text), entity.end_pos + 20)
|
||||
],
|
||||
confidence=1.0,
|
||||
)
|
||||
@@ -1408,7 +1406,7 @@ async def upload_audio(project_id: str, file: UploadFile = File(...), _=Depends(
|
||||
start_pos=pos,
|
||||
end_pos=pos + len(name),
|
||||
text_snippet=full_text[
|
||||
max(0, pos - 20) : min(len(full_text), pos + len(name) + 20)
|
||||
max(0, pos - 20): min(len(full_text), pos + len(name) + 20)
|
||||
],
|
||||
confidence=1.0,
|
||||
)
|
||||
@@ -1534,7 +1532,7 @@ async def upload_document(project_id: str, file: UploadFile = File(...), _=Depen
|
||||
start_pos=pos,
|
||||
end_pos=pos + len(name),
|
||||
text_snippet=full_text[
|
||||
max(0, pos - 20) : min(len(full_text), pos + len(name) + 20)
|
||||
max(0, pos - 20): min(len(full_text), pos + len(name) + 20)
|
||||
],
|
||||
confidence=1.0,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user