feat: add OpenAI-compatible AI provider plugin with SSE streaming support

- Implemented the OpenAI-compatible AI provider plugin, including configuration, chat, and chat_stream functionalities.
- Added support for SSE streaming and tool calls.
- Integrated Boost.JSON for JSON handling.
- Created CMake configuration for the plugin.
- Added error handling and logging throughout the plugin.
This commit is contained in:
2026-05-31 05:37:04 +08:00
parent f6cb51b40a
commit ba7382db2a
61 changed files with 163 additions and 147 deletions

View File

@@ -0,0 +1,51 @@
# ============================================================
# dstalk_core — 核心 DLL (插件宿主)
# 包含: 插件管理 / 服务注册 / 事件总线 / 配置存储
# ============================================================
find_package(Boost REQUIRED CONFIG)
find_package(OpenSSL REQUIRED CONFIG)
# 统一的 Boost 编译宏 (header-only 模式)
add_library(dstalk_boost_config INTERFACE)
target_compile_definitions(dstalk_boost_config INTERFACE
BOOST_ALL_NO_LIB
BOOST_ERROR_CODE_HEADER_ONLY
BOOST_JSON_HEADER_ONLY
)
add_library(dstalk SHARED
src/host.cpp
src/config_store.cpp
src/event_bus.cpp
src/service_registry.cpp
src/plugin_loader.cpp
src/boost_json.cpp
)
target_include_directories(dstalk
PUBLIC include
PRIVATE src
)
target_compile_features(dstalk PUBLIC cxx_std_20)
target_link_libraries(dstalk
PRIVATE
dstalk_boost_config
boost::boost
openssl::openssl
)
# dlopen / dlclose / dlsym on Linux and macOS
if(NOT WIN32)
target_link_libraries(dstalk PRIVATE ${CMAKE_DL_LIBS})
endif()
# 导出 DLL 符号宏
target_compile_definitions(dstalk
PRIVATE
DSTALK_BUILD_DLL
INTERFACE
DSTALK_USE_DLL
)