All files / src/providers/deepseek index.ts

91.66% Statements 11/12
66.66% Branches 4/6
100% Functions 2/2
90.9% Lines 10/11

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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                  63x     13x   11x 13x 13x 13x   13x           13x     11x     63x  
import { config as globalConfig } from "../../config.js";
import { providerRegistry } from "../registry.js";
import { DeepSeekProvider } from "./DeepSeekProvider.js";
 
export * from "./DeepSeekProvider.js";
export * from "./Chat.js";
export * from "./Models.js";
export * from "./Capabilities.js";
 
let registered = false;
 
export function registerDeepSeekProvider() {
  if (registered) return;
 
  providerRegistry.register("deepseek", (config) => {
    const cfg = config || globalConfig;
    const apiKey = cfg.deepseekApiKey;
    const baseUrl = cfg.deepseekApiBase; // Optional override
 
    Iif (!apiKey) {
      throw new Error(
        "deepseek_api_key is not set in config or DEEPSEEK_API_KEY environment variable"
      );
    }
 
    return new DeepSeekProvider({ apiKey, baseUrl });
  });
 
  registered = true;
}
 
export const ensureDeepSeekRegistered = registerDeepSeekProvider;