-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Rimuovi costante di impostazione e migliora la gestione della m…
…emoria sentimentale
- Loading branch information
Showing
5 changed files
with
57 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
from cat.looking_glass.cheshire_cat import CheshireCat | ||
|
||
ccat = CheshireCat() | ||
|
||
def get_sentiment_memories(): | ||
result = [] | ||
|
||
collection = ccat.memory.vectors.collections["declarative"] | ||
memories = collection.client.scroll( | ||
collection_name="declarative", | ||
with_vectors=True, | ||
limit=10000, # yeah, good for now dear :* | ||
) | ||
if len(memories) > 0: | ||
memories = memories[0] | ||
|
||
memories = [memory for memory in memories if memory.payload["metadata"]["type"] == "sentiment_memory"] | ||
|
||
# get metadata and id only | ||
result = [{"id": memory.id, "metadata": memory.payload["metadata"]} for memory in memories] | ||
|
||
|
||
return result | ||
|
||
def clear_sentiment_memories(): | ||
|
||
collections = list(ccat.memory.vectors.collections.keys()) | ||
if ("declarative" in collections): | ||
ccat.memory.vectors.collections["declarative"].delete_points_by_metadata_filter({"type": "sentiment_memory"}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters