puuuush
PUUUUUUUUUUSH MORE DATA
This commit is contained in:
@@ -69,16 +69,17 @@ def create_embeddings(pContent):
|
||||
insert_data = f"insert into dbtable (filepath, embedding) Values ('{content['path']}', %s) Returning id;"
|
||||
cur.execute(insert_data, (response["embedding"],))
|
||||
doc_id = cur.fetchone()[0]
|
||||
insert_data_mongo(doc_id, chunk)
|
||||
insert_data_mongo(doc_id, content['path'], chunk)
|
||||
conn.commit()
|
||||
conn.close()
|
||||
|
||||
def insert_data_mongo(id, pChunk):
|
||||
def insert_data_mongo(id, filepath,pChunk):
|
||||
client = pymongo.MongoClient('mongodb://python:PasswordPassword123@localhost:27017/')
|
||||
mongodb = client['document_table']
|
||||
collection = mongodb['documents']
|
||||
dokument = {
|
||||
'doc_id': id,
|
||||
'filepath': filepath,
|
||||
'chunk_content': pChunk,
|
||||
}
|
||||
collection.insert_one(dokument)
|
||||
|
||||
Reference in New Issue
Block a user