mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
Tagging (#4426)
### What problem does this PR solve? #4367 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -111,4 +111,23 @@ def set_embed_cache(llmnm, txt, arr):
|
||||
|
||||
k = hasher.hexdigest()
|
||||
arr = json.dumps(arr.tolist() if isinstance(arr, np.ndarray) else arr)
|
||||
REDIS_CONN.set(k, arr.encode("utf-8"), 24*3600)
|
||||
REDIS_CONN.set(k, arr.encode("utf-8"), 24*3600)
|
||||
|
||||
|
||||
def get_tags_from_cache(kb_ids):
|
||||
hasher = xxhash.xxh64()
|
||||
hasher.update(str(kb_ids).encode("utf-8"))
|
||||
|
||||
k = hasher.hexdigest()
|
||||
bin = REDIS_CONN.get(k)
|
||||
if not bin:
|
||||
return
|
||||
return bin
|
||||
|
||||
|
||||
def set_tags_to_cache(kb_ids, tags):
|
||||
hasher = xxhash.xxh64()
|
||||
hasher.update(str(kb_ids).encode("utf-8"))
|
||||
|
||||
k = hasher.hexdigest()
|
||||
REDIS_CONN.set(k, json.dumps(tags).encode("utf-8"), 600)
|
||||
|
||||
Reference in New Issue
Block a user