Skip to content
Snippets Groups Projects
Commit ca34d21d authored by James Briggs's avatar James Briggs
Browse files

fix: fix update for metadata

parent 2c859738
No related branches found
No related tags found
No related merge requests found
...@@ -48,17 +48,7 @@ class BaseIndex(BaseModel): ...@@ -48,17 +48,7 @@ class BaseIndex(BaseModel):
:rtype: List[Tuple] :rtype: List[Tuple]
""" """
_, metadata = self._get_all(include_metadata=True) _, metadata = self._get_all(include_metadata=True)
route_tuples: List[ route_tuples = parse_route_info(metadata=metadata)
Tuple[str, str, Optional[Dict[str, Any]], Dict[str, Any]]
] = [
(
x["sr_route"],
x["sr_utterance"],
None if (fc := x.get("sr_function_schema", None)) == "null" else fc,
x.get("sr_metadata", {}),
)
for x in metadata
]
return route_tuples return route_tuples
def get_routes(self) -> List[Route]: def get_routes(self) -> List[Route]:
...@@ -264,7 +254,7 @@ def parse_route_info(metadata: List[Dict[str, Any]]) -> List[Tuple]: ...@@ -264,7 +254,7 @@ def parse_route_info(metadata: List[Dict[str, Any]]) -> List[Tuple]:
sr_route = record.get("sr_route", "") sr_route = record.get("sr_route", "")
sr_utterance = record.get("sr_utterance", "") sr_utterance = record.get("sr_utterance", "")
sr_function_schema = json.loads(record.get("sr_function_schema", "{}")) sr_function_schema = json.loads(record.get("sr_function_schema", "{}"))
if sr_function_schema == {}: if sr_function_schema == {} or sr_function_schema == "null":
sr_function_schema = None sr_function_schema = None
additional_metadata = { additional_metadata = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment