Complete build wiring and CLI file commands

Align documented commands with the CLI, enable optional GUI/test targets, and remove committed API secrets so the project is safer to build and run.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-25 20:43:53 +08:00
parent e1b0abaf54
commit 330cd686db
16 changed files with 197 additions and 57 deletions

View File

@@ -32,10 +32,3 @@ target_compile_definitions(dstalk
PRIVATE DSTALK_BUILD_DLL
INTERFACE DSTALK_USE_DLL
)
# Windows: 生成 .lib 导入库和 .dll
if(WIN32)
set_target_properties(dstalk PROPERTIES
WINDOWS_EXPORT_ALL_SYMBOLS ON
)
endif()

View File

@@ -14,6 +14,7 @@ struct Message {
// API 配置
struct ApiConfig {
std::string provider; // 默认 "deepseek"
std::string base_url; // 默认 "https://api.deepseek.com/v1"
std::string api_key;
std::string model; // 默认 "deepseek-chat"

View File

@@ -19,6 +19,7 @@ dstalk::ai::ApiConfig g_config;
std::vector<dstalk::ai::Message> g_history;
// 默认配置
const char* DEFAULT_PROVIDER = "deepseek";
const char* DEFAULT_BASE_URL = "https://api.deepseek.com/v1";
const char* DEFAULT_MODEL = "deepseek-chat";
@@ -79,7 +80,9 @@ void parse_config_file(const char* path)
val = val.substr(1, val.size() - 2);
if (current_section == "api") {
if (key == "api_key" || key == "apikey")
if (key == "provider")
g_config.provider = val;
else if (key == "api_key" || key == "apikey")
g_config.api_key = val;
else if (key == "base_url")
g_config.base_url = val;
@@ -98,6 +101,7 @@ DSTALK_API int dstalk_init(const char* config_path)
if (g_initialized) return -1;
// 设置默认值
g_config.provider = DEFAULT_PROVIDER;
g_config.base_url = DEFAULT_BASE_URL;
g_config.model = DEFAULT_MODEL;
g_config.max_tokens = 4096;

View File

@@ -219,5 +219,5 @@ HttpResponse HttpClient::post_stream(
#else
// 非 Windows: 需要 Boost.Beast 实现 (编译时会报错提示)
# error "Non-Windows HTTP client not implemented yet. Use Boost.Beast version."
# error "WinHTTP backend is Windows-only. Use net/http_client.cpp for non-Windows builds."
#endif