feat: consolidate env config and add deployment files

- Add debug_font_path, demo_docs_dir, e2e_api_base_url to config.py
- Fix hardcoded paths in pp_structure_debug.py, create_demo_images.py
- Fix hardcoded paths in test files
- Update .env.example with new configuration options
- Update .gitignore to exclude AI development files (.claude/, openspec/, AGENTS.md, CLAUDE.md)
- Add production startup script (start-prod.sh)
- Add README.md with project documentation
- Add 1panel Docker deployment files (docker-compose.yml, Dockerfiles, nginx.conf)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
egg
2025-12-14 15:02:16 +08:00
parent 858d93155f
commit 86a6633000
31 changed files with 1177 additions and 252 deletions

View File

@@ -1336,31 +1336,31 @@ class PriorityOperationQueue:
# Wait for an item
if not self._queue:
if timeout is not None:
result = self._condition.wait_for(
lambda: len(self._queue) > 0,
timeout=timeout
)
result = self._condition.wait_for(lambda: len(self._queue) > 0, timeout=timeout)
if not result:
return None
else:
return None
# Get highest priority item
neg_priority, _, item_id, data = heapq.heappop(self._queue)
priority = BatchPriority(-neg_priority)
# Keep popping until we find a non-cancelled item (or queue is exhausted)
while self._queue:
neg_priority, _, item_id, data = heapq.heappop(self._queue)
priority = BatchPriority(-neg_priority)
# Skip if cancelled
if item_id in self._cancelled:
self._cancelled.discard(item_id)
self._total_cancelled += 1
if item_id in self._cancelled:
self._cancelled.discard(item_id)
self._total_cancelled += 1
self._condition.notify()
continue
self._total_dequeued += 1
self._condition.notify()
return self.dequeue(timeout=0) # Try next item
logger.debug(f"Dequeued operation {item_id} with priority {priority.name}")
return item_id, data, priority
self._total_dequeued += 1
self._condition.notify()
return None
logger.debug(f"Dequeued operation {item_id} with priority {priority.name}")
return item_id, data, priority
return None
def cancel(self, item_id: str) -> bool:
"""

View File

@@ -16,6 +16,7 @@ from datetime import datetime
from PIL import Image, ImageDraw, ImageFont
from app.utils.bbox_utils import normalize_bbox
from app.core.config import BACKEND_ROOT, settings
logger = logging.getLogger(__name__)
@@ -186,12 +187,13 @@ class PPStructureDebug:
# Try to load a font, fall back to default
try:
font = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", 14)
small_font = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", 10)
font = ImageFont.truetype(settings.debug_font_path, 14)
small_font = ImageFont.truetype(settings.debug_font_path, 10)
except (IOError, OSError):
try:
font = ImageFont.truetype("/home/egg/project/Tool_OCR/backend/fonts/NotoSansSC-Regular.ttf", 14)
small_font = ImageFont.truetype("/home/egg/project/Tool_OCR/backend/fonts/NotoSansSC-Regular.ttf", 10)
noto_font = BACKEND_ROOT / "fonts" / "NotoSansSC-Regular.ttf"
font = ImageFont.truetype(str(noto_font), 14)
small_font = ImageFont.truetype(str(noto_font), 10)
except (IOError, OSError):
font = ImageFont.load_default()
small_font = font