package com.custom.webui.config.props;
|
|
import lombok.Data;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
/**
|
* RAG 微服务配置,前缀 {@code webui.rag}。
|
*
|
* <p>{@link #enabled} 为 false 时后端完全不调用 Python 服务,
|
* 即使 RAG 服务没启动也能正常聊天(降级为纯对话)。
|
*/
|
@Data
|
@ConfigurationProperties(prefix = "webui.rag")
|
public class RagProperties {
|
|
private boolean enabled = true;
|
|
private String baseUrl = "http://localhost:8000";
|
|
/** 文档向量化超时,解析 + embedding 可能很慢,默认 10 分钟 */
|
private int ingestTimeoutMillis = 600000;
|
|
private int searchTimeoutMillis = 30000;
|
|
/** 默认检索片段数 */
|
private int defaultTopK = 4;
|
|
/** 拼进 prompt 的检索内容总字符上限,防止撑爆上下文 */
|
private int maxContextChars = 6000;
|
|
/**
|
* OCR 识别超时。
|
*
|
* <p>比检索宽松得多(检索默认 30s):首次 OCR 可能需要加载 onnx 模型,
|
* 大图识别也要几秒。给 2 分钟足够覆盖冷启动。
|
*/
|
private int ocrTimeoutMillis = 120000;
|
}
|