feat: update web ui, docker make commands, and related docs/config
This commit is contained in:
@@ -8,6 +8,8 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class SettingsService {
|
||||
// 启动默认 API Key(仅作为本地默认值,可在设置页覆盖)
|
||||
private static final String BOOTSTRAP_API_KEY = "sk-48c59012c93b43a08fecbaf3e74799e7";
|
||||
|
||||
private final OutputFileService outputFileService;
|
||||
private final SvnPresetService svnPresetService;
|
||||
@@ -17,6 +19,7 @@ public class SettingsService {
|
||||
public SettingsService(OutputFileService outputFileService, SvnPresetService svnPresetService) {
|
||||
this.outputFileService = outputFileService;
|
||||
this.svnPresetService = svnPresetService;
|
||||
this.runtimeApiKey = initStartupApiKey();
|
||||
this.defaultSvnPresetId = svnPresetService.configuredDefaultPresetId();
|
||||
}
|
||||
|
||||
@@ -58,8 +61,23 @@ public class SettingsService {
|
||||
return null;
|
||||
}
|
||||
|
||||
private String initStartupApiKey() {
|
||||
final String envKey = System.getenv("DEEPSEEK_API_KEY");
|
||||
if (envKey != null && !envKey.trim().isEmpty()) {
|
||||
return envKey.trim();
|
||||
}
|
||||
if (BOOTSTRAP_API_KEY != null && !BOOTSTRAP_API_KEY.trim().isEmpty()
|
||||
&& !BOOTSTRAP_API_KEY.startsWith("REPLACE_WITH_")) {
|
||||
return BOOTSTRAP_API_KEY.trim();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String detectApiKeySource(String envKey) {
|
||||
if (runtimeApiKey != null && !runtimeApiKey.trim().isEmpty()) {
|
||||
if (envKey != null && !envKey.trim().isEmpty() && runtimeApiKey.equals(envKey.trim())) {
|
||||
return "env";
|
||||
}
|
||||
return "runtime";
|
||||
}
|
||||
if (envKey != null && !envKey.trim().isEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user