Spaces:
Sleeping
Sleeping
Update CosmosDBHandlers/cosmosConnector.py
Browse files
CosmosDBHandlers/cosmosConnector.py
CHANGED
|
@@ -24,7 +24,7 @@ class CosmosLampHandler:
|
|
| 24 |
)
|
| 25 |
self.chat_memory_handler = ChatMemoryHandler()
|
| 26 |
self.database = self.client.get_database_client("TAL_DB")
|
| 27 |
-
self.container = self.database.get_container_client("
|
| 28 |
self.logger = logging.Logger("test")
|
| 29 |
# self.logger = logger
|
| 30 |
self.embedding_model = AzureOpenAIEmbeddings(
|
|
@@ -289,14 +289,19 @@ class CosmosLampHandler:
|
|
| 289 |
output_min, output_max = self._parse_voltage(output_voltage) if output_voltage else (None, None)
|
| 290 |
normalized_lamp_type = self._normalize_lamp_name(lamp_type) if lamp_type else None
|
| 291 |
|
| 292 |
-
# Build query
|
| 293 |
query_parts = []
|
| 294 |
-
if input_min and input_max:
|
| 295 |
-
query_parts.append(f"c.nom_input_voltage_v.min = {input_max} AND c.nom_input_voltage_v.max = {input_min}")
|
| 296 |
-
self.logger.info(f"c.nom_input_voltage_v.min = {input_max} AND c.nom_input_voltage_v.max = {input_min}")
|
| 297 |
if output_min and output_max:
|
| 298 |
-
|
| 299 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 300 |
if current:
|
| 301 |
query_parts.append(f"c.type LIKE '%{current}%'")
|
| 302 |
|
|
|
|
| 24 |
)
|
| 25 |
self.chat_memory_handler = ChatMemoryHandler()
|
| 26 |
self.database = self.client.get_database_client("TAL_DB")
|
| 27 |
+
self.container = self.database.get_container_client("Converters_with_embeddings")
|
| 28 |
self.logger = logging.Logger("test")
|
| 29 |
# self.logger = logger
|
| 30 |
self.embedding_model = AzureOpenAIEmbeddings(
|
|
|
|
| 289 |
output_min, output_max = self._parse_voltage(output_voltage) if output_voltage else (None, None)
|
| 290 |
normalized_lamp_type = self._normalize_lamp_name(lamp_type) if lamp_type else None
|
| 291 |
|
|
|
|
| 292 |
query_parts = []
|
|
|
|
|
|
|
|
|
|
| 293 |
if output_min and output_max:
|
| 294 |
+
if output_min==output_max and output_max in [(24.0,24.0), (48.0,48.0)]:
|
| 295 |
+
query_parts.append(f"c.output_voltage_v.min = {output_max} AND c.output_voltage_v.max = {output_min}")
|
| 296 |
+
self.logger.info(f"c.nom_input_voltage_v.min = {output_max} AND c.nom_input_voltage_v.max = {output_min}")
|
| 297 |
+
else:
|
| 298 |
+
query_parts.append(f"c.output_voltage_v.min <= {output_max} AND c.output_voltage_v.max >= {output_min}")
|
| 299 |
+
self.logger.info(f"c.nom_input_voltage_v.min <= {output_max} AND c.nom_input_voltage_v.max >= {output_min}")
|
| 300 |
+
|
| 301 |
+
if input_min and input_max:
|
| 302 |
+
query_parts.append(f"c.nom_input_voltage_v.min <= {input_max} AND c.nom_input_voltage_v.max >= {input_min}")
|
| 303 |
+
self.logger.info(f"c.nom_input_voltage_v.min <= {input_max} AND c.nom_input_voltage_v.max >= {input_min}")
|
| 304 |
+
|
| 305 |
if current:
|
| 306 |
query_parts.append(f"c.type LIKE '%{current}%'")
|
| 307 |
|