Mosaic FrameworkMosaic Framework
指南
API参考
插件开发
示例
GitHub
指南
API参考
插件开发
示例
GitHub
  • API参考

    • API 概览
    • Cube API
    • 扩展 API
    • 事件 API
    • 配置 API

配置 API

CubeConfig

public class CubeConfig {
    <T> T getConfig(String name, Class<T> type);
    <T> T getConfig(String name, Class<T> type, T defaultValue);
    Map<String, Object> getAllConfigs();
}

读取示例

CubeConfig cfg = getCubeConfig();
String model = cfg.getConfig("model", String.class, "gpt-3.5-turbo");
Integer timeout = cfg.getConfig("timeout", Integer.class, 30);
Boolean enableLogging = cfg.getConfig("enableLogging", Boolean.class, true);

说明:

  • CubeConfig 由框架在实例化时注入(线程上下文绑定 cubeId -> 配置)。
  • 不建议在插件中长期持有可变引用,按需读取或复制。
最近更新: 2025/8/14 16:51
Contributors: SeasonsChange
Prev
事件 API