mirror of
https://github.com/langgenius/dify.git
synced 2026-04-29 04:26:30 +08:00
fix db connection error in embed_documents() (#26196)
This commit is contained in:
parent
a5387b304e
commit
66196459d5
@ -42,6 +42,10 @@ class CacheEmbedding(Embeddings):
|
|||||||
text_embeddings[i] = embedding.get_embedding()
|
text_embeddings[i] = embedding.get_embedding()
|
||||||
else:
|
else:
|
||||||
embedding_queue_indices.append(i)
|
embedding_queue_indices.append(i)
|
||||||
|
|
||||||
|
# release database connection, because embedding may take a long time
|
||||||
|
db.session.close()
|
||||||
|
|
||||||
if embedding_queue_indices:
|
if embedding_queue_indices:
|
||||||
embedding_queue_texts = [texts[i] for i in embedding_queue_indices]
|
embedding_queue_texts = [texts[i] for i in embedding_queue_indices]
|
||||||
embedding_queue_embeddings = []
|
embedding_queue_embeddings = []
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user