kongdeqiang
2026-10-12 ccf1a44c001e233c158bd168dc2d0d96721af929
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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;
}