|
|
@@ -549,6 +549,16 @@ auto HttpServer::InitializeServices() -> bool {
|
|
|
wsHandler_ = std::make_unique<WsHandler>(*authService_);
|
|
|
spdlog::info("WsHandler initialized successfully");
|
|
|
|
|
|
+ // Initialize LLM Client (connection to LLM service - optional, may not be available)
|
|
|
+ LlmClientConfig llm_config;
|
|
|
+ llm_config.address = config_.llm_address;
|
|
|
+ llmClient_ = std::make_unique<LlmClient>(std::move(llm_config));
|
|
|
+ if (llmClient_->Connect()) {
|
|
|
+ spdlog::info("LLM client connected to {}", config_.llm_address);
|
|
|
+ } else {
|
|
|
+ spdlog::warn("LLM service not available at {} - LLM features will be disabled", config_.llm_address);
|
|
|
+ }
|
|
|
+
|
|
|
// Note: WebSocket message handler is set up in Start() after wsServer_ is created
|
|
|
|
|
|
return true;
|
|
|
@@ -4097,13 +4107,21 @@ void HttpServer::HandleCreateView(const httplib::Request& req, httplib::Response
|
|
|
for (const auto& field_json : schema_json["fields"]) {
|
|
|
SchemaField field;
|
|
|
field.name = field_json.value("name", "");
|
|
|
+ field.group = field_json.value("group", "");
|
|
|
+
|
|
|
+ // Validate field name - names starting with "_" are reserved for system fields
|
|
|
+ if (!field.name.empty() && field.name[0] == '_' && field.group != "_system") {
|
|
|
+ res.status = 400;
|
|
|
+ res.set_content(R"({"error":"Field names starting with '_' are reserved for system fields"})", "application/json");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
field.type = StringToFieldType(field_json.value("type", "text"));
|
|
|
field.label = field_json.value("label", "");
|
|
|
field.description = field_json.value("description", "");
|
|
|
field.required = field_json.value("required", false);
|
|
|
field.display_order = field_json.value("display_order", 0);
|
|
|
field.widget = field_json.value("widget", "");
|
|
|
- field.group = field_json.value("group", "");
|
|
|
field.default_value = field_json.value("default_value", nlohmann::json());
|
|
|
field.options = field_json.value("options", nlohmann::json());
|
|
|
field.reference_collection = field_json.value("reference_collection", "");
|
|
|
@@ -4526,13 +4544,21 @@ void HttpServer::HandleUpdateView(const httplib::Request& req, httplib::Response
|
|
|
for (const auto& field_json : schema_json["fields"]) {
|
|
|
SchemaField field;
|
|
|
field.name = field_json.value("name", "");
|
|
|
+ field.group = field_json.value("group", "");
|
|
|
+
|
|
|
+ // Validate field name - names starting with "_" are reserved for system fields
|
|
|
+ if (!field.name.empty() && field.name[0] == '_' && field.group != "_system") {
|
|
|
+ res.status = 400;
|
|
|
+ res.set_content(R"({"error":"Field names starting with '_' are reserved for system fields"})", "application/json");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
field.type = StringToFieldType(field_json.value("type", "text"));
|
|
|
field.label = field_json.value("label", "");
|
|
|
field.description = field_json.value("description", "");
|
|
|
field.required = field_json.value("required", false);
|
|
|
field.display_order = field_json.value("display_order", 0);
|
|
|
field.widget = field_json.value("widget", "");
|
|
|
- field.group = field_json.value("group", "");
|
|
|
field.default_value = field_json.value("default_value", nlohmann::json());
|
|
|
field.options = field_json.value("options", nlohmann::json());
|
|
|
field.reference_collection = field_json.value("reference_collection", "");
|