mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-01-02 14:22:28 +08:00
feat: make PDF/text extraction char limit configurable via env (#214)
Add NEXT_PUBLIC_MAX_EXTRACTED_CHARS environment variable to allow configuring the maximum characters extracted from PDF and text files. Defaults to 150000 (150k chars) if not set.
This commit is contained in:
@@ -90,3 +90,4 @@ AI_MODEL=global.anthropic.claude-sonnet-4-5-20250929-v1:0
|
|||||||
# Enable PDF file upload to extract text and generate diagrams
|
# Enable PDF file upload to extract text and generate diagrams
|
||||||
# Enabled by default. Set to "false" to disable.
|
# Enabled by default. Set to "false" to disable.
|
||||||
# ENABLE_PDF_INPUT=true
|
# ENABLE_PDF_INPUT=true
|
||||||
|
# NEXT_PUBLIC_MAX_EXTRACTED_CHARS=150000 # Max characters for PDF/text extraction (default: 150000)
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
import { extractText, getDocumentProxy } from "unpdf"
|
import { extractText, getDocumentProxy } from "unpdf"
|
||||||
|
|
||||||
// Maximum characters allowed for extracted text
|
// Maximum characters allowed for extracted text (configurable via env)
|
||||||
export const MAX_EXTRACTED_CHARS = 150000 // 150k chars
|
const DEFAULT_MAX_EXTRACTED_CHARS = 150000 // 150k chars
|
||||||
|
export const MAX_EXTRACTED_CHARS =
|
||||||
|
Number(process.env.NEXT_PUBLIC_MAX_EXTRACTED_CHARS) ||
|
||||||
|
DEFAULT_MAX_EXTRACTED_CHARS
|
||||||
|
|
||||||
// Text file extensions we support
|
// Text file extensions we support
|
||||||
const TEXT_EXTENSIONS = [
|
const TEXT_EXTENSIONS = [
|
||||||
|
|||||||
Reference in New Issue
Block a user