feat: add AI endpoint manager plugin with configuration and routing capabilities
Some checks failed
CI / Determine matrix (push) Has been cancelled
CI / Sanitizer (ASan+UBSan) / ubuntu-24.04 (push) Has been cancelled
CI / Coverage (gcovr) / ubuntu-24.04 (push) Has been cancelled
CI / ${{ matrix.os }} / ${{ matrix.build_type }} (push) Has been cancelled

- Introduced `ai_endpoint_mgr` plugin to manage multiple AI provider endpoints.
- Added configuration reference documentation for `config.toml`.
- Implemented endpoint loading, active endpoint switching, and model mutation.
- Included error handling for missing endpoints and configuration failures.
- Developed unit tests covering various scenarios including error paths and concurrency.
This commit is contained in:
2026-06-03 21:07:25 +08:00
parent 28ae90a6cc
commit 4745ce1f1c
18 changed files with 1570 additions and 34 deletions

View File

@@ -145,6 +145,8 @@ target_compile_definitions(dstalk_anthropic_plugin_test
BOOST_ALL_NO_LIB
)
find_package(Boost REQUIRED CONFIG)
target_link_libraries(dstalk_anthropic_plugin_test
PRIVATE
dstalk
@@ -174,6 +176,8 @@ target_compile_definitions(dstalk_openai_plugin_test
BOOST_ALL_NO_LIB
)
find_package(Boost REQUIRED CONFIG)
target_link_libraries(dstalk_openai_plugin_test
PRIVATE
dstalk
@@ -183,6 +187,37 @@ target_link_libraries(dstalk_openai_plugin_test
add_test(NAME dstalk_openai_plugin_test COMMAND dstalk_openai_plugin_test)
# ============================================================
# dstalk_endpoint_mgr_plugin_test — AI endpoint manager 插件单元测试
# 覆盖: endpoint 加载/列表脱敏/active/model 修改/路由
# ============================================================
add_executable(dstalk_endpoint_mgr_plugin_test
endpoint_mgr_plugin_test.cpp
)
target_include_directories(dstalk_endpoint_mgr_plugin_test
PRIVATE ${CMAKE_SOURCE_DIR}/dstalk_core/include
PRIVATE ${CMAKE_SOURCE_DIR}/plugins_upper/ai_common/include
)
target_compile_definitions(dstalk_endpoint_mgr_plugin_test
PRIVATE
BOOST_JSON_HEADER_ONLY
BOOST_ALL_NO_LIB
)
find_package(Boost REQUIRED CONFIG)
target_link_libraries(dstalk_endpoint_mgr_plugin_test
PRIVATE
dstalk
ai_common
boost::boost
)
add_test(NAME dstalk_endpoint_mgr_plugin_test COMMAND dstalk_endpoint_mgr_plugin_test)
# ============================================================
# dstalk_network_plugin_test — Network 插件单元测试
# W22.2 (qa-xu): 通过 #include source 访问 static 函数
@@ -203,6 +238,8 @@ target_compile_definitions(dstalk_network_plugin_test
BOOST_ALL_NO_LIB
)
find_package(Boost REQUIRED CONFIG)
target_link_libraries(dstalk_network_plugin_test
PRIVATE
dstalk
@@ -238,6 +275,8 @@ target_compile_features(dstalk_lsp_plugin_test
PRIVATE cxx_std_17
)
find_package(Boost REQUIRED CONFIG)
target_link_libraries(dstalk_lsp_plugin_test
PRIVATE
dstalk