Replace hardcoded max tokens with DEFAULT_MAX_TOTAL_TOKENS constant

- Use constant in process_chunks_unified
- Update WebUI default to match (32000)
This commit is contained in:
yangdx 2025-07-26 11:23:54 +08:00
parent 7b915b34f6
commit a67f93acc9
2 changed files with 3 additions and 2 deletions

View file

@ -20,6 +20,7 @@ from lightrag.constants import (
DEFAULT_LOG_BACKUP_COUNT,
DEFAULT_LOG_FILENAME,
GRAPH_FIELD_SEP,
DEFAULT_MAX_TOTAL_TOKENS,
DEFAULT_MAX_FILE_PATH_LENGTH,
)
@ -1887,7 +1888,7 @@ async def process_chunks_unified(
chunk_token_limit = getattr(
query_param,
"max_total_tokens",
global_config.get("MAX_TOTAL_TOKENS", 32000),
global_config.get("MAX_TOTAL_TOKENS", DEFAULT_MAX_TOTAL_TOKENS),
)
original_count = len(unique_chunks)

View file

@ -270,7 +270,7 @@ export default function QuerySettings() {
onBlur={(e) => {
const value = e.target.value
if (value === '' || isNaN(parseInt(value))) {
handleChange('max_total_tokens', 1000)
handleChange('max_total_tokens', 32000)
}
}}
min={1}