Skip to content
Snippets Groups Projects
Commit 2b7854ad authored by tolgadevAI's avatar tolgadevAI
Browse files

develop the case "merge-force-local"

parent cc94806d
No related branches found
No related tags found
No related merge requests found
......@@ -27,6 +27,7 @@ node_modules
package-lock.json
package.json
test.ipynb
test_sync.ipynb
```
# docs
......
......@@ -122,9 +122,9 @@ class BaseIndex(BaseModel):
- "error": Raise an error if local and remote are not synchronized.
- "remote": Take remote as the source of truth and update local to align.
- "local": Take local as the source of truth and update remote to align.
- "merge-force-remote": Merge both local and remote taking only remote routes utterances when a route with same route name is present both locally and remotely.
- "merge-force-local": Merge both local and remote taking only local routes utterances when a route with same route name is present both locally and remotely.
- "merge": Merge both local and remote, merging also local and remote utterances when a route with same route name is present both locally and remotely.
- "merge-force-remote": Merge both local and remote taking only remote routes features when a route with same route name is present both locally and remotely.
- "merge-force-local": Merge both local and remote taking only local routes features when a route with same route name is present both locally and remotely.
- "merge": Merge both local and remote, merging also local and remote features when a route with same route name is present both locally and remotely.
This method should be implemented by subclasses.
"""
......
......@@ -292,7 +292,6 @@ class PineconeIndex(BaseIndex):
layer_routes[route][
"function_schemas"
] = remote_function_schemas_dict
elif self.sync == "local":
utterances_to_include = local_utterances_set - remote_utterances_set
routes_to_delete.extend(
......@@ -304,7 +303,7 @@ class PineconeIndex(BaseIndex):
)
layer_routes[route] = {}
if local_utterances_set:
layer_routes[route]["utterances"] = list(local_utterances_set)
layer_routes[route] = {"utterances": list(local_utterances_set)}
if local_function_schemas_dict:
layer_routes[route][
"function_schemas"
......@@ -340,12 +339,19 @@ class PineconeIndex(BaseIndex):
)
if local_utterances_set:
layer_routes[route] = {"utterances": list(local_utterances_set)}
if local_function_schemas_dict:
layer_routes[route][
"function_schemas"
] = local_function_schemas_dict
else:
if remote_utterances_set:
layer_routes[route] = {
"utterances": list(remote_utterances_set)
}
if remote_function_schemas_dict:
layer_routes[route][
"function_schemas"
] = remote_function_schemas_dict
elif self.sync == "merge":
utterances_to_include = local_utterances_set - remote_utterances_set
if local_utterances_set or remote_utterances_set:
......
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