fix db connection error in embed_documents() (#26196)
This commit is contained in:
parent
a5387b304e
commit
66196459d5
1 changed files with 4 additions and 0 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue