feat(config): add OCR URL configuration and improve image node handling

- Add VITE_OCR_URL environment variable with fallback URL construction
- Define IMAGE_NODE_TYPES constant to support 'image', 'image-block', and 'imageBlock' node types
- Add helper functions for safer image attribute access (getImageSrc, isImageNodeWithSrc, getImageLabel)
- Improve OCR error handling with HTTP status checking and error details
- Wrap OCR context in HTML comments to prevent prompt injection issues
- Update MilkdownEditor to use centralized OCR_URL configuration
This commit is contained in:
“ydy0615”
2026-02-14 21:21:06 +08:00
parent 64cfa58376
commit 794fbf8493
4 changed files with 58 additions and 15 deletions
+1
View File
@@ -1,4 +1,5 @@
VITE_API_URL=http://localhost:8000/v1/completions
VITE_OCR_URL=http://localhost:8000/v1/ocr
# Ollama 配置
OLLAMA_HOST=http://192.168.0.120:11434