@nick848/sf-cli 1.0.13 → 1.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,22 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## v1.0.13 (2026-03-22)
9
+
10
+ **修复 DeepSeek API Key 验证**
11
+
12
+ - 🐛 修复 DeepSeek API Key 验证失败问题
13
+ - 🔧 DeepSeek 适配器现在使用正确的 API 端点 `https://api.deepseek.com/v1`
14
+ - 🔧 验证和调用都使用 DeepSeek 专用端点,而非 OpenAI 端点
15
+
16
+ **问题原因**
17
+
18
+ DeepSeek 使用 OpenAI 兼容接口,但 API 端点不同:
19
+ - OpenAI: `https://api.openai.com/v1`
20
+ - DeepSeek: `https://api.deepseek.com/v1`
21
+
22
+ 之前验证时使用了 OpenAI 端点导致验证失败。
23
+
8
24
  ## v1.0.12 (2026-03-22)
9
25
 
10
26
  **交互优化 - API Key 配置引导**
package/dist/cli/index.js CHANGED
@@ -1018,6 +1018,8 @@ function createAdapter(provider) {
1018
1018
  }
1019
1019
  function createDeepSeekAdapter() {
1020
1020
  const adapter = new OpenAIAdapter();
1021
+ let initialized = false;
1022
+ let config = null;
1021
1023
  return {
1022
1024
  get name() {
1023
1025
  return "DeepSeek";
@@ -1028,14 +1030,41 @@ function createDeepSeekAdapter() {
1028
1030
  get models() {
1029
1031
  return adapter.models;
1030
1032
  },
1031
- initialize: (config) => adapter.initialize(config),
1032
- sendMessage: (messages, options) => adapter.sendMessage(messages, options),
1033
- streamMessage: (messages, options) => adapter.streamMessage(messages, options),
1034
- countTokens: (text) => adapter.countTokens(text),
1035
- validateApiKey: (apiKey) => adapter.validateApiKey(apiKey),
1036
- isInitialized: () => adapter.isInitialized()
1033
+ async initialize(modelConfig) {
1034
+ config = {
1035
+ ...modelConfig,
1036
+ apiEndpoint: DEEPSEEK_API_ENDPOINT
1037
+ };
1038
+ await adapter.initialize(config);
1039
+ initialized = true;
1040
+ },
1041
+ async sendMessage(messages, options) {
1042
+ return adapter.sendMessage(messages, options);
1043
+ },
1044
+ async *streamMessage(messages, options) {
1045
+ yield* adapter.streamMessage(messages, options);
1046
+ },
1047
+ countTokens(text) {
1048
+ return adapter.countTokens(text);
1049
+ },
1050
+ async validateApiKey(apiKey) {
1051
+ try {
1052
+ const response = await fetch(`${DEEPSEEK_API_ENDPOINT}/models`, {
1053
+ headers: {
1054
+ "Authorization": `Bearer ${apiKey}`
1055
+ }
1056
+ });
1057
+ return response.ok;
1058
+ } catch {
1059
+ return false;
1060
+ }
1061
+ },
1062
+ isInitialized() {
1063
+ return initialized;
1064
+ }
1037
1065
  };
1038
1066
  }
1067
+ var DEEPSEEK_API_ENDPOINT;
1039
1068
  var init_adapters = __esm({
1040
1069
  "src/services/adapters/index.ts"() {
1041
1070
  init_cjs_shims();
@@ -1046,6 +1075,7 @@ var init_adapters = __esm({
1046
1075
  init_glm();
1047
1076
  init_openai();
1048
1077
  init_claude();
1078
+ DEEPSEEK_API_ENDPOINT = "https://api.deepseek.com/v1";
1049
1079
  }
1050
1080
  });
1051
1081
  var ModelService;