Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 0c8d7bf

Browse files
committed
chore: add log
1 parent 04895b8 commit 0c8d7bf

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

engine/extensions/remote-engine/remote_engine.cc

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -713,14 +713,12 @@ Json::Value RemoteEngine::GetRemoteModels(const std::string& url,
713713
CTL_WRN(response.error_message);
714714
return error;
715715
}
716-
Json::Value response_json;
717-
Json::Reader reader;
718-
if (!reader.parse(response.body, response_json)) {
719-
Json::Value error;
720-
error["error"] = "Failed to parse response";
721-
return error;
716+
CTL_DBG(response.body);
717+
auto body_json = json_helper::ParseJsonString(response.body);
718+
if (body_json.isMember("error")) {
719+
return body_json["error"];
722720
}
723-
return response_json;
721+
return body_json;
724722
}
725723
}
726724

engine/services/engine_service.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,6 +1142,12 @@ cpp::result<Json::Value, std::string> EngineService::GetRemoteModels(
11421142
auto api_key = remote_engine_json["api_key"].asString();
11431143
auto api_key_template =
11441144
remote_engine_json["metadata"]["api_key_template"].asString();
1145+
if (url.empty())
1146+
CTL_WRN("url is empty");
1147+
if (api_key.empty())
1148+
CTL_WRN("api_key is empty");
1149+
if (api_key_template.empty())
1150+
CTL_WRN("api_key_template is empty");
11451151
auto res = e->GetRemoteModels(url, api_key, api_key_template);
11461152
if (!res["error"].isNull()) {
11471153
return cpp::fail(res["error"].asString());

0 commit comments

Comments
 (0)