puuuush
PUUUUUUUUUUSH MORE DATA
This commit is contained in:
@@ -78,6 +78,6 @@ def get_data_from_mongo(dataset):
|
||||
|
||||
for set in dataset:
|
||||
json_data = collection.find_one({"doc_id": set[0]})
|
||||
result_string += json_data["chunk_content"]
|
||||
result_string += "Dateipfad: " + json_data["filepath"] + "; Inhalt: " + json_data["chunk_content"] + "; "
|
||||
|
||||
return result_string
|
||||
@@ -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