feat: add AI endpoint manager plugin with configuration and routing capabilities
Some checks failed
Some checks failed
- 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:
@@ -65,6 +65,7 @@ static std::string build_request_json(
|
||||
std::string system_prompt;
|
||||
json::array msgs;
|
||||
|
||||
if (history) { // 防御: history 为空时跳过历史遍历 / Defensive: skip history iteration when null
|
||||
for (int i = 0; i < history_len; ++i) {
|
||||
const auto& m = history[i];
|
||||
if (m.role && std::strcmp(m.role, "system") == 0) {
|
||||
@@ -77,6 +78,7 @@ static std::string build_request_json(
|
||||
obj["content"] = m.content ? m.content : "";
|
||||
msgs.push_back(obj);
|
||||
}
|
||||
} // if (history)
|
||||
|
||||
// 追加当前用户输入 / Append current user input
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user