mateclaw/mateclaw-server/src/main/java/vip/mate/agent/ThinkingLevelHolder.java

34 lines
840 B
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package vip.mate.agent;
/**
* 请求级思考深度的 ThreadLocal 持有器。
* <p>
* 用于将前端选择的思考级别从 AgentService 传递到 ReasoningNode
* 避免修改 Agent 缓存实例或 StructuredStreamCapable 接口。
* <p>
* 支持的值off / low / medium / high / maxnull 表示跟随模型默认。
*
* @author MateClaw Team
*/
public final class ThinkingLevelHolder {
private static final ThreadLocal<String> HOLDER = new ThreadLocal<>();
private ThinkingLevelHolder() {}
public static void set(String level) {
HOLDER.set(level);
}
/**
* 获取当前请求的思考级别null 表示未设置(跟随模型默认)
*/
public static String get() {
return HOLDER.get();
}
public static void clear() {
HOLDER.remove();
}
}